Question about passing data structures with SharedArray's


#1

I’m trying to learn how to use SharedArray properly.

Let’s say I have a Dict (or anything that holds SharedArray’s)

d = Dict(
    :a => SharedArray{Float64}(rand(1000)),
    :b => SharedArray{Float64}(rand(1000))
    )

I understand that the workers would not have a reference to d and therefore I could create functions that operates on d by passing it as in an argument e.g.

@everywhere sum_a(d) = sum(d[:a])

Now, when I call this function remotely, am I passing just the references not the entire structure given the argument contains SharedArray not regular arrays? I hope the answer is yes…

fetch(@spawnat 2 sum_a(d))

#2

Not exactly answering my own question but the SharedDict package is available.

This link also have some information about how a SharedDict
may be tricky to implement: https://stackoverflow.com/questions/36990409/is-there-something-like-shareddict-in-julia