cccl icon indicating copy to clipboard operation
cccl copied to clipboard

[FEA]: Replace `thrust` type traits with `libcu++`

Open miscco opened this issue 2 years ago • 8 comments

Is this a duplicate?

  • [X] I confirmed there appear to be no duplicate issues for this request and that I agree to the Code of Conduct

Area

Thrust

Is your feature request related to a problem? Please describe.

Thrust predates our investments into libcu++.

Consequently it has a lot of machinery implemented on its own. Mostly in https://github.com/NVIDIA/cccl/blob/main/thrust/thrust/detail/type_traits.h

We should remove all custom type traits in favor of cuda::std:: implementations

Describe the solution you'd like

We should simply include the cuda/std/type_traits header and use aliases whenever possible, e.g. this

template<typename T1, typename T2>
  struct is_same
    : public false_type
{
}; // end is_same

template<typename T>
  struct is_same<T,T>
    : public true_type
{
}; // end is_same

Would become:

template<typename T, typename U>
using is_same = ::cuda::std::is_same<T,U>:

Describe alternatives you've considered

No response

Additional context

No response

miscco avatar Sep 26 '23 08:09 miscco

I'm all for this and would love to see it prioritized. This is a blocker for addressing #403. Based on my study (https://github.com/cupy/cupy/pull/7869), Thrust is extremely NVRTC unfriendly because thrust/detail/type_traits.h directly/indirectly includes a ton of host code that just paralyzes NVRTC. Fixing at least this header moves us one step closer.

leofang avatar Sep 30 '23 00:09 leofang

Hi, never contributed before, but this one looks like a good first issue. I will try to tackle this on my own time if that is ok :)

ZelboK avatar Oct 09 '23 15:10 ZelboK

Hi, never contributed before, but this one looks like a good first issue. I will try to tackle this on my own time if that is ok :)

Hi @ZelboK that is awesome! Please do not hesitate to ping us here if there are any questions arising.

We are painfully aware that our documentation currently is not up to date

miscco avatar Oct 09 '23 16:10 miscco

We are painfully aware that our documentation currently is not up to date

Hey, our contributor guide docs are up to date! @ZelboK you can check out how to get started here: https://github.com/NVIDIA/cccl/blob/main/CONTRIBUTING.md

To start, I'd suggest making sure you can set up the development containers and can successfully build the tests.

jrhemstad avatar Oct 09 '23 17:10 jrhemstad

Thank you folks! Is there some slack channel or discord server that I can join, or is this the preferred discussion channel?

I currently use WSL2 and a 3080. Currently following the docs on building the tests. Hopefully I won't run into too many troubles with code generation on older architectures. I plan on doing this independently before I ask questions for the learning experience :)

ZelboK avatar Oct 09 '23 18:10 ZelboK

Is there some slack channel or discord server that I can join, or is this the preferred discussion channel?

Not yet, I'm working on getting us a dedicated channel on the NVIDIA Discord. I'll let you know when I've got that done :)

I currently use WSL2 and a 3080.

This should work as there are folks on our team who use WSL2 with the Dev Containers. It's on my TODO list to add a section for any WSL-specific instructions to the dev container README.

Let us know if you run into any problems!

jrhemstad avatar Oct 09 '23 18:10 jrhemstad

Hey @ZelboK, you can join the #cuda-cpp-core-libraries channel on the NVIDIA Discord here: https://discord.gg/nvXdfvRh

jrhemstad avatar Oct 09 '23 21:10 jrhemstad

Joined! Thank you that was quick :) My discord IGN is Kashimo. I should probably stop using different names everywhere

ZelboK avatar Oct 09 '23 22:10 ZelboK