Skip to content

Commit

Permalink
ensure proper initialization in distribute()
Browse files Browse the repository at this point in the history
  • Loading branch information
amitmurthy committed Feb 7, 2015
1 parent 67636af commit 6861489
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion base/darray.jl
Original file line number Diff line number Diff line change
Expand Up @@ -166,9 +166,15 @@ function distribute(a::AbstractArray)
owner = myid()
rr = RemoteRef()
put!(rr, a)
DArray(size(a)) do I
d = DArray(size(a)) do I
remotecall_fetch(owner, ()->fetch(rr)[I...])
end
# Ensure that all workers have fetched their localparts.
# Else a gc in between can recover the RemoteRef rr
for chunk in d.chunks
wait(chunk)
end
d
end

function convert{S,T,N}(::Type{Array{S,N}}, d::DArray{T,N})
Expand Down

0 comments on commit 6861489

Please sign in to comment.