Library/ManagedCuda/CudaPitchedDeviceVariable.cs
/// <summary>
/// Copy data from device to host memory
/// </summary>
/// <param name="hostDest">Destination</param>
/// <param name="SrcXInBytes">Source X in bytes</param>
/// <param name="SrcY">Source Y</param>
/// <param name="DestXInBytes">Destination X in bytes</param>
/// <param name="DestY">Destination Y</param>
/// <param name="widthInBytes">Width in bytes</param>
/// <param name="height">Height in elements</param>
/// <param name="SrcPitch">Source pitch</param>
/// <param name="DestPitch">Destination pitch</param>
Copy data from device to host memory
Copy data from device to host memory
public void CopyToHost(IntPtr hostDest, SizeT DestXInBytes, SizeT DestY, SizeT SrcXInBytes, SizeT SrcY, SizeT widthInBytes, SizeT height, SizeT DestPitch, SizeT SrcPitch)
		{
			if (disposed) throw new ObjectDisposedException(this.ToString());
			CUDAMemCpy2D copyParams = new CUDAMemCpy2D();
			copyParams.dstHost = hostDest;
			copyParams.dstMemoryType = CUMemoryType.Host;
			copyParams.dstPitch = DestPitch;
			copyParams.dstXInBytes = DestXInBytes;
			copyParams.dstY = DestY;
			copyParams.srcDevice = _devPtr;
			copyParams.srcMemoryType = CUMemoryType.Device;
			copyParams.srcPitch = SrcPitch;
			copyParams.srcXInBytes = SrcXInBytes;
			copyParams.srcY = SrcY;
			copyParams.Height = height;
			copyParams.WidthInBytes = widthInBytes;
			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 DestXInBytes , SizeT DestY , SizeT SrcXInBytes , SizeT SrcY , SizeT widthInBytes , SizeT height , SizeT DestPitch , SizeT SrcPitch ) { if ( disposed ) throw new ObjectDisposedException ( this . ToString ( ) ) ; CUDAMemCpy2D copyParams = new CUDAMemCpy2D ( ) ; copyParams . dstHost = hostDest ; copyParams . dstMemoryType = CUMemoryType . Host ; copyParams . dstPitch = DestPitch ; copyParams . dstXInBytes = DestXInBytes ; copyParams . dstY = DestY ; copyParams . srcDevice = _devPtr ; copyParams . srcMemoryType = CUMemoryType . Device ; copyParams . srcPitch = SrcPitch ; copyParams . srcXInBytes = SrcXInBytes ; copyParams . srcY = SrcY ; copyParams . Height = height ; copyParams . WidthInBytes = widthInBytes ; 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
None
DestXInBytes
SizeT
Destination X in bytes
Destination X in bytes
DestY
SizeT
None
SrcXInBytes
SizeT
Source X in bytes
Source X in bytes
SrcY
SizeT
None
widthInBytes
SizeT
Width in bytes
Width in bytes
height
SizeT
Height in elements
Height in elements
DestPitch
SizeT
None
SrcPitch
SizeT
None