Library/ManagedCuda/CudaBlas/CudaBlasHandler.cs
/// <summary>
/// This function performs the matrix-matrix multiplication of a batch of matrices. The batch is considered to be "uniform", 
/// i.e. all instances have the same dimensions (m, n, k), leading dimensions (lda, ldb, ldc) and transpositions (transa, transb) 
/// for their respective A, B and C matrices. Input matrices A, B and output matrix C for each instance of the batch are located 
/// at fixed address offsets from their locations in the previous instance. Pointers to A, B and C matrices for the first 
/// instance are passed to the function by the user along with the address offsets - strideA, strideB and strideC that determine 
/// the locations of input and output matrices in future instances. 
/// </summary>
/// <param name="transa">operation op(A[i]) that is non- or (conj.) transpose. </param>
/// <param name="transb">operation op(B[i]) that is non- or (conj.) transpose. </param>
/// <param name="m">number of rows of matrix op(A[i]) and C[i]. </param>
/// <param name="n">number of columns of op(B[i]) and C[i]. </param>
/// <param name="k">number of columns of op(A[i]) and rows of op(B[i]).</param>
/// <param name="alpha">scalar used for multiplication.</param>
/// <param name="A">pointer to the A matrix corresponding to the first instance of the batch, with dimensions lda x k with lda>=max(1,m) if transa==CUBLAS_OP_N and lda x m with lda>=max(1,k) otherwise. </param>
/// <param name="lda">leading dimension of two-dimensional array used to store each matrix A[i]. </param>
/// <param name="strideA">Value of type long long int that gives the address offset between A[i] and A[i+1]</param>
/// <param name="B">pointer to the B matrix corresponding to the first instance of the batch, with dimensions ldb x n with ldb>=max(1,k) if transa==CUBLAS_OP_N and ldb x k with ldb>=max(1,n) max(1,) otherwise. </param>
/// <param name="ldb">leading dimension of two-dimensional array used to store each matrix B[i]. </param>
/// <param name="strideB">Value of type long long int that gives the address offset between B[i] and B[i+1]</param>
/// <param name="beta"> scalar used for multiplication. If beta == 0, C does not have to be a valid input.</param>
/// <param name="C">pointer to the C matrix corresponding to the first instance of the batch, with dimensions ldc x n with ldc>=max(1,m). </param>
/// <param name="ldc">leading dimension of two-dimensional array used to store each matrix C[i]. </param>
/// <param name="strideC">Value of type long long int that gives the address offset between C[i] and C[i+1]</param>
/// <param name="batchCount">number of GEMMs to perform in the batch.</param>
This function performs the matrix-matrix multiplication of a batch of matrices. The batch is considered to be "uniform",
i.e. all instances have the same dimensions (m, n, k), leading dimensions (lda, ldb, ldc) and transpositions (transa, transb)
for their respective A, B and C matrices. Input matrices A, B and output matrix C for each instance of the batch are located
at fixed address offsets from their locations in the previous instance. Pointers to A, B and C matrices for the first
instance are passed to the function by the user along with the address offsets - strideA, strideB and strideC that determine
the locations of input and output matrices in future instances.
This function performs the matrix - matrix multiplication of a batch of matrices . The batch is considered to be " uniform " i . e . all instances have the same dimensions ( m n k ) leading dimensions ( lda ldb ldc ) and transpositions ( transa transb ) for their respective A B and C matrices . Input matrices A B and output matrix C for each instance of the batch are located at fixed address offsets from their locations in the previous instance . Pointers to A B and C matrices for the first instance are passed to the function by the user along with the address offsets - strideA strideB and strideC that determine the locations of input and output matrices in future instances .
public void GemmStridedBatched(Operation transa, Operation transb, int m, int n, int k, cuFloatComplex alpha,
            CudaDeviceVariable<cuFloatComplex> A, int lda, long strideA, CudaDeviceVariable<cuFloatComplex> B, int ldb, long strideB,
            cuFloatComplex beta, CudaDeviceVariable<cuFloatComplex> C, int ldc, long strideC, int batchCount)
        {
            _status = CudaBlasNativeMethods.cublasCgemmStridedBatched(_blasHandle, transa, transb, m, n, k, ref alpha, A.DevicePointer, lda, strideA,
                B.DevicePointer, ldb, strideB, ref beta, C.DevicePointer, ldc, strideC, batchCount);
            Debug.WriteLine(String.Format("{0:G}, {1}: {2}", DateTime.Now, "cublasSgemmCtridedBatched", _status));
            if (_status != CublasStatus.Success) throw new CudaBlasException(_status);
        }
public void GemmStridedBatched ( Operation transa , Operation transb , int m , int n , int k , cuFloatComplex alpha , CudaDeviceVariable < cuFloatComplex > A , int lda , long strideA , CudaDeviceVariable < cuFloatComplex > B , int ldb , long strideB , cuFloatComplex beta , CudaDeviceVariable < cuFloatComplex > C , int ldc , long strideC , int batchCount ) { _status = CudaBlasNativeMethods . cublasCgemmStridedBatched ( _blasHandle , transa , transb , m , n , k , ref alpha , A . DevicePointer , lda , strideA , B . DevicePointer , ldb , strideB , ref beta , C . DevicePointer , ldc , strideC , batchCount ) ; Debug . WriteLine ( String . Format ( " " , DateTime . Now , " " , _status ) ) ; if ( _status != CublasStatus . Success ) throw new CudaBlasException ( _status ) ; }
This function performs the matrix-matrix multiplication of a batch of matrices.
This function performs the matrix - matrix multiplication of a batch of matrices .
transa
Operation
operation op(A[i]) that is non- or (conj.) transpose.
operation op ( A [ i ] ) that is non - or ( conj . ) transpose .
transb
Operation
operation op(B[i]) that is non- or (conj.) transpose.
operation op ( B [ i ] ) that is non - or ( conj . ) transpose .
m
int
number of rows of matrix op(A[i]) and C[i].
number of rows of matrix op ( A [ i ] ) and C [ i ] .
n
int
number of columns of op(B[i]) and C[i].
number of columns of op ( B [ i ] ) and C [ i ] .
k
int
number of columns of op(A[i]) and rows of op(B[i]).
number of columns of op ( A [ i ] ) and rows of op ( B [ i ] ) .
alpha
cuFloatComplex
scalar used for multiplication.
scalar used for multiplication .
A
CudaDeviceVariable<cuFloatComplex>
pointer to the A matrix corresponding to the first instance of the batch, with dimensions lda x k with lda>=max(1,m) if transa==CUBLAS_OP_N and lda x m with lda>=max(1,k) otherwise.
pointer to the A matrix corresponding to the first instance of the batch with dimensions lda x k with lda > = max ( 1 m ) if transa == CUBLAS_OP_N and lda x m with lda > = max ( 1 k ) otherwise .
lda
int
leading dimension of two-dimensional array used to store each matrix A[i].
leading dimension of two - dimensional array used to store each matrix A [ i ] .
strideA
long
Value of type long long int that gives the address offset between A[i] and A[i+1]
Value of type long long int that gives the address offset between A [ i ] and A [ i + 1 ]
B
CudaDeviceVariable<cuFloatComplex>
pointer to the B matrix corresponding to the first instance of the batch, with dimensions ldb x n with ldb>=max(1,k) if transa==CUBLAS_OP_N and ldb x k with ldb>=max(1,n) max(1,) otherwise.
pointer to the B matrix corresponding to the first instance of the batch with dimensions ldb x n with ldb > = max ( 1 k ) if transa == CUBLAS_OP_N and ldb x k with ldb > = max ( 1 n ) max ( 1 ) otherwise .
ldb
int
leading dimension of two-dimensional array used to store each matrix B[i].
leading dimension of two - dimensional array used to store each matrix B [ i ] .
strideB
long
Value of type long long int that gives the address offset between B[i] and B[i+1]
Value of type long long int that gives the address offset between B [ i ] and B [ i + 1 ]
beta
cuFloatComplex
scalar used for multiplication. If beta == 0, C does not have to be a valid input.
scalar used for multiplication . If beta == 0 C does not have to be a valid input .
C
CudaDeviceVariable<cuFloatComplex>
pointer to the C matrix corresponding to the first instance of the batch, with dimensions ldc x n with ldc>=max(1,m).
pointer to the C matrix corresponding to the first instance of the batch with dimensions ldc x n with ldc > = max ( 1 m ) .
ldc
int
leading dimension of two-dimensional array used to store each matrix C[i].
leading dimension of two - dimensional array used to store each matrix C [ i ] .
strideC
long
Value of type long long int that gives the address offset between C[i] and C[i+1]
Value of type long long int that gives the address offset between C [ i ] and C [ i + 1 ]
batchCount
int
number of GEMMs to perform in the batch.
number of GEMMs to perform in the batch .