-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make copy(DArray) copy #9745
Make copy(DArray) copy #9745
Conversation
@@ -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("desination array doens't fit to source array")) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
destination array doesn't
89b571f
to
17cc50f
Compare
Having |
17cc50f
to
bc981f2
Compare
bc981f2
to
10a45eb
Compare
Turns out this breaks
|
It's a behavior change, not a bug fix. |
|
||
@test d == dc # Should be identical | ||
@spawnat workers()[1] localpart(dc)[1] = 0 | ||
@test fetch(@spawnat workers()[1] localpart(d)[1] != 0) # but not point to the same memory |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should be @spawnat id_other localpart(dc)[1] = 0
and @test fetch(@spawnat id_other localpart(d)[1] != 0)
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That is probably true. I'll change it.
@tkelman I've pushed the change proposed by @amitmurthy so hopefully we won't see that test fail again. |
I was actually awaiting the tests to finish, but now the commit should be there. |
@andreasnoack sorry I'm impatient, |
Right now
copy(DArray)
is a noop. I don't see why this is necessary and I'd like to be able to copy myDArray
s when passing them to mutating linear algebra functions.cc: @JeffBezanson