Dear All,
I have being having an issue with Distributed Arrays in Julia 0.3. It
seems that the DArray is not broadcast to the workers when it is declared
inside an if block. Here are two codes listings. Listing 1 works and
declares the DArray before the if block. Listing 2 does not work and
declares the DArray inside the if block. Can other people reproduce this
behavior. If so, is this expected, or should I file an issue? Thanks!
Sam
Listing 1:
addprocs(4)
D = dones(4,1)
if 1 == 1
@sync begin
for i = 1:4
@spawnat procs(D)[i] begin
fill!(localpart(D),1.0*i)
end
end
end
@show D
end
Listing 2:
addprocs(4)
if 1 == 1
D = dones(4,1)
@sync begin
for i = 1:4
@spawnat procs(D)[i] begin
fill!(localpart(D),1.0*i)
end
end
end
@show D
end
The output of Listing 1 is:
$ julia listing1.jl
D => [1.0
2.0
3.0
4.0]
The output of listing 2 is:
julia listing2.jl
exception on 2: exception on 5: exception on exception on 3: 4: ERROR: D not
defined
in anonymous at multi.jl:8
in anonymous at multi.jl:848
in run_work_thunk at multi.jl:621
in run_work_thunk at multi.jl:630
in anonymous at task.jl:6
ERROR: D not defined
in anonymous at multi.jl:8
in anonymous at multi.jl:848
in run_work_thunk at multi.jl:621
in run_work_thunk at multi.jl:630
in anonymous at task.jl:6
ERROR: D not defined
in anonymous at multi.jl:8
in anonymous at multi.jl:848
in run_work_thunk at multi.jl:621
in run_work_thunk at multi.jl:630
in anonymous at task.jl:6
ERROR: D not defined
in anonymous at multi.jl:8
in anonymous at multi.jl:848
in run_work_thunk at multi.jl:621
in run_work_thunk at multi.jl:630
in anonymous at task.jl:6
D => [1.0
1.0
1.0
1.0]