Go to the documentation of this file.
    6 #ifndef OPENMPCD_CUDA_DEVICECODE_IMPLEMENTATIONDETAILS_AVERAGE 
    7 #define OPENMPCD_CUDA_DEVICECODE_IMPLEMENTATIONDETAILS_AVERAGE 
   11 #include <thrust/execution_policy.h> 
   12 #include <thrust/reduce.h> 
   23         const T* 
const values,
 
   24         const std::size_t numberOfValues,
 
   28         thrust::reduce(thrust::device, values, values + numberOfValues);
 
   29     *output = result / numberOfValues;
 
   34         const T* 
const values,
 
   35         const std::size_t numberOfValues,
 
   42         if(numberOfValues == 0)
 
   56         thrust::reduce(thrust::device, values, values + numberOfValues) /
 
   66 #endif //OPENMPCD_CUDA_DEVICECODE_IMPLEMENTATIONDETAILS_AVERAGE 
  
#define OPENMPCD_THROW(ExceptionType, message)
Throws the given ExceptionType, passing the given message along with file and line number information...
 
static bool isDeviceMemoryPointer(const void *const ptr)
Returns whether the given pointer is a pointer to CUDA Device memory.
 
static void copyElementsFromHostToDevice(const T *const src, T *const dest, const std::size_t count)
Copies count elements of type T from the Host to the Device.
 
__global__ void arithmeticMean_kernel(const T *const values, const std::size_t numberOfValues, T *const output)
Kernel to compute the arithmetic mean of the given values.
 
Invalid argument exception.
 
void arithmeticMean(const T *const values, const std::size_t numberOfValues, T *const output)
Computes, on the CUDA Device, the arithmetic mean of the given values.