Hi,
When I print the output of a shared array that I’ve populated with integers, the output is all zeros, unless I define another shared array before I start printing…
In particular, I run this code:
addprocs(3)
outpu = SharedArray{Int}(3)
@parallel for i = 1:3
outpu[i] = i
end
for i = 1:3
println(outpu[i])
end
arr = SharedArray{Int}(3)
for i = 1:3
println(outpu[i])
end
(which is a highly simplified version of what I’m actually trying to do), and the output is this:
0 0 0 1 2 3
If I comment out the line arr = SharedArray{Int}(3)
then the output is all zeros. So it seems that I have to define another shared array before println
works as expected. I’m using the work around at the moment (defining another shared array), but can someone explain this behavior all the same?