From 8d49fc1fc10467ec97f9100200372f82e019fcc2 Mon Sep 17 00:00:00 2001 From: boufaras Date: Mon, 29 Nov 2010 11:04:30 +0000 Subject: [PATCH] add & git-svn-id: svn://scm.gforge.inria.fr/svnroot/paradiseo@2011 331e1502-861f-0410-8da2-ba01fb791d7f --- ParadisEO-GPU/src/memory/moCudaCopy.h | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/ParadisEO-GPU/src/memory/moCudaCopy.h b/ParadisEO-GPU/src/memory/moCudaCopy.h index 5e6d1b8f3..6af29c242 100644 --- a/ParadisEO-GPU/src/memory/moCudaCopy.h +++ b/ParadisEO-GPU/src/memory/moCudaCopy.h @@ -61,22 +61,26 @@ public: *@param _dataSize the size of data to copy */ - void operator()(T* _data, T * _dataTocpy, unsigned _dataSize) { - //copy data from CPU memory to GPU global memory + void operator()(T* & _data, T * & _dataTocpy, unsigned _dataSize) { + + //copy data from CPU memory to GPU memory CUDA_SAFE_CALL(cudaMemcpy(_data, _dataTocpy, _dataSize * sizeof(T), cudaMemcpyHostToDevice)); + // Check if the copy of data is failed CUT_CHECK_ERROR("Copy of data from CPU to GPU global memory failed"); } /** - *Copy n bytes from the memory area pointed to by _dataTocpy to the memory area pointed to by offset bytes from the start of symbol _dev_data - *@param _dev_data the data destination on device - *@param _dataTocpy the source memory address + *Copy device data from GPU global memory to global variable declared in device + *@param _dev_data the device global variable + *@param _dataTocpy the data to copy GPU global memory to GPU global variable */ - void operator()(T* _dev_data, T * _dataTocpy) { + void operator()(T* & _dev_data, T * & _dataTocpy) { + + //Copy n bytes from the memory area pointed to by _dataTocpy to the memory area pointed to by offset bytes from the start of symbol _dev_data cudaMemcpyToSymbol(_dev_data, &_dataTocpy, sizeof(_dataTocpy)); @@ -90,7 +94,7 @@ public: *@param _HostToDevice the direction of copy(true if copy will be done from CPU memory to GPU memory) */ - void operator()(T* _data, T * _dataTocpy, unsigned _dataSize, + void operator()(T* & _data, T * & _dataTocpy, unsigned _dataSize, bool _HostToDevice) { if (_HostToDevice) {