If I have a variable already defined in one process, how can I share it with all the other processes? @everywhere foo=1
does this for a new definition of foo
. But suppose I already assigned foo
to a value in the current process. Now I would like to use this same variable name to access this value in all processes. What’s the correct way to do it?
I think I figured it out. In Julia 0.6.4:
@eval @everywhere foo=$foo;
In Julia 1.0 I think it’s the same except that the @eval
is not required.
See https://github.com/ChrisRackauckas/ParallelDataTransfer.jl that’s built to solve that exact problem.
It doesn’t seem to support Julia 1.0 yet.