Library/ManagedCuda/CudaPitchedDeviceVariable.cs
/// <summary>
/// Copy from Host to device memory
/// </summary>
/// <param name="hostSrc">Source</param>
/// <param name="width">Width in bytes</param>
/// <param name="height">Height in elements</param>
Copy from Host to device memory
Copy from Host to device memory
public void CopyToDevice(IntPtr hostSrc, SizeT width, SizeT height)
		{
			if (disposed) throw new ObjectDisposedException(this.ToString());
			CUDAMemCpy2D copyParams = new CUDAMemCpy2D();
			copyParams.srcHost = hostSrc;
			copyParams.srcMemoryType = CUMemoryType.Host;
			copyParams.dstDevice = _devPtr;
			copyParams.dstMemoryType = CUMemoryType.Device;
			copyParams.dstPitch = _pitch;
			copyParams.Height = height;
			copyParams.WidthInBytes = width;
			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 width , SizeT height ) { if ( disposed ) throw new ObjectDisposedException ( this . ToString ( ) ) ; CUDAMemCpy2D copyParams = new CUDAMemCpy2D ( ) ; copyParams . srcHost = hostSrc ; copyParams . srcMemoryType = CUMemoryType . Host ; copyParams . dstDevice = _devPtr ; copyParams . dstMemoryType = CUMemoryType . Device ; copyParams . dstPitch = _pitch ; copyParams . Height = height ; copyParams . WidthInBytes = width ; 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
width
SizeT
Width in bytes
Width in bytes
height
SizeT
Height in elements
Height in elements