I think you are having scoping issues. When you execute @everywhere initA(), the function is executed on all workers: it defines A within the local scope and when it returns, A is lost. The line @test @fetchfrom 2 A .== fill(3.0,3) fails because it’s looking for a variable A at the global scope on the second worker, which you havn’t defined.
What you need to do is define A at the global scope for each worker and then modify the functions to mutate that global variable. Something like @everwhere A = zeros(Float64, 3) which will define A on both worker 2 and 3, which can then be mutated by functions run on those workers.
Something like
@everywhere A = zeros(Float64, 3) # define A as a global variable for all workers
@everywhere function initA()
id = myid()
global A # tell the function to use the global variable instead of creating a new one
A = fill(1.0,3) .+ id
println("id:$id, initial A=$A")
end
remotecall_wait(initA,2)
remotecall_wait(initA,3) # or use a loop
But you should really think about/avoid using global variables for performance purposes. Very easy to introduce bugs as well. If you want parallelism with shared memory, you should look at Threads rather than Distributed.