Is it possible to transform from one type to another using thrust::transform/thrust::transform_reduce? #4676
-
I'm recently trying to GPU-accelerate some function that finds maximum of I tried to implement that, but it's not compiling. Then I realised that all examples are showing the case where the input vector and output vector are of the same type. Also, the Unary Functor is taking one and only type in the template. Is it true that thrust is just not capable of doing such an operation? Or am I being stupid and having something missing? |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 2 replies
-
I believe you should have a look at the minmax example. That should get you started |
Beta Was this translation helpful? Give feedback.
-
As the example cited by miscco shows, transforming from one type to another is certainly possible. Generally it is desirable to use Structs-of-Arrays (SoA) instead of Arrays-of-Structs (AoS) because for good performance (especially in memory-bound kernels like
Which unary functor are you referring to? Please be more specific. |
Beta Was this translation helpful? Give feedback.
I believe you should have a look at the minmax example.
That should get you started