I create a DArray:
d = dzeros(3)
Now I would like to run a function in parallel using pmap. I would like that function to access whatever part of d is local on the current processor. Something like
function foo()
global d
a = localpart(d)
a[1] = 1
end
However, I get
exception on 2: exception on 4: ERROR: d not defined
in mcmc_sub! at /home/benjamin/.julia/v0.3/Mamba/src/model/mcmc.jl:67
in anonymous at multi.jl:847
in run_work_thunk at multi.jl:613
in anonymous at task.jl:847
on each process.
d should be defined on each processor. For example code like this works:
julia> d = dzeros(3)
3-element DArray{Float64,1,Array{Float64,1}}:
0.0
0.0
0.0
julia> @spawnat(2, (a = localpart(d); a[1]=1;))
RemoteRef(2,1,65)
julia> d
3-element DArray{Float64,1,Array{Float64,1}}:
1.0
0.0
0.0