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

Replace use of thrust::identity by cuda::std::identity #2762

Closed
Tracked by #3700
bernhardmgruber opened this issue Nov 11, 2024 · 2 comments · Fixed by #3649
Closed
Tracked by #3700

Replace use of thrust::identity by cuda::std::identity #2762

bernhardmgruber opened this issue Nov 11, 2024 · 2 comments · Fixed by #3649
Labels
cub For all items related to CUB thrust For all items related to Thrust.

Comments

@bernhardmgruber
Copy link
Contributor

thrust::identity<T> should eventually be replaced by cuda::std::identity. However, contrary to most other function objects, which have the same behavior in Thrust and libcu++, this is not straight forward, since thrust::identity<T> casts whatever argument it gets to const T&. Thus, at every use of thrust::identity<T> it has to be considered whether a cast is intended/required here.

@github-project-automation github-project-automation bot moved this to Todo in CCCL Nov 11, 2024
@bernhardmgruber bernhardmgruber added thrust For all items related to Thrust. cub For all items related to CUB labels Nov 11, 2024
@bernhardmgruber
Copy link
Contributor Author

We can probably not replace it directly, since thrust::identity<T> performs a cast to T, whereas cuda::std::identity just forwards. But because this behavior is unexpected, we may want to add a function object that casts (with a different name) and deprecate (with eventual removal) thrust::identity.

@bernhardmgruber
Copy link
Contributor Author

We can probably not replace it directly, since thrust::identity<T> performs a cast to T, whereas cuda::std::identity just forwards. But because this behavior is unexpected, we may want to add a function object that casts (with a different name) and deprecate (with eventual removal) thrust::identity.

Or we just drop it regardless, and users who relied on the casting behavior should supply their own function object which performs a cast.

@github-project-automation github-project-automation bot moved this from Todo to Done in CCCL Feb 5, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cub For all items related to CUB thrust For all items related to Thrust.
Projects
Status: Done
Development

Successfully merging a pull request may close this issue.

1 participant