worker 2.
Maybe something like:
addprocs(1)
@everywhere begin
defineA(src) = global const A = src
incrementA() = (A .+= 1)
getA() = A
end
Test it out:
p = 2
B = zeros(Int,2,2)
remotecall_fetch(defineA, p, B)
remotecall_fetch(getA, p)
remotecall_fetch(incrementA, p)
remotecall_fetch(getA, p)
B
.
You might also want to look at: How to avoid repeated data movement between processes?
See also ParallelDataTransfer, which provides helper functions for transferring data between worker processes.