Groups 72 of 99+ julia-users › Question regarding @sync @parallel and SharedArrays - different results everytime 1 post by 1 author Eduardo Lenz Jul 30 Hi. I was playing with SharedArrays and parallel lopps and the following happened (Julia 0.4.6, windows official build) addprocs(4) julia> A =SharedArray(Float64,5) 5-element SharedArray{Float64,1}: 0.0 0.0 0.0 0.0 0.0 julia> @sync @parallel for i=1:1000 for j=1:5 A[j] += 1 end end 4-element Array{Any,1}: RemoteRef{Channel{Any}}(2,1,105) RemoteRef{Channel{Any}}(3,1,106) RemoteRef{Channel{Any}}(4,1,107) RemoteRef{Channel{Any}}(5,1,108) julia> A 5-element SharedArray{Float64,1}: 857.0 866.0 869.0 866.0 866.0 julia> A =SharedArray(Float64,5) 5-element SharedArray{Float64,1}: 0.0 0.0 0.0 0.0 0.0 julia> @sync @parallel for i=1:1000 for j=1:5 A[j] += 1 end end 4-element Array{Any,1}: RemoteRef{Channel{Any}}(2,1,89) RemoteRef{Channel{Any}}(3,1,90) RemoteRef{Channel{Any}}(4,1,91) RemoteRef{Channel{Any}}(5,1,92) julia> A 5-element SharedArray{Float64,1}: 1000.0 1000.0 1000.0 1000.0 1000.0 Why the results are different ? I would expect 1000 everytime. Am I doing something so silly that I cannot see in this such simple example ? Thanks.