Hi, I’m trying to get distributed arrays to work correctly for my distributed for loop. I’m getting this weird outcome where not all workers do their task always, even though I know they’ve been assigned correctly (using procs). Not sure what’s going on. Here a MWE:
using Distributed
addprocs(4)
@everywhere begin
using DistributedArrays
result_D = dzeros(Float64,(2,4), workers()[1:4],[1,4])
initq = [i*ones(2,1) for i in 1:4]
@sync @distributed for ele in initq
res_local = localpart(result_D)
res_local .= ele
end
end
result = convert(Array,result_D)
When I run this, the results are inconsistent: sometimes the whole array stays empty, sometimes one worker does a job, sometimes a few. What could be the issue?