Skip to content
This repository was archived by the owner on Mar 21, 2024. It is now read-only.

Support more generic scan_op in device_scan #526

Closed
cctry opened this issue Jul 12, 2022 · 3 comments
Closed

Support more generic scan_op in device_scan #526

cctry opened this issue Jul 12, 2022 · 3 comments

Comments

@cctry
Copy link

cctry commented Jul 12, 2022

Will cub support using more generic scan_op such as T1 operator()(T1 &a, T2 &b) ? The use case is to scan on an array of structs and calculate based on structs' members.
Is there any suggestion on implementing such a primitive?

@gevtushenko
Copy link
Collaborator

Hello, @cctry!

I believe that your case will be addressed by the following PR. After the PR is merged, function object return type will be selected as an accumulator type. So you'll be able to pass the mentioned scan_op.

@elstehle
Copy link
Collaborator

Is there any suggestion on implementing such a primitive?

A common pattern to resolve the situation you are describing is to use a cub::TransformInputIterator and/or thrust::transform_output_iterator. If you're able to provide more details of what exactly you're trying to achieve, we may be able to assess whether that could work in your case and provide more guidance on how the iterators could be applied.

@alliepiper
Copy link
Collaborator

Closing as @elstehle's answer will work currently, and @senior-zero covered a future improvement in this area. Let us know if you have any other questions about this.

@alliepiper alliepiper closed this as not planned Won't fix, can't repro, duplicate, stale Jul 25, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants