Skip to content
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

GPU support for ndfilters & imread modules #151

Merged
merged 84 commits into from
Sep 1, 2020

Conversation

GenevieveBuckley
Copy link
Collaborator

@GenevieveBuckley GenevieveBuckley commented Aug 17, 2020

This branch contains broader support for GPU array computation with cupy & dask-image.

Related PR: #150
Related issue: #133

TODO

  • ndfilters - done! (Note: @jakirkham used a clever way to avoid repetition with the minimum, median, and maximum filters, but this PR opts for a small amount of repetition for the sake of simplicity - it seemed easier to keep the docstring wrapper function and the dispatching working well this way)
  • imread - done!
  • Tests explicitly using cupy arrays (even if we have to mark them as skipped on CI)

For future PRs

  • GPU support for ndmorph - easy to implement (see gist here), but it relies on having cupy support for the functions binary_dilation() and binary_erosion() which does not currently exist.
  • GPU support for ndfourier - problem: lots of numpy specific array creation in dask_image.ndfourier._utils
  • GPU support for ndmeasure - problem: lots of numpy specific array creation in distributed labelling. I still need to look at what needs to be done to support all the ndmeasure functions.

@GenevieveBuckley GenevieveBuckley changed the title GPU support for ndfilters, ndmorph, & imread modules GPU support for ndfilters & imread modules Aug 31, 2020
@GenevieveBuckley
Copy link
Collaborator Author

GenevieveBuckley commented Aug 31, 2020

### Request for help: lazy dispatch for correlate.
I'm at my wits end here, so if you have any suggestions @jakirkham I'd be happy to hear them.

EDIT: I have found the place where I made my typo so I no longer need help here, hooray!

What works:

  • Dispatch for convolve with lazy cupy function registration
    • The implementation for convolve is virtually identical to the implementation for correlate, I don't understand why they are behaving differently.
    • All the other ndfilter function dispatchers seem to work fine too, it's just correlate that's not working
  • The non-lazy version of the correlate dispatch for cupy arrays also works. You can try this yourself by commenting lines 66-67 in dask-image/dask_image/dispatch/_dispatch_ndfilters.py and then indenting lines 68-73 below that.

What doesn't work:

  • Dispatch for correlate with lazy cupy function registration

EDITED TO ADD: What the problem actually was that I accidentally decorated two functions with @dispatch_correlate.register_lazy("cupy"). Fixed it in commit 3eb3ec2

@chrisroat
Copy link

Regarding binary_dilation and binary_erosion for ndmorph, there is cupy support through the following repo. Not sure if you can borrow or depend on it:
https://github.com/mritools/cupyimg

@GenevieveBuckley
Copy link
Collaborator Author

Regarding binary_dilation and binary_erosion for ndmorph, there is cupy support through the following repo. Not sure if you can borrow or depend on it:
https://github.com/mritools/cupyimg

Good to know, thanks @chrisroat

1 similar comment
@GenevieveBuckley
Copy link
Collaborator Author

Regarding binary_dilation and binary_erosion for ndmorph, there is cupy support through the following repo. Not sure if you can borrow or depend on it:
https://github.com/mritools/cupyimg

Good to know, thanks @chrisroat

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants