Library/ManagedCuda/CudaDeviceVariable.cs
/// <summary>
/// Copy data from this device to host memory. Array elements can be of any (value)type, but total size in bytes must match to allocated device memory.
/// </summary>
/// <param name="hostDest">Destination</param>
Copy data from this device to host memory. Array elements can be of any (value)type, but total size in bytes must match to allocated device memory.
Copy data from this device to host memory . Array elements can be of any ( value ) type but total size in bytes must match to allocated device memory .
public void CopyToHost(Array hostDest)
		{
			if (disposed) throw new ObjectDisposedException(this.ToString());
			SizeT aSizeInBytes = _size * _typeSize;
			GCHandle handle = GCHandle.Alloc(hostDest, GCHandleType.Pinned);
			try
			{
				IntPtr ptr = handle.AddrOfPinnedObject();
				res = DriverAPINativeMethods.SynchronousMemcpy_v2.cuMemcpyDtoH_v2(ptr, _devPtr, aSizeInBytes);
				Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cuMemcpyDtoH", res));
			}
			finally
			{
				handle.Free();
			}
			if (res != CUResult.Success)
				throw new CudaException(res);
		}
public void CopyToHost ( Array hostDest ) { if ( disposed ) throw new ObjectDisposedException ( this . ToString ( ) ) ; SizeT aSizeInBytes = _size * _typeSize ; GCHandle handle = GCHandle . Alloc ( hostDest , GCHandleType . Pinned ) ; try { IntPtr ptr = handle . AddrOfPinnedObject ( ) ; res = DriverAPINativeMethods . SynchronousMemcpy_v2 . cuMemcpyDtoH_v2 ( ptr , _devPtr , aSizeInBytes ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , res ) ) ; } finally { handle . Free ( ) ; } if ( res != CUResult . Success ) throw new CudaException ( res ) ; }
Copy data from this device to host memory.
Copy data from this device to host memory .
hostDest
Array
None