Commit aa00b03d authored by incardon's avatar incardon
Browse files

Adding function to fix leak

parent 7497a094
Pipeline #2419 passed with stages
in 11 seconds
......@@ -293,6 +293,24 @@ void CudaMemory::deviceToHost()
CUDA_SAFE_CALL(cudaMemcpy(hm,dm,sz,cudaMemcpyDeviceToHost));
}
/*! \brief It transfer to device memory from the host of another memory
*
* \param mem the other memory object
*
*/
void CudaMemory::deviceToHost(CudaMemory & mem)
{
// allocate an host memory if not allocated
if (mem.hm == NULL)
mem.allocate_host(sz);
if (mem.sz > sz)
{resize(mem.sz);}
//! copy from device to host memory
CUDA_SAFE_CALL(cudaMemcpy(mem.hm,dm,mem.sz,cudaMemcpyDeviceToHost));
}
/*! \brief It transfer to device memory from the host of another memory
*
* \param mem the other memory object
......
......@@ -107,8 +107,12 @@ public:
//! Move memory from host to device, just the selected chunk
virtual void hostToDevice(size_t start, size_t top);
//! host to device using external memory (this host memory is copied into mem device memory)
void hostToDevice(CudaMemory & mem);
//! device to host using external memory (this device memory is copied into mem host memory)
void deviceToHost(CudaMemory & mem);
//! fill the buffer with a byte
virtual void fill(unsigned char c);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment