I am trying to access parts of a distributed array that belongs to the
current worker
res=dzeros((1,length(workers())), workers(), [1,length(workers())])
(for some reason res=dzeros((length(workers())), workers(),
[length(workers())]) throws an error )
@spawnat 2 localpart(res)[1]+=rand()
works perfectly fine. However,
@everywhere function dowork()
localpart(res)[1]+=rand()
end
@spawnat 2 dowork()
produces error exception on 2: ERROR: res not defined
so does
@async begin
localpart(res)[1]+=rand()
end
throws ERROR: BoundsError().
Why do the two code snipplets produce errors?