You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The current SVD implementation has very unintuitive performance characteristics for small arrays:
importdask.arrayasda# Create short-fat (small) single-chunk arrayx=da.random.random((100, 100000), chunks=(-1, -1))
x.nbytes# 80000000 = 80MB# Despite x being 80MB, this uses ~80 **GB** of RAM and# I have no idea how long it would take to run (at least more than 5 minutes)da.linalg.svd(x)[0].mean().compute()
# This on the other hand runs almost instantly and barely uses any memoryda.linalg.svd(x.T)[2].T.mean().compute() # the U array is V.T when given x.T
With #6591 in place, it would make sense to identify single chunk arrays and transpose them first to avoid this. That still wouldn't stop a user from providing an array with weird chunking, but I think a special case for single-chunk arrays is appropriate.
With #6591 in place, it would make sense to identify single chunk arrays and transpose them first to avoid this.
+1 from me
That still wouldn't stop a user from providing an array with weird chunking, but I think a special case for single-chunk arrays is appropriate.
More generally, I think that there is a tension between doing what the user tells us, and making some decisions for them behind the scenes. Historically we've chosen to do what the user tells us, even if it's suboptimal, just to avoid magical behavior.
I think that we've made some decisions over the last couple of years that reverse this policy and gotten no push-back. Personally I'd be in favor of doing a lot more automated decision making. Transposing sounds great. We could go even further and do automatic rechunking and such.
If you're interested in making SVD performance more robust then I'm entirely in favor.
I think that we've made some decisions over the last couple of years that reverse this policy and gotten no push-back. Personally I'd be in favor of doing a lot more automated decision making. Transposing sounds great. We could go even further and do automatic rechunking and such.
Makes sense, thanks @mrocklin. I can't say I'd feel very confident in trying to add much more magical behavior beyond the easy single-chunk case yet, but I'll certainly try to report any useful info I find as we test tsqr more (for things other than SVD too).
On a related note, at some point I wanted to compare dask svd/tsqr to numpy/scipy svd on unchunked arrays and see if there's a big enough difference in performance that it would make sense to have some switch in our code for it. Do you know if that's already been done before?
I would hope that numpy/scipy svd would be faster than dask array's
implementation. For single-chunked arrays my preference would be for Dask
array to just call np.linalg.svd on the chunk
On Wed, Sep 9, 2020 at 11:18 AM Eric Czech ***@***.***> wrote:
I think that we've made some decisions over the last couple of years that
reverse this policy and gotten no push-back. Personally I'd be in favor of
doing a lot more automated decision making. Transposing sounds great. We
could go even further and do automatic rechunking and such.
Makes sense, thanks @mrocklin <https://github.com/mrocklin>. I can't say
I'd feel very confident in trying to add much more magical behavior beyond
the easy single-chunk case yet, but I'll certainly try to report any useful
info I find as we test tsqr more (for things other than SVD too).
On a related note, at some point I wanted to compare dask svd/tsqr to
numpy/scipy svd on unchunked arrays and see if there's a big enough
difference in performance that it would make sense to have some switch in
our code for it. Do you know if that's already been done before?
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#6612 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACKZTAWNFBYXV3GZCLAT63SE7BFJANCNFSM4RCTHXFQ>
.
Activity
mrocklin commentedon Sep 9, 2020
That is bizarre.
+1 from me
More generally, I think that there is a tension between doing what the user tells us, and making some decisions for them behind the scenes. Historically we've chosen to do what the user tells us, even if it's suboptimal, just to avoid magical behavior.
I think that we've made some decisions over the last couple of years that reverse this policy and gotten no push-back. Personally I'd be in favor of doing a lot more automated decision making. Transposing sounds great. We could go even further and do automatic rechunking and such.
If you're interested in making SVD performance more robust then I'm entirely in favor.
eric-czech commentedon Sep 9, 2020
Makes sense, thanks @mrocklin. I can't say I'd feel very confident in trying to add much more magical behavior beyond the easy single-chunk case yet, but I'll certainly try to report any useful info I find as we test tsqr more (for things other than SVD too).
On a related note, at some point I wanted to compare dask svd/tsqr to numpy/scipy svd on unchunked arrays and see if there's a big enough difference in performance that it would make sense to have some switch in our code for it. Do you know if that's already been done before?
mrocklin commentedon Sep 9, 2020
SVD single chunk bypass dask#6612
[-]Transpose single chunk arrays in svd[/-][+]Improve single chunk array handling in svd[/+]SVD single chunk bypass dask#6612
eric-czech commentedon Sep 11, 2020
Fixed by #6616 (and partially #6623)