From e5d5d31a0af09312118f72c0818a824443ba80fb Mon Sep 17 00:00:00 2001 From: Pietro Incardona <incardon@mpi-cbg.de> Date: Fri, 24 Aug 2018 03:13:37 +0200 Subject: [PATCH] Fixing copy of cuda memory for temporary --- src/memory/CudaMemory.cuh | 20 +++++++------------- src/memory/HeapMemory.cpp | 2 ++ 2 files changed, 9 insertions(+), 13 deletions(-) diff --git a/src/memory/CudaMemory.cuh b/src/memory/CudaMemory.cuh index a6a6502..480a618 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 80d3c3b..b256641 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; } -- GitLab