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