Hi,

I did this simple code to try to understand how shared arrays work. 
Unfortunately my shared array c[ ] is always empty :(
Here I know the size of the final array c because it is a very simple 
example, but  is it possible to create an empty shared array and push the 
results inside using push() function ?

Thank you very much for your comments !

addprocs(2)

 a = rand(8)
 b = rand(8)

 convert(SharedArray,a)
 convert(SharedArray,b)

 c = SharedArray(Float64,8)

 @everywhere function prod(x,y)
   z = x*y
   return z
 end

@parallel for i=1:10
  c[i] = prod(a[i], b[i])
end

println(c)

# result : [0.0,0.0,0.0,0.0,0.0,0.0,0.0,0.0] :(





Reply via email to