Explicit distribution of chunks in SharedArray?

How can I construct a SharedArray with a specific chunk distribution across workers?
For instance:

julia -p 2
using SharedArrays,Distributed,Test
@everywhere using SharedArrays

a = SharedArray{Float64,2}((3,5),init = x-> ... )
@test @fetchfrom 2 localindices(a) == 1:6
@test @fetchfrom 2 localindices(a) == 7:15

Hey! If you read the help for localindices you can see that it is just a convenience function. You can distribute the work as you wish, unconstrained by localindices. The memory is shared by all the workers (for read/write purposes).

So you can do things like @fetchfrom 2 a[8] = myid(). Though 8 is not a “localindex” on 2.

If you want more control over distribution and ownership of memory, check out DistributedArrays.jl.



awesome, thanks