Library/ManagedCuda/CudaDeviceVariable.cs
/// <summary>
/// Copy from device to device memory
/// </summary>
/// <param name="deviceSrc">Source</param>
/// <param name="offsetSrc">Offset to source pointer in bytes</param>
/// <param name="offsetDest">Offset to destination pointer in bytes</param>
/// <param name="widthInBytes">Width of 2D memory to copy in bytes</param>
/// <param name="height">Height in elements</param>
Copy from device to device memory
Copy from device to device memory
public void CopyToDevice(CudaPitchedDeviceVariable<T> deviceSrc, SizeT offsetSrc, SizeT offsetDest, SizeT widthInBytes, SizeT height)
		{
			if (disposed) throw new ObjectDisposedException(this.ToString());
			CUDAMemCpy2D copyParams = new CUDAMemCpy2D();
			copyParams.srcDevice = deviceSrc.DevicePointer + offsetSrc;
			copyParams.srcMemoryType = CUMemoryType.Device;
			copyParams.srcPitch = deviceSrc.Pitch;
			copyParams.dstDevice = _devPtr + offsetDest;
			copyParams.dstMemoryType = CUMemoryType.Device;
			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 ( CudaPitchedDeviceVariable < T > deviceSrc , SizeT offsetSrc , SizeT offsetDest , SizeT widthInBytes , SizeT height ) { if ( disposed ) throw new ObjectDisposedException ( this . ToString ( ) ) ; CUDAMemCpy2D copyParams = new CUDAMemCpy2D ( ) ; copyParams . srcDevice = deviceSrc . DevicePointer + offsetSrc ; copyParams . srcMemoryType = CUMemoryType . Device ; copyParams . srcPitch = deviceSrc . Pitch ; copyParams . dstDevice = _devPtr + offsetDest ; copyParams . dstMemoryType = CUMemoryType . Device ; 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 device to device memory
Copy from device to device memory
deviceSrc
CudaPitchedDeviceVariable<T>
None
offsetSrc
SizeT
Offset to source pointer in bytes
Offset to source pointer in bytes
offsetDest
SizeT
Offset to destination pointer in bytes
Offset to destination pointer in bytes
widthInBytes
SizeT
Width of 2D memory to copy in bytes
Width of 2D memory to copy in bytes
height
SizeT
Height in elements
Height in elements