Apparently I must have a fundamental misunderstanding about DistributedArrays.jl. I have set up a MWE of something similar to what I have to do:
using Distributed
using DistributedArrays
addprocs()
@everywhere using Distributed, DistributedArrays
a = distribute(zeros(5))
@sync @distributed for i in 1:5
a_l = localpart(a)
a_l[i] = 100 * i
end
And then I run into the following Error:
ERROR: TaskFailedException:
On worker 2:
BoundsError: attempt to access 1-element Array{Float64,1} at index [2]
setindex! at ./array.jl:847
macro expansion at /home/user/test.jl:36 [inlined]
[inlined]
#17 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/macros.jl:301
#160 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/macros.jl:87
#103 at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:290
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:79
run_work_thunk at /buildworker/worker/package_linux64/build/usr/share/julia/stdlib/v1.5/Distributed/src/process_messages.jl:88
#96 at ./task.jl:356
...and 3 more exception(s).
Stacktrace:
[1] sync_end(::Channel{Any}) at ./task.jl:314
[2] (::Distributed.var"#159#161"{var"#17#18",UnitRange{Int64}})() at ./task.jl:333
Stacktrace:
sync_end(::Channel{Any}) at ./task.jl
top-level scope at task.jl
Using a = dzeros((5,1), workers()) also gives the same Error. Any help is appreciated!