feat: make thust support new version more simple

This commit is contained in:
kradchen
2024-12-18 17:53:22 +08:00
parent 4e155617af
commit c5a64dccc0
2 changed files with 5 additions and 20 deletions

View File

@@ -8,11 +8,11 @@
#include <cstddef> #include <cstddef>
#include <cstdlib> #include <cstdlib>
#include <sys/types.h> #include <sys/types.h>
#if THRUST_VERSION >= 200000
//this 3 header, only need by cuda version >= 12
#include <thrust/unique.h> #include <thrust/unique.h>
#include <thrust/sort.h> #include <thrust/sort.h>
#include <thrust/set_operations.h> #include <thrust/set_operations.h>
#endif
#include <thrust/device_vector.h> #include <thrust/device_vector.h>
#include <thrust/transform.h> #include <thrust/transform.h>
@@ -55,22 +55,6 @@ __global__ void complexKernel(float *aInputRealData, float *aInputImagData, floa
} }
} }
#if THRUST_VERSION >= 200000
template<typename InputIterator,
typename OutputIterator,
typename UnaryFunction>
void callThrustTransform(InputIterator aInput, OutputIterator aOutput, UnaryFunction aFunc){
thrust::transform(aInput, aOutput, aFunc);
}
#else
template<typename InputIterator,
typename OutputIterator,
typename UnaryFunction>
void callThrustTransform(InputIterator aInput, OutputIterator aOutput, UnaryFunction aFunc){
thrust::transform(thrust::device, aInput, aOutput, aFunc);
}
#endif
CudaMatrix Aurora::complex(const CudaMatrix &aMatrix) CudaMatrix Aurora::complex(const CudaMatrix &aMatrix)
{ {

View File

@@ -11,10 +11,11 @@
#include <iostream> #include <iostream>
#include <cmath> #include <cmath>
#if THRUST_VERSION >= 200000
//this 2 header only need by cuda version >= 12
#include <thrust/sort.h> #include <thrust/sort.h>
#include <thrust/set_operations.h> #include <thrust/set_operations.h>
#endif
#include <thrust/device_vector.h> #include <thrust/device_vector.h>
#include <thrust/transform.h> #include <thrust/transform.h>
#include <thrust/reduce.h> #include <thrust/reduce.h>