Hello!
I was wondering what is the difference between @spawn
, remotecall_wait
and remotecall_fetch
. For instance, consider the following MWE:
using Distributed
@everywhere using DistributedArrays
@everywhere function foo(v::Array)
v .= myid()
return
end
@everywhere function foo(v::DArray)
return foo(localpart(v))
end
function main()
v = dzeros((10,), workers(), nworkers())
@time @sync begin
for p in procs(v)
# @async remotecall_wait(foo, p, v)
# @async remotecall_fetch(foo, p, v)
@spawnat p foo(v)
end
end
println(v)
return
end
main()
I run the script saved in the file testDistributedArrays.jl
with: julia -p 4 testDistributedArrays.jl
All the three commands return the same vector. What is the difference between them? What am I missing?
Thank you very much