The following uses always the locally defined variable:
using Distributed addprocs(1) @everywhere c = 10 c = 3 pmap(1:1) do i c end # 3 @everywhere f(x) = c pmap(f, 1:1) # 3
How can I guarantee that my function uses the remotely defined variable?
The only way to get it to use the remotely defined variable is to not have it defined locally, but I don’t really want to rely on this:
@everywhere d = 2 pmap(1:1) do i d end # 2