I'm wondering what the correct way of achieving the following is:
Say I have a bunch of Arrays, and I need them as input for a function
inside a loop I want to parallelize. In line with this discussion
<https://groups.google.com/forum/#!topic/julia-users/b4tEzOOOnJI> in the
user groups, it appears that this is a good situation in which to use
SharedArrays. Since these Arrays are being initialized in various parts of
my code (which don't run in parallel), I though I could retroactively make
them available to all workers in the following way:
function arraycreation()
a = Array(Float64, 100)
b = similar(a)
... some calculations ...
return a, b
end
addprocs(3)
convert(SharedArray, a)
convert(SharedArray, b)
But when I then try to to run @everywhere function2(a), Julia tells me that a
is not available on workers 2, 3, and 4.
What is the correct way of making SharedArrays available on all workers?