It seems that there is a bug when you define several SharedArray in one
call (for example using include("file.jl")). Or maybe I'm missing something
about how to use SharedArray. I'm using Windows 7. Let me explain with an
example:
This code has no problem. It assign correctly the values of SharedArrays a
and b:
######
julia> a = SharedArray(Float64, (2));
julia> b = SharedArray(Float64, (2));
julia> for i in 1:2
a[i] = i
end
julia> for i in 1:2
b[i] = i+2
end
julia> a
2-element SharedArray{Float64,1}:
1.0
2.0
julia> b
2-element SharedArray{Float64,1}:
3.0
4.0
######
But the following code has a problem. It assign incorrectly the same value
to a and b:
######
julia> a = SharedArray(Float64, (2));b = SharedArray(Float64, (2));
julia> for i in 1:2
a[i] = i
end
julia> for i in 1:2
b[i] = i+2
end
julia> a
2-element SharedArray{Float64,1}:
3.0
4.0
julia> b
2-element SharedArray{Float64,1}:
3.0
4.0
######
If you define multiple SharedArray in one call, the values of all the
SharedArrays of that call are equal to the values of the last SharedArray that
was defined and has assigned values.
Is this behavior expected? Or is it a bug?
Thanks!