-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Support CuPy-backed arrays in DaskManager #11383
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
Draft
weiji14
wants to merge
10
commits into
pydata:main
Choose a base branch
from
weiji14:dask_with_cupy
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Draft
Changes from 7 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
1a03e39
Support CuPy-backed arrays in DaskManager.from_array method
weiji14 4465ea4
Fix no-untyped-call
weiji14 16009ee
Merge branch 'main' into dask_with_cupy
weiji14 b77cc57
Implement __array_namespace__ method on NDArrayMixin
weiji14 558f171
Merge branch 'main' into dask_with_cupy
weiji14 286053f
Fix repls for LazilyIndexedArray, MemoryCachedArray and IndexingAdapter
weiji14 551abe8
Fix mypy unused-ignore
weiji14 ba652b8
Merge branch 'main' into dask_with_cupy
weiji14 7132f73
Put __array_namespace__ on ImplicitToExplicitIndexingAdapter instead
weiji14 3980fcb
Merge branch 'main' into dask_with_cupy
keewis File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
is usually the way to do it
Uh oh!
There was an error while loading. Please reload this page.
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.
Excellent hint, but actually, not needed anymore. I talked to @keewis on the Pangeo call just now, and figured out the right-level of abstraction is to put the
__array_namespace__method inImplicitToExplicitIndexingAdapterinstead ofNDArrayMixin(commit 7132f73). So we won't need to change this repr stuff anymore.Uh oh!
There was an error while loading. Please reload this page.
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.
Oh wait, commit 7132f73 might not be correct either 😅 I'll actually need to use your suggestion here, and really should write a proper test for this first...
Uh oh!
There was an error while loading. Please reload this page.
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.
Here github still has the version of the notebook:L https://github.com/dcherian/cupy-xarray/blob/kvikio-entrypoint/docs/source/kvikio.ipynb
Doesn't work: Chunk with daskis the sectionAnd this is the issue:
https://github.com/dask/dask/blob/cbbac094376f03d4d3fb933a6f115e3416981263/dask/array/core.py#L120-L144
Today, that
np.asarrayis what triggers a concrete read in to memory. If you advertise array-namespace and thus satisfyis_arraylikethat read isn't triggered. we could add a patch to dask to hardcode support for xarray classes and call.get_duck_array(i bet this is fine).My bigger concern is that advertising array api compliance will break random downstream code in a similar way somehow (but maybe not).