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

Gather inventory of CuPy's CCCL usage #2959

Closed
jrhemstad opened this issue Nov 25, 2024 · 3 comments
Closed

Gather inventory of CuPy's CCCL usage #2959

jrhemstad opened this issue Nov 25, 2024 · 3 comments
Assignees

Comments

@jrhemstad
Copy link
Collaborator

We'd like a list of:

  • Every Thrust/CUB function used in CuPy today
  • Thrust/CUB functions CuPy would like to be using but cannot
@shwina
Copy link
Contributor

shwina commented Nov 28, 2024

Every Thrust/CUB function used in CuPy today

This is just an initial analysis. CUB and Thrust usage in CuPy can be found in cupy_cub.cu and cupy_thrust.cu respectively.

cub

  • DeviceReduce
  • DeviceSegmentedReduce
  • DeviceScan
  • DeviceSpmv
  • DeviceHistogram

thrust

  • stable_sort
  • stable_sort_by_key

For sorting a muilti-dimensional array along a specified axis (dimension), there’s a specialized algorithm which additionally uses:

  • sequence
  • transform
  • thrust::device_pointer_cast
  • thrust::device_ptr
  • thrust::tuple, thrust::get
  • thrust::make_counting_iterator
  • thrust::make_constant_iterator
  • thrust::divides

cub “patching”

In addition, within cupy_cub.cu there’s some code that specializes/supplements CUB:

  • Specializations like numeric_limits<thrust::complex<float>>> to support complex numbers
  • Specializing operators like Max(), Min() etc., for floats to handle NaNs in a way that matches NumPy semantics.

I’m not entirely sure how to include the the above specializations when switching CuPy over to use cuda.parallel. Something to keep in mind.

@leofang
Copy link
Member

leofang commented Dec 20, 2024

This is just an initial analysis. CUB and Thrust usage in CuPy can be found in cupy_cub.cu and cupy_thrust.cu respectively.

The list looks fine to me.

@leofang leofang closed this as completed Dec 20, 2024
@github-project-automation github-project-automation bot moved this from Todo to Done in CCCL Dec 20, 2024
@leofang
Copy link
Member

leofang commented Dec 20, 2024

I suggested during the meeting that we deprioritize DeviceHistogram because of several issues, e.g. #912

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

No branches or pull requests

3 participants