@everywhere and Dictionaries

You deleted important parts of the error message, so I can only guess, that you encounter this error or similar:

julia> using Distributed

julia> addprocs(2)
2-element Array{Int64,1}:
 26
 27

julia> par1=1
1

julia> par2=2
2

julia> @everywhere mod_pars = Dict("par1"=>par1,"par2"=>par2);
ERROR: On worker 2:
UndefVarError: par1 not defined
top-level scope at none:1

If I am correct, than you are correct, you need @everywhere on par1 and par2 as those are unknown at the workers. Or you can interpolate, like:

@everywhere mod_pars = Dict("par1"=>$par1,"par2"=>$par2);

Both ways may be not appropriate for your real problem, so it would be best to provide a MWE.

1 Like