Library/ManagedCuda/CudaBlas/CudaBlasHandler.cs
/// <summary>
/// copies elements from a vector <c>hostSourceVector</c> in CPU memory space to a vector <c>devDestVector</c> 
/// in GPU memory space. Storage spacing between consecutive elements
/// is <c>incrHostSource</c> for the source vector <c>hostSourceVector</c> and <c>incrDevDest</c> for the destination vector
/// <c>devDestVector</c>. Column major format for two-dimensional matrices
/// is assumed throughout CUBLAS. Therefore, if the increment for a vector 
/// is equal to 1, this access a column vector while using an increment 
/// equal to the leading dimension of the respective matrix accesses a 
/// row vector.
/// </summary>
/// <typeparam name="T">Vector datatype </typeparam>
/// <param name="hostSourceVector">Source vector in host memory</param>
/// <param name="incrHostSource"></param>
/// <param name="devDestVector">Destination vector in device memory</param>
/// <param name="incrDevDest"></param>
/// <param name="stream"></param>
copies elements from a vector hostSourceVectordevDestVectorincrHostSourcehostSourceVectorincrDevDestdevDestVector
copies elements from a vector hostSourceVectordevDestVectorincrHostSourcehostSourceVectorincrDevDestdevDestVector
public static void SetVectorAsync<T>(T[] hostSourceVector, int incrHostSource, CudaDeviceVariable<T> devDestVector, int incrDevDest, CUstream stream) where T : struct
		{
			CublasStatus status;
			GCHandle handle = GCHandle.Alloc(hostSourceVector, GCHandleType.Pinned);
			status = CudaBlasNativeMethods.cublasSetVectorAsync(hostSourceVector.Length, devDestVector.TypeSize, handle.AddrOfPinnedObject(), incrHostSource, devDestVector.DevicePointer, incrDevDest, stream);
			handle.Free();
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cublasSetVectorAsync", status));
			if (status != CublasStatus.Success) throw new CudaBlasException(status);
		}
public static void SetVectorAsync < T > ( T [ ] hostSourceVector , int incrHostSource , CudaDeviceVariable < T > devDestVector , int incrDevDest , CUstream stream ) where T : struct { CublasStatus status ; GCHandle handle = GCHandle . Alloc ( hostSourceVector , GCHandleType . Pinned ) ; status = CudaBlasNativeMethods . cublasSetVectorAsync ( hostSourceVector . Length , devDestVector . TypeSize , handle . AddrOfPinnedObject ( ) , incrHostSource , devDestVector . DevicePointer , incrDevDest , stream ) ; handle . Free ( ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , status ) ) ; if ( status != CublasStatus . Success ) throw new CudaBlasException ( status ) ; }
copies elements from a vector hostSourceVectordevDestVectorincrHostSourcehostSourceVectorincrDevDestdevDestVector
copies elements from a vector hostSourceVectordevDestVectorincrHostSourcehostSourceVectorincrDevDestdevDestVector
hostSourceVector
T[]
Source vector in host memory
Source vector in host memory
incrHostSource
int
None
devDestVector
CudaDeviceVariable<T>
Destination vector in device memory
Destination vector in device memory
incrDevDest
int
None
stream
CUstream
None
typeparam
None