Skip to content

Commit

Permalink
Make copy(DArray) copy
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasnoack committed Jan 12, 2015
1 parent 5c6aa0d commit 17cc50f
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 @@ -245,7 +245,13 @@ end
getindex(d::DArray) = d[1]
getindex(d::DArray, I::Union(Int,UnitRange{Int})...) = sub(d,I...)

copy(d::SubOrDArray) = d
function copy!(dest::SubOrDArray, src::SubOrDArray)
dest.dims == src.dims && dest.pmap == src.pmap && dest.indexes == src.indexes && dest.cuts == src.cuts || throw(ArgumentError("destination array doesn't fit to source array"))
for p in dest.pmap
@spawnat p copy!(localpart(dest), localpart(src))
end
dest
end

# local copies are obtained by convert(Array, ) or assigning from
# a SubDArray to a local Array.
Expand Down

0 comments on commit 17cc50f

Please sign in to comment.