CUDA Thrust reduction with double2 arrays
I have the following (compilable and executable) code using CUDA Thrust to perform reductions of float2 arrays. It works correctly using namespace std; // includes, system #include <stdlib.h> #include <stdio.h> #include <string.h> #include <math.h> #include <conio.h> #include <typeinfo> #include <iostream> // includes CUDA #include <cuda.h> #include <cuda_runtime.h> // includes Thrust #include <thrust/host_vector.h> #include <thrust/device_vector.h> #include <thrust/reduce.h> // float2 + struct struct add_float2 { __device__ float2 operator()(const float2& a, const float2& b) const { float2 r;