You may use the DistributedArray constructor to get around these issues, it’s not very much more complicated.
julia> nworkers()
3
julia> @everywhere using DistributedArrays, OffsetArrays
julia> N = 6 # for demonstration
6
julia> Data = distribute(rand(N)); # using the default distribution at this point
julia> Result = DArray((N,4)) do inds # local indices on each processor
arr = zeros(inds) # We create an OffsetArray with the correct local indices
data_local = OffsetArray(localpart(Data),localindices(Data)) # get the local part of data on each processor and assign the proper indices
for i in inds[1]
arr[i,:] .= ones(4)*data_local[i]
end
parent(arr) # strip the OffsetArray wrapper
end
6×4 DArray{Float64,2,Array{Float64,2}}:
0.54454 0.54454 0.54454 0.54454
0.285744 0.285744 0.285744 0.285744
0.678867 0.678867 0.678867 0.678867
0.62554 0.62554 0.62554 0.62554
0.862751 0.862751 0.862751 0.862751
0.103856 0.103856 0.103856 0.103856