Library/ManagedCuda/NPP/NPPImageBase.cs
/// <summary>
/// Copy data from device to host memory
/// </summary>
/// <param name="hostDest">IntPtr to destination in host memory</param>
/// <param name="stride">Size of one image line in bytes with padding</param>
///// <param name="width">Width in bytes</param>
///// <param name="height">Height in elements</param>
Copy data from device to host memory
Copy data from device to host memory
public void CopyToHost(IntPtr hostDest, SizeT stride)
		{
			if (disposed) throw new ObjectDisposedException(this.ToString());
			CUDAMemCpy2D copyParams = new CUDAMemCpy2D();
			copyParams.dstHost = hostDest;
			copyParams.dstPitch = stride;
			copyParams.dstMemoryType = CUMemoryType.Host;
			copyParams.srcDevice = _devPtr;
			copyParams.srcMemoryType = CUMemoryType.Device;
			copyParams.srcPitch = _pitch;
			copyParams.Height = _sizeOriginal.height;
			copyParams.WidthInBytes = _sizeOriginal.width * _typeSize * _channels;
			res = DriverAPINativeMethods.SynchronousMemcpy_v2.cuMemcpy2D_v2(ref copyParams);
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMemcpy2D", res));
			if (res != CUResult.Success)
				throw new CudaException(res);
		}
public void CopyToHost ( IntPtr hostDest , SizeT stride ) { if ( disposed ) throw new ObjectDisposedException ( this . ToString ( ) ) ; CUDAMemCpy2D copyParams = new CUDAMemCpy2D ( ) ; copyParams . dstHost = hostDest ; copyParams . dstPitch = stride ; copyParams . dstMemoryType = CUMemoryType . Host ; copyParams . srcDevice = _devPtr ; copyParams . srcMemoryType = CUMemoryType . Device ; copyParams . srcPitch = _pitch ; copyParams . Height = _sizeOriginal . height ; copyParams . WidthInBytes = _sizeOriginal . width * _typeSize * _channels ; res = DriverAPINativeMethods . SynchronousMemcpy_v2 . cuMemcpy2D_v2 ( ref copyParams ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; if ( res != CUResult . Success ) throw new CudaException ( res ) ; }
Copy data from device to host memory
Copy data from device to host memory
hostDest
IntPtr
IntPtr to destination in host memory
IntPtr to destination in host memory
stride
SizeT
Size of one image line in bytes with padding
Size of one image line in bytes with padding
width
Width in bytes
Width in bytes
height
Height in elements
Height in elements