6 #if defined(CUFFT) || defined(CUFFTW)
7 #include "cuda_runtime.h"
9 #include "cuda/cuda_error_check.cuh"
13 template <typename T> class DynMem_ {
23 CudaSafeCall(cudaHostAlloc(reinterpret_cast<void **>(&this->ptr), size, cudaHostAllocMapped));
25 cudaHostGetDevicePointer(reinterpret_cast<void **>(&this->ptr_d), reinterpret_cast<void *>(this->ptr), 0));
27 this->ptr = new float[size];
30 DynMem_(DynMem_&& other) {
31 this->ptr = other.ptr;
32 this->ptr_d = other.ptr_d;
35 other.ptr_d = nullptr;
40 CudaSafeCall(cudaFreeHost(this->ptr));
45 T *hostMem() { return ptr; }
46 T *deviceMem() { return ptr_d; }
48 void operator=(DynMem_ &&rhs)
51 this->ptr_d = rhs.ptr_d;
57 typedef DynMem_<float> DynMem;