pmap inside a function also seems to work:

@everywhere f(A,i) = (println("A[$i] = $(A[i])+1"); A[i] += 1)
wrapped_pmap(A) = pmap(i -> f(A,i), 1:length(A))

S = SharedArray(Int,10)
S[:] = 1:length(S)

output1 = pmap(i -> f(S,i), 1:length(S)) #error
output2 = wrapped_pmap(S) #seems to work


I'm quite confused about why second version with pmap wrapped in a function 
works.
Perhaps someone can explain?
 

Reply via email to