diff --git a/src/memory/CudaMemory.cuh b/src/memory/CudaMemory.cuh index a6a6502f18dcc4bea002fcc40cd4a6f2f8e129c5..480a618ab048526f394140152d175e17a46ee51d 100644 --- a/src/memory/CudaMemory.cuh +++ b/src/memory/CudaMemory.cuh @@ -132,7 +132,7 @@ public: return false; } - // Copy the Heap memory + // Copy the memory (device and host) CudaMemory & operator=(const CudaMemory & mem) { copy(mem); @@ -149,24 +149,18 @@ public: CudaMemory(CudaMemory && mem) EXCEPT_MC { - - bool t_is_hm_sync = is_hm_sync; - size_t t_sz = sz; - void * t_dm = dm; - void * t_hm = hm; - long int t_ref_cnt = ref_cnt; - is_hm_sync = mem.is_hm_sync; sz = mem.sz; dm = mem.dm; hm = mem.hm; + ref_cnt = mem.ref_cnt; // reset mem - mem.is_hm_sync = t_is_hm_sync; - mem.sz = t_sz; - mem.dm = t_dm; - mem.hm = t_hm; - mem.ref_cnt = t_ref_cnt; + mem.is_hm_sync = false; + mem.sz = 0; + mem.dm = NULL; + mem.hm = NULL; + mem.ref_cnt = 0; } //! Constructor diff --git a/src/memory/HeapMemory.cpp b/src/memory/HeapMemory.cpp index 80d3c3bb9edf84a45565de6987c41ea16af2a31b..b2566418814a93120bf042359098378d26be200b 100644 --- a/src/memory/HeapMemory.cpp +++ b/src/memory/HeapMemory.cpp @@ -236,6 +236,8 @@ bool HeapMemory::resize(size_t sz) void * HeapMemory::getDevicePointer() { + std::cout << __FILE__ << ":" << __LINE__ << " Warning: you are trying to use this buffer on device (example GPU). The most probable cause to produce this message is that you are trying to offload a data-structure on device (example: GPU), but the data-structure is not supposed to work on device" << std::endl; + return dm; }