Add support for cupyx sparse to dask.array.dot#6846
Add support for cupyx sparse to dask.array.dot#6846martindurant merged 5 commits intodask:masterfrom
Conversation
|
Pinging @jakirkham to review if you get a chance. |
|
Or @pentschev
…On Tue, Nov 17, 2020 at 7:42 AM Julia Signell ***@***.***> wrote:
Pinging @jakirkham <https://github.com/jakirkham> to review if you get a
chance.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#6846 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACKZTAJTSJNBV5UYFEX2UDSQKKWBANCNFSM4TYCFKWQ>
.
|
pentschev
left a comment
There was a problem hiding this comment.
The changes look good to me overall, I've added some suggestions though.
dask/array/backends.py
Outdated
|
|
||
| concatenate_lookup.register(scipy.sparse.spmatrix, _concatenate) | ||
|
|
||
| def _tensordot(a, b, axes): |
There was a problem hiding this comment.
It seems like this implementation is exactly the same as the one above, is that correct? I would suggest we have the implementation on a separate function and have both lookups calling that function, this will simplify future maintenance.
There was a problem hiding this comment.
That is correct. I will fix it to use the same implementation for CuPy sparse and SciPy sparse.
| for a in sorted(axes[0]): | ||
| ind.insert(a, None) | ||
| x = x[tuple(ind)] | ||
| if len(axes[0]) != 1: |
There was a problem hiding this comment.
Are changes in this file a general Dask issue/limitation or are these specific for CuPy and SciPy? Dask can also use PyData's Sparse, so perhaps adding a test to cover these changes for CuPy in https://github.com/dask/dask/blob/master/dask/array/tests/test_cupy.py and PyData Sparse in https://github.com/dask/dask/blob/master/dask/array/tests/test_sparse.py would be good.
There was a problem hiding this comment.
This change affects not only CuPy and SciPy but also others, so I will add tests to check that.
There was a problem hiding this comment.
I don't think we need to add a test for PyData Sparse, as there already seems to be a test for tensordot.
dask/dask/array/tests/test_sparse.py
Lines 97 to 111 in bf17b72
|
Thanks for your comment, @pentschev ! I've fixed the PR based on your suggestions, so could you take a look? |
|
Thanks @anaruse ! |
|
Unfortunately this introduces memory issues for general Dask users due to the use of |
|
It is a necessary change for cupyx (and scipy) sparse... |
|
Thanks for the clarification @anaruse - I think we need some way of avoiding |
|
We could have a special case for sparse array (based on type) that introduces the contraction in |
|
Could someone please file a new issue with an (ideally not too large) example showing the issue? |
|
I filed #6916 with an example for this issue. |
This addresses #6820 and makes it available to run
dask.array.dotwith cupyx sparse (and scipy sparse as well).Click to see the output with current master
Click to see the output with this PR