Reduction using CUDA CUB with complex numbers

Good morning,

Quick question, does anyone know how to do a reduce on an array of cuFloatComplex numbers using CUB that is device-wide - e.g. cub::DeviceReduce call(s)? Any simple code or a link to describe if and how this can be done would be great. I assume that one must define some kind of custom functor to pass to the CUB call but have not found anything regarding cuFloatComplex types.


Is there any posted example code using cub::DeviceReduce with complex numbers ? I apologize if this is too simple a question, but I really would like to use CUB reduction with cuComplex (cuFloatComplex) numbers given the performance is very good with CUB.

My end goal is to use CUB reduction on an array of cuComplex numbers to a final scalar float value. Something along the lines of val += (array[i].x * array[I].x + array[i].y * array[i].y) for each element i of input array for final floating point value ‘val’ . If this is possible within CUB using a custom functor to be passed to cub::DeviceReduce operation that would be great, if not then just knowing would be good.

Thanks again for any help.