Distributed § Dimensional Arrays

I’m trying to distribute this Array into 2 processes each should have 5 lines I mean from zeros(10,10,10) each should have zeros(5,5,10) can someone help? I need it to be distributed in Rows and not in Colon, please

y=zeros(10,10,10)
distribute(y; dist=(2,1,100))
 

Im getting this error ==>error BoundsError: attempt to access 2-element Array{Int64,1} at index [1:200]

This doesn’t seem like a valid distribution. You start with zeros(10,10,10) that has 1000 elements, and end up with 2 arrays zeros(5,5,10) that have 250 elements each? You have lost half your array.

Perhaps you want two arrays of size (5,10,10) on each processor? You can do it like this:

julia> y = zeros(10,10,10);

julia> yd = distribute(y; dist=(2,1,1));

julia> @fetchfrom 2 DistributedArrays.localindices(yd)
(1:5, 1:10, 1:10)

julia> @fetchfrom 3 DistributedArrays.localindices(yd)
(6:10, 1:10, 1:10)
1 Like

wow Thanks