Library/ManagedCuda/CudaBlas/CudaBlasHandler.cs
/// <summary>
/// copies elements from a vector <c>devSourceVector</c> in GPU memory space to a vector <c>hostDestVector</c> 
/// in CPU memory space. Storage spacing between consecutive elements
/// is <c>incrHostDest</c> for the source vector <c>devSourceVector</c> and <c>incrDevSource</c> for the destination vector
/// <c>hostDestVector</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="devSourceVector">Source vector in device memory</param>
/// <param name="incrDevSource"></param>
/// <param name="hostDestVector">Destination vector in host memory</param>
/// <param name="incrHostDest"></param>
copies elements from a vector devSourceVectorhostDestVectorincrHostDestdevSourceVectorincrDevSourcehostDestVector
copies elements from a vector devSourceVectorhostDestVectorincrHostDestdevSourceVectorincrDevSourcehostDestVector
public static void GetVector<T>(CudaDeviceVariable<T> devSourceVector, int incrDevSource, T[] hostDestVector, int incrHostDest) where T : struct
		{
			CublasStatus status;
			GCHandle handle = GCHandle.Alloc(hostDestVector, GCHandleType.Pinned);
			status = CudaBlasNativeMethods.cublasGetVector(hostDestVector.Length, devSourceVector.TypeSize, devSourceVector.DevicePointer, incrDevSource, handle.AddrOfPinnedObject(), incrHostDest);
			handle.Free();
			Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cublasGetVector", status));
			if (status != CublasStatus.Success) throw new CudaBlasException(status);
		}
public static void GetVector < T > ( CudaDeviceVariable < T > devSourceVector , int incrDevSource , T [ ] hostDestVector , int incrHostDest ) where T : struct { CublasStatus status ; GCHandle handle = GCHandle . Alloc ( hostDestVector , GCHandleType . Pinned ) ; status = CudaBlasNativeMethods . cublasGetVector ( hostDestVector . Length , devSourceVector . TypeSize , devSourceVector . DevicePointer , incrDevSource , handle . AddrOfPinnedObject ( ) , incrHostDest ) ; handle . Free ( ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , status ) ) ; if ( status != CublasStatus . Success ) throw new CudaBlasException ( status ) ; }
copies elements from a vector devSourceVectorhostDestVectorincrHostDestdevSourceVectorincrDevSourcehostDestVector
copies elements from a vector devSourceVectorhostDestVectorincrHostDestdevSourceVectorincrDevSourcehostDestVector
devSourceVector
CudaDeviceVariable<T>
Source vector in device memory
Source vector in device memory
incrDevSource
int
None
hostDestVector
T[]
Destination vector in host memory
Destination vector in host memory
incrHostDest
int
None
typeparam
None