Skip to main content

muBLAS API Reference

Functions

function mublasIsamax

mublasStatus mublasIsamax(
mublasHandle_t handle,
mublas_int n,
const float * x,
mublas_int incx,
mublas_int * result
)

function mublasIdamax

mublasStatus mublasIdamax(
mublasHandle_t handle,
mublas_int n,
const double * x,
mublas_int incx,
mublas_int * result
)

function mublasIzamax

mublasStatus mublasIzamax(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * x,
mublas_int incx,
mublas_int * result
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of y.
  • result device pointer or host pointer to store the amax index. return is 0.0 if n, incx <= 0.

amax finds the first index of the element of maximum magnitude of a vector x. vector

function mublasIcamax

mublasStatus mublasIcamax(
mublasHandle_t handle,
mublas_int n,
const muComplex * x,
mublas_int incx,
mublas_int * result
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] number of elements in each vector x_i
  • x device array of device pointers storing each vector x_i.
  • incx [mublas_int] specifies the increment for the elements of each x_i. incx must be > 0.
  • batch_count [mublas_int] number of instances in the batch, must be > 0.
  • result device or host array of pointers of batch_count size for results. return is 0 if n, incx<=0.

amax_batched finds the first index of the element of maximum magnitude of each vector x_i in a batch, for i = 1, ..., batch_count.

function mublasIsamin

mublasStatus mublasIsamin(
mublasHandle_t handle,
mublas_int n,
const float * x,
mublas_int incx,
mublas_int * result
)

function mublasIdamin

mublasStatus mublasIdamin(
mublasHandle_t handle,
mublas_int n,
const double * x,
mublas_int incx,
mublas_int * result
)

function mublasIzamin

mublasStatus mublasIzamin(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * x,
mublas_int incx,
mublas_int * result
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of y.
  • result device pointer or host pointer to store the amin index. return is 0.0 if n, incx<=0.

amin finds the first index of the element of minimum magnitude of a vector x.

vector

function mublasIcamin

mublasStatus mublasIcamin(
mublasHandle_t handle,
mublas_int n,
const muComplex * x,
mublas_int incx,
mublas_int * result
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] number of elements in each vector x_i
  • x device array of device pointers storing each vector x_i.
  • incx [mublas_int] specifies the increment for the elements of each x_i. incx must be > 0.
  • batch_count [mublas_int] number of instances in the batch, must be > 0.
  • result device or host pointers to array of batch_count size for results. return is 0 if n, incx<=0.

amin_batched finds the first index of the element of minimum magnitude of each vector x_i in a batch, for i = 1, ..., batch_count.

function mublasSasum

mublasStatus mublasSasum(
mublasHandle_t handle,
mublas_int n,
const float * x,
mublas_int incx,
float * result
)

function mublasDasum

mublasStatus mublasDasum(
mublasHandle_t handle,
mublas_int n,
const double * x,
mublas_int incx,
double * result
)

function mublasDzasum

mublasStatus mublasDzasum(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * x,
mublas_int incx,
double * result
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x and y.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x. incx must be > 0.
  • result device pointer or host pointer to store the asum product. return is 0.0 if n <= 0.

asum computes the sum of the magnitudes of elements of a real vector x, or the sum of magnitudes of the real and imaginary parts of elements if x is a complex vector

function mublasScasum

mublasStatus mublasScasum(
mublasHandle_t handle,
mublas_int n,
const muComplex * x,
mublas_int incx,
float * result
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x and y.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x. incx must be > 0.
  • result device pointer or host pointer to store the asum product. return is 0.0 if n <= 0.

asum computes the sum of the magnitudes of elements of a real vector x, or the sum of magnitudes of the real and imaginary parts of elements if x is a complex vector

function mublasSaxpy

mublasStatus mublasSaxpy(
mublasHandle_t handle,
mublas_int n,
const float * alpha,
const float * x,
mublas_int incx,
float * y,
mublas_int incy
)

function mublasDaxpy

mublasStatus mublasDaxpy(
mublasHandle_t handle,
mublas_int n,
const double * alpha,
const double * x,
mublas_int incx,
double * y,
mublas_int incy
)

function mublasZaxpy

mublasStatus mublasZaxpy(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * x,
mublas_int incx,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x and y.
  • alpha device pointer or host pointer to specify the scalar alpha.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x.
  • y device pointer storing vector y.
  • incy [mublas_int] specifies the increment for the elements of y.

axpy computes constant alpha multiplied by vector x, plus vector y

y:=αx+y\mathbf{y} := \alpha \cdot \mathbf{x} + \mathbf{y}

function mublasCaxpy

mublasStatus mublasCaxpy(
mublasHandle_t handle,
mublas_int n,
const muComplex * alpha,
const muComplex * x,
mublas_int incx,
muComplex * y,
mublas_int incy
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x and y.
  • alpha device pointer or host pointer to specify the scalar alpha.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x.
  • y device pointer storing vector y.
  • incy [mublas_int] specifies the increment for the elements of y.

axpy computes constant alpha multiplied by vector x, plus vector y

y:=αx+y\mathbf{y} := \alpha \cdot \mathbf{x} + \mathbf{y}

function mublasCcopy

mublasStatus mublasCcopy(
mublasHandle_t handle,
mublas_int n,
const muComplex * x,
mublas_int incx,
muComplex * y,
mublas_int incy
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x to be copied to y.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x.
  • y device pointer storing vector y.
  • incy [mublas_int] specifies the increment for the elements of y.

copy copies each element x[i]x[i] into y[i]y[i], for i=1,,ni = 1, \dots, n.

y:=x\mathbf{y} := \mathbf{x}

function mublasScopy

mublasStatus mublasScopy(
mublasHandle_t handle,
mublas_int n,
const float * x,
mublas_int incx,
float * y,
mublas_int incy
)

function mublasDcopy

mublasStatus mublasDcopy(
mublasHandle_t handle,
mublas_int n,
const double * x,
mublas_int incx,
double * y,
mublas_int incy
)

function mublasZcopy

mublasStatus mublasZcopy(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * x,
mublas_int incx,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x to be copied to y.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x.
  • y device pointer storing vector y.
  • incy [mublas_int] specifies the increment for the elements of y.

copy copies each element x[i] into y[i], for i = 1 , ... , n

y:=x\mathbf{y} := \mathbf{x}

function mublasSdot

mublasStatus mublasSdot(
mublasHandle_t handle,
mublas_int n,
const float * x,
mublas_int incx,
const float * y,
mublas_int incy,
float * result
)

function mublasZdotc

mublasStatus mublasZdotc(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * y,
mublas_int incy,
muDoubleComplex * result
)

function mublasDdot

mublasStatus mublasDdot(
mublasHandle_t handle,
mublas_int n,
const double * x,
mublas_int incx,
const double * y,
mublas_int incy,
double * result
)

function mublasZdotu

mublasStatus mublasZdotu(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * y,
mublas_int incy,
muDoubleComplex * result
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x and y.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x.
  • y device pointer storing vector y.
  • incy [mublas_int] specifies the increment for the elements of y.
  • result device pointer or host pointer to store the dot product. Return is 0.0 if n0n \leq 0.

dot(u) performs the dot product of vectors x and y:

result=xy\text{result} = \mathbf{x} \cdot \mathbf{y}

dotc performs the dot product of the conjugate of complex vector x and complex vector y:

result=xy\text{result} = \overline{\mathbf{x}} \cdot \mathbf{y}

function mublasCdotu

mublasStatus mublasCdotu(
mublasHandle_t handle,
mublas_int n,
const muComplex * x,
mublas_int incx,
const muComplex * y,
mublas_int incy,
muComplex * result
)

BLAS Level 1 API.

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x and y.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x.
  • y device pointer storing vector y.
  • incy [mublas_int] specifies the increment for the elements of y.
  • result device pointer or host pointer to store the dot product. Return is 0.0 if n0n \leq 0.

dot(u) performs the dot product of vectors x and y:

result=xy\text{result} = \mathbf{x} \cdot \mathbf{y}

dotc performs the dot product of the conjugate of complex vector x and complex vector y:

result=xy\text{result} = \overline{\mathbf{x}} \cdot \mathbf{y}

function mublasCgbmv

mublasStatus mublasCgbmv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
mublas_int kl,
mublas_int ku,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * x,
mublas_int incx,
const muComplex * beta,
muComplex * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • trans: [mublasOperation_t] Indicates whether matrix AA is transposed (conjugated) or not.
  • m: [mublas_int] Number of rows of matrix AA.
  • n: [mublas_int] Number of columns of matrix AA.
  • kl: [mublas_int] Number of sub-diagonals of AA.
  • ku: [mublas_int] Number of super-diagonals of AA.
  • alpha: Device pointer or host pointer to scalar α\alpha.
  • A: Device pointer storing banded matrix AA. The matrix contains coefficients in a leading (kl+ku+1)(kl + ku + 1) by nn part. The leading diagonal resides in row (ku+1)(ku + 1), the first super-diagonal on the RHS of row kuku, and the first sub-diagonal on the LHS of row ku+2ku + 2. The structure propagates up and down across sub/super-diagonals.
  • lda: [mublas_int] Leading dimension of AA. Must be (kl+ku+1)\geq (kl + ku + 1).
  • x: Device pointer storing vector x\mathbf{x}.
  • incx: [mublas_int] Specifies the increment for the elements of x\mathbf{x}.
  • beta: Device pointer or host pointer to scalar β\beta.
  • y: Device pointer storing vector y\mathbf{y}.
  • incy: [mublas_int] Specifies the increment for the elements of y\mathbf{y}.

The gbmv function performs one of the following matrix-vector operations:

y:=αAx+βy,ory:=αATx+βy,ory:=αAHx+βy,\mathbf{y} := \alpha \cdot A \cdot \mathbf{x} + \beta \cdot \mathbf{y}, \quad \text{or} \quad \mathbf{y} := \alpha \cdot A^T \cdot \mathbf{x} + \beta \cdot \mathbf{y}, \quad \text{or} \quad \mathbf{y} := \alpha \cdot A^H \cdot \mathbf{x} + \beta \cdot \mathbf{y},

Where:

  • α\alpha and β\beta are scalars.
  • x\mathbf{x} and y\mathbf{y} are vectors.
  • AA is an m×nm \times n banded matrix with klk_l sub-diagonals and kuk_u super-diagonals.

Example

For example, when m=n=7m = n = 7, ku=2ku = 2, and kl=2kl = 2:

Matrix AA:

[1230000033333412300002222225412300054123000005412]\begin{bmatrix} 1 & 2 & 3 & 0 & 0 & 0 & 0 \\ 0 & 3 & 3 & 3 & 3 & 3 & 4 \\ 1 & 2 & 3 & 0 & 0 & 0 & 0 \\ 2 & 2 & 2 & 2 & 2 & 2 & 5 \\ 4 & 1 & 2 & 3 & 0 & 0 & 0 \\ 5 & 4 & 1 & 2 & 3 & 0 & 0 \\ 0 & 0 & 0 & 5 & 4 & 1 & 2 \end{bmatrix}

The matrix will be stored in a compressed format, considering the sub- and super-diagonals. Empty elements, which do not correspond to data, will not be referenced.

function mublasSgbmv

mublasStatus mublasSgbmv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
mublas_int kl,
mublas_int ku,
const float * alpha,
const float * A,
mublas_int lda,
const float * x,
mublas_int incx,
const float * beta,
float * y,
mublas_int incy
)

function mublasDgbmv

mublasStatus mublasDgbmv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
mublas_int kl,
mublas_int ku,
const double * alpha,
const double * A,
mublas_int lda,
const double * x,
mublas_int incx,
const double * beta,
double * y,
mublas_int incy
)

function mublasZgbmv

mublasStatus mublasZgbmv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
mublas_int kl,
mublas_int ku,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * beta,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • trans: [mublasOperation_t] Indicates whether matrix AA is transposed (conjugated) or not.
  • m: [mublas_int] Number of rows of matrix AA.
  • n: [mublas_int] Number of columns of matrix AA.
  • kl: [mublas_int] Number of sub-diagonals of AA.
  • ku: [mublas_int] Number of super-diagonals of AA.
  • alpha: Device pointer or host pointer to scalar α\alpha.
  • A: Device pointer storing banded matrix AA. The matrix contains coefficients in a leading (kl+ku+1)×n(kl + ku + 1) \times n part. The leading diagonal resides in row (ku+1)(ku + 1), the first super-diagonal on the RHS of row kuku, and the first sub-diagonal on the LHS of row ku+2ku + 2. The structure propagates up and down across sub/super-diagonals.
  • lda: [mublas_int] Leading dimension of AA. Must be (kl+ku+1)\geq (kl + ku + 1).
  • x: Device pointer storing vector x\mathbf{x}.
  • incx: [mublas_int] Specifies the increment for the elements of x\mathbf{x}.
  • beta: Device pointer or host pointer to scalar β\beta.
  • y: Device pointer storing vector y\mathbf{y}.
  • incy: [mublas_int] Specifies the increment for the elements of y\mathbf{y}.

Operation

The gbmv function performs one of the following matrix-vector operations:

y:=αAx+βy,ory:=αATx+βy,ory:=αAHx+βy,\mathbf{y} := \alpha \cdot A \cdot \mathbf{x} + \beta \cdot \mathbf{y}, \quad \text{or} \quad \mathbf{y} := \alpha \cdot A^T \cdot \mathbf{x} + \beta \cdot \mathbf{y}, \quad \text{or} \quad \mathbf{y} := \alpha \cdot A^H \cdot \mathbf{x} + \beta \cdot \mathbf{y},

Where:

  • α\alpha and β\beta are scalars.
  • x\mathbf{x} and y\mathbf{y} are vectors.
  • AA is an m×nm \times n banded matrix with klk_l sub-diagonals and kuk_u super-diagonals.

function mublasCgemm

mublasStatus mublasCgemm(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const muComplex* alpha,
const muComplex* A,
mublas_int lda,
const muComplex* B,
mublas_int ldb,
const muComplex* beta,
muComplex* C,
mublas_int ldc
)

function mublasSgemm

mublasStatus mublasSgemm(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const float* alpha,
const float* A,
mublas_int lda,
const float* B,
mublas_int ldb,
const float* beta,
float* C,
mublas_int ldc
)

function mublasZgemm

mublasStatus mublasZgemm(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const muDoubleComplex* alpha,
const muDoubleComplex* A,
mublas_int lda,
const muDoubleComplex* B,
mublas_int ldb,
const muDoubleComplex* beta,
muDoubleComplex* C,
mublas_int ldc
)

function mublasDgemm

mublasStatus mublasDgemm(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const double* alpha,
const double* A,
mublas_int lda,
const double* B,
mublas_int ldb,
const double* beta,
double* C,
mublas_int ldc
)

BLAS Level 3 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • transA: [mublasOperation_t] Specifies the form of op(A)\text{op}( A ).
  • transB: [mublasOperation_t] Specifies the form of op(B)\text{op}( B ).
  • m: [mublas_int] Number of rows of matrices op(A)\text{op}( A ) and CC.
  • n: [mublas_int] Number of columns of matrices op(B)\text{op}( B ) and CC.
  • k: [mublas_int] Number of columns of matrix op(A)\text{op}( A ) and number of rows of matrix op(B)\text{op}( B ).
  • alpha: Device pointer or host pointer specifying the scalar α\alpha.
  • A: Device pointer storing matrix AA.
  • lda: [mublas_int] Specifies the leading dimension of AA.
  • B: Device pointer storing matrix BB.
  • ldb: [mublas_int] Specifies the leading dimension of BB.
  • beta: Device pointer or host pointer specifying the scalar β\beta.
  • C: Device pointer storing matrix CC on the GPU.
  • ldc: [mublas_int] Specifies the leading dimension of CC.

Operation

The gemm function performs one of the following matrix-matrix operations:

C=αop(A)op(B)+βC,C = \alpha \cdot \text{op}( A ) \cdot \text{op}( B ) + \beta \cdot C,

Where op(X)\text{op}( X ) is one of:

op(X)=Xorop(X)=XTorop(X)=XH,\text{op}( X ) = X \quad \text{or} \quad \text{op}( X ) = X^T \quad \text{or} \quad \text{op}( X ) = X^H,

Where:

  • α\alpha and β\beta are scalars.
  • AA, BB, and CC are matrices, with op(A)\text{op}( A ) being an m×km \times k matrix, op(B)\text{op}( B ) being a k×nk \times n matrix, and CC being an m×nm \times n matrix.

function mublasCgemmBatched

mublasStatus mublasCgemmBatched(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex *const A[],
mublas_int lda,
const muComplex *const B[],
mublas_int ldb,
const muComplex * beta,
muComplex *const C[],
mublas_int ldc,
mublas_int batch_count
)

function mublasSgemmBatched

mublasStatus mublasSgemmBatched(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const float * alpha,
const float *const A[],
mublas_int lda,
const float *const B[],
mublas_int ldb,
const float * beta,
float *const C[],
mublas_int ldc,
mublas_int batch_count
)

function mublasZgemmBatched

mublasStatus mublasZgemmBatched(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const muDoubleComplex * alpha,
const muDoubleComplex *const A[],
mublas_int lda,
const muDoubleComplex *const B[],
mublas_int ldb,
const muDoubleComplex * beta,
muDoubleComplex *const C[],
mublas_int ldc,
mublas_int batch_count
)

function mublasDgemmBatched

mublasStatus mublasDgemmBatched(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const double * alpha,
const double *const A[],
mublas_int lda,
const double *const B[],
mublas_int ldb,
const double * beta,
double *const C[],
mublas_int ldc,
mublas_int batch_count
)

BLAS Level 3 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • transA: [mublasOperation_t] Specifies the form of op(A)\text{op}( A ).
  • transB: [mublasOperation_t] Specifies the form of op(B)\text{op}( B ).
  • m: [mublas_int] Matrix dimension mm.
  • n: [mublas_int] Matrix dimension nn.
  • k: [mublas_int] Matrix dimension kk.
  • alpha: Device pointer or host pointer specifying the scalar α\alpha.
  • A: Device array of device pointers storing each matrix AiA_i.
  • lda: [mublas_int] Specifies the leading dimension of each AiA_i.
  • B: Device array of device pointers storing each matrix BiB_i.
  • ldb: [mublas_int] Specifies the leading dimension of each BiB_i.
  • beta: Device pointer or host pointer specifying the scalar β\beta.
  • C: Device array of device pointers storing each matrix CiC_i.
  • ldc: [mublas_int] Specifies the leading dimension of each CiC_i.
  • batch_count: [mublas_int] Number of GEMM operations in the batch.

Operation

The gemm_batched function performs one of the batched matrix-matrix operations:

Ci=αop(Ai)op(Bi)+βCi,i=1,,batch_count,C_i = \alpha \cdot \text{op}( A_i ) \cdot \text{op}( B_i ) + \beta \cdot C_i, \quad i = 1, \dots, \text{batch\_count},

Where op(X)\text{op}( X ) is one of:

op(X)=Xorop(X)=XTorop(X)=XH,\text{op}( X ) = X \quad \text{or} \quad \text{op}( X ) = X^T \quad \text{or} \quad \text{op}( X ) = X^H,

Where:

  • α\alpha and β\beta are scalars.
  • AA, BB, and CC are strided batched matrices:
    • op(A)\text{op}( A ) is an m×km \times k by batch_count strided-batched matrix.
    • op(B)\text{op}( B ) is a k×nk \times n by batch_count strided-batched matrix.
    • CC is an m×nm \times n by batch_count strided-batched matrix.

function mublasCgemmStridedBatched

mublasStatus mublasCgemmStridedBatched(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
mublas_stride stride_a,
const muComplex * B,
mublas_int ldb,
mublas_stride stride_b,
const muComplex * beta,
muComplex * C,
mublas_int ldc,
mublas_stride stride_c,
mublas_int batch_count
)

function mublasSgemmStridedBatched

mublasStatus mublasSgemmStridedBatched(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const float * alpha,
const float * A,
mublas_int lda,
mublas_stride stride_a,
const float * B,
mublas_int ldb,
mublas_stride stride_b,
const float * beta,
float * C,
mublas_int ldc,
mublas_stride stride_c,
mublas_int batch_count
)

BLAS Level 3 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • transA: [mublasOperation_t] Specifies the form of op(A)\text{op}( A ).
  • transB: [mublasOperation_t] Specifies the form of op(B)\text{op}( B ).
  • m: [mublas_int] Matrix dimension mm.
  • n: [mublas_int] Matrix dimension nn.
  • k: [mublas_int] Matrix dimension kk.
  • alpha: Device pointer or host pointer specifying the scalar α\alpha.
  • A: Device pointer pointing to the first matrix A1A_1.
  • lda: [mublas_int] Specifies the leading dimension of each AiA_i.
  • stride_a: [mublas_stride] Stride from the start of one AiA*i matrix to the next Ai+1A*{i+1}.
  • B: Device pointer pointing to the first matrix B1B_1.
  • ldb: [mublas_int] Specifies the leading dimension of each BiB_i.
  • stride_b: [mublas_stride] Stride from the start of one BiB*i matrix to the next Bi+1B*{i+1}.
  • beta: Device pointer or host pointer specifying the scalar β\beta.
  • C: Device pointer pointing to the first matrix C1C_1.
  • ldc: [mublas_int] Specifies the leading dimension of each CiC_i.
  • stride_c: [mublas_stride] Stride from the start of one CiC*i matrix to the next Ci+1C*{i+1}.
  • batch_count: [mublas_int] Number of GEMM operations in the batch.

Operation

The gemm_strided_batched function performs one of the strided batched matrix-matrix operations:

Ci=αop(Ai)op(Bi)+βCi,fori=1,,batch_count.C_i = \alpha \cdot \text{op}( A_i ) \cdot \text{op}( B_i ) + \beta \cdot C_i, \quad \text{for} \quad i = 1, \dots, \text{batch\_count}.

Where op(X)\text{op}( X ) is one of:

op(X)=Xorop(X)=XTorop(X)=XH,\text{op}( X ) = X \quad \text{or} \quad \text{op}( X ) = X^T \quad \text{or} \quad \text{op}( X ) = X^H,

Where:

  • α\alpha and β\beta are scalars.
  • AA, BB, and CC are strided batched matrices:
    • op(A)\text{op}( A ) is an m×km \times k by batch_count strided-batched matrix.
    • op(B)\text{op}( B ) is a k×nk \times n by batch_count strided-batched matrix.
    • CC is an m×nm \times n by batch_count strided-batched matrix.

function mublasCgemv

mublasStatus mublasCgemv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * x,
mublas_int incx,
const muComplex * beta,
muComplex * y,
mublas_int incy
)

function mublasSgemv

mublasStatus mublasSgemv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
const float * alpha,
const float * A,
mublas_int lda,
const float * x,
mublas_int incx,
const float * beta,
float * y,
mublas_int incy
)

function mublasDgemv

mublasStatus mublasDgemv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
const double * alpha,
const double * A,
mublas_int lda,
const double * x,
mublas_int incx,
const double * beta,
double * y,
mublas_int incy
)

function mublasZgemv

mublasStatus mublasZgemv(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * beta,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • trans: [mublasOperation_t] Indicates whether matrix AA is transposed (conjugated) or not.
  • m: [mublas_int] Number of rows of matrix AA.
  • n: [mublas_int] Number of columns of matrix AA.
  • alpha: Device pointer or host pointer to scalar α\alpha.
  • A: Device pointer storing matrix AA.
  • lda: [mublas_int] Specifies the leading dimension of AA.
  • x: Device pointer storing vector x\mathbf{x}.
  • incx: [mublas_int] Specifies the increment for the elements of x\mathbf{x}.
  • beta: Device pointer or host pointer to scalar β\beta.
  • y: Device pointer storing vector y\mathbf{y}.
  • incy: [mublas_int] Specifies the increment for the elements of y\mathbf{y}.

Operation

The gemv function performs one of the following matrix-vector operations:

y:=αAx+βy,ory:=αATx+βy,ory:=αAHx+βy,\mathbf{y} := \alpha \cdot A \cdot \mathbf{x} + \beta \cdot \mathbf{y}, \quad \text{or} \quad \mathbf{y} := \alpha \cdot A^T \cdot \mathbf{x} + \beta \cdot \mathbf{y}, \quad \text{or} \quad \mathbf{y} := \alpha \cdot A^H \cdot \mathbf{x} + \beta \cdot \mathbf{y},

Where:

  • α\alpha and β\beta are scalars.
  • x\mathbf{x} and y\mathbf{y} are vectors.
  • AA is an m×nm \times n matrix.

function mublasSger

mublasStatus mublasSger(
mublasHandle_t handle,
mublas_int m,
mublas_int n,
const float * alpha,
const float * x,
mublas_int incx,
const float * y,
mublas_int incy,
float * A,
mublas_int lda
)

function mublasDger

mublasStatus mublasDger(
mublasHandle_t handle,
mublas_int m,
mublas_int n,
const double * alpha,
const double * x,
mublas_int incx,
const double * y,
mublas_int incy,
double * A,
mublas_int lda
)

function mublasCgeru

mublasStatus mublasCgeru(
mublasHandle_t handle,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * x,
mublas_int incx,
const muComplex * y,
mublas_int incy,
muComplex * A,
mublas_int lda
)

function mublasZgeru

mublasStatus mublasZgeru(
mublasHandle_t handle,
mublas_int m,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * y,
mublas_int incy,
muDoubleComplex * A,
mublas_int lda
)

function mublasCgerc

mublasStatus mublasCgerc(
mublasHandle_t handle,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * x,
mublas_int incx,
const muComplex * y,
mublas_int incy,
muComplex * A,
mublas_int lda
)

function mublasZgerc

mublasStatus mublasZgerc(
mublasHandle_t handle,
mublas_int m,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * y,
mublas_int incy,
muDoubleComplex * A,
mublas_int lda
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • m: [mublas_int] The number of rows of the matrix AA.
  • n: [mublas_int] The number of columns of the matrix AA.
  • alpha: Device pointer or host pointer to scalar α\alpha.
  • x: Device pointer storing vector x\mathbf{x}.
  • incx: [mublas_int] Specifies the increment for the elements of x\mathbf{x}.
  • y: Device pointer storing vector y\mathbf{y}.
  • incy: [mublas_int] Specifies the increment for the elements of y\mathbf{y}.
  • A: Device pointer storing matrix AA.
  • lda: [mublas_int] Specifies the leading dimension of AA.

Operation

The ger, geru, and gerc functions perform the following matrix-vector operations:

A:=A+αxyT,orA:=A+αxyH for gerc,A := A + \alpha \cdot \mathbf{x} \cdot \mathbf{y}^T, \quad \text{or} \quad A := A + \alpha \cdot \mathbf{x} \cdot \mathbf{y}^H \text{ for gerc},

Where:

  • α\alpha is a scalar.
  • x\mathbf{x} and y\mathbf{y} are vectors.
  • AA is an m×nm \times n matrix.

function mublasChbmv

mublasStatus mublasChbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * x,
mublas_int incx,
const muComplex * beta,
muComplex * y,
mublas_int incy
)

function mublasZhbmv

mublasStatus mublasZhbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
mublas_int k,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * beta,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of A is being supplied.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of A is being supplied.
  • n: [mublas_int] The order of the matrix AA.
  • k: [mublas_int] The number of super-diagonals of the matrix AA. Must be >= 0.
  • alpha: Device pointer or host pointer to scalar α\alpha.
  • A: Device pointer storing matrix AA. Dimension is (lda,n)(\text{lda}, n).
    • If uplo == MUBLAS_FILL_MODE_UPPER: The leading (k+1)×n(k + 1) \times n part of A contains the upper triangular band part of the Hermitian matrix, with the leading diagonal in row (k+1)(k + 1), the first super-diagonal on the RHS of row kk, and so on.
    • If uplo == MUBLAS_FILL_MODE_LOWER: The leading (k+1)×n(k + 1) \times n part of A contains the lower triangular band part of the Hermitian matrix, with the leading diagonal in row 1, the first sub-diagonal on the LHS of row 2, and so on.
  • lda: [mublas_int] Specifies the leading dimension of AA. Must be >= k+1k + 1.
  • x: Device pointer storing vector x\mathbf{x}.
  • incx: [mublas_int] Specifies the increment for the elements of x\mathbf{x}.
  • beta: Device pointer or host pointer to scalar β\beta.
  • y: Device pointer storing vector y\mathbf{y}.
  • incy: [mublas_int] Specifies the increment for the elements of y\mathbf{y}.

Operation

The hbmv function performs the following matrix-vector operation:

y:=αAx+βy,\mathbf{y} := \alpha \cdot A \cdot \mathbf{x} + \beta \cdot \mathbf{y},

Where:

  • α\alpha and β\beta are scalars.
  • x\mathbf{x} and y\mathbf{y} are vectors with nn elements.
  • AA is an n×nn \times n Hermitian band matrix with kk super-diagonals.

If uplo == MUBLAS_FILL_MODE_UPPER, the matrix AA contains the upper triangular part of the Hermitian matrix. If uplo == MUBLAS_FILL_MODE_LOWER, the matrix AA contains the lower triangular part.

function mublasChemm

mublasStatus mublasChemm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * B,
mublas_int ldb,
const muComplex * beta,
muComplex * C,
mublas_int ldc
)

function mublasZhemm

mublasStatus mublasZhemm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * B,
mublas_int ldb,
const muDoubleComplex * beta,
muDoubleComplex * C,
mublas_int ldc
)

BLAS Level 3 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • side: [mublasSideMode_t]
    • MUBLAS_SIDE_LEFT: C:=αAB+βCC := \alpha A B + \beta C
    • MUBLAS_SIDE_RIGHT: C:=αBA+βCC := \alpha B A + \beta C
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix.
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix.
  • m: [mublas_int] The number of rows of BB and CC. Must be m0m \geq 0.
  • n: [mublas_int] The number of columns of BB and CC. Must be n0n \geq 0.
  • alpha: Scalar α\alpha. If α=0\alpha = 0, then AA and BB are not referenced.
  • A: Pointer storing matrix AA on the GPU.
    • If side = MUBLAS_SIDE_LEFT: AA is m×mm \times m.
    • If side = MUBLAS_SIDE_RIGHT: AA is n×nn \times n.
    • Only the upper or lower triangular part of AA is accessed.
    • The imaginary part of the diagonal elements is not used.
  • lda: [mublas_int] Specifies the first dimension of AA.
    • If side = MUBLAS_SIDE_LEFT, ldamax(1,m)\text{lda} \geq \max(1, m).
    • If side = MUBLAS_SIDE_RIGHT, ldamax(1,n)\text{lda} \geq \max(1, n).
  • B: Pointer storing matrix BB on the GPU. Matrix dimension is m×nm \times n.
  • ldb: [mublas_int] Specifies the first dimension of BB. ldbmax(1,m)\text{ldb} \geq \max(1, m).
  • beta: Scalar β\beta. If β=0\beta = 0, then CC does not need to be set before entry.
  • C: Pointer storing matrix CC on the GPU. Matrix dimension is m×nm \times n.
  • ldc: [mublas_int] Specifies the first dimension of CC. ldcmax(1,m)\text{ldc} \geq \max(1, m).

Operation

The hemm function performs the following matrix-matrix operation:

  • If side == MUBLAS_SIDE_LEFT:

    C:=αAB+βCC := \alpha A B + \beta C
  • If side == MUBLAS_SIDE_RIGHT:

    C:=αBA+βCC := \alpha B A + \beta C

Where:

  • α\alpha and β\beta are scalars.
  • BB and CC are m×nm \times n matrices.
  • AA is a Hermitian matrix stored as either upper or lower triangular.

function mublasChemv

mublasStatus mublasChemv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * x,
mublas_int incx,
const muComplex * beta,
muComplex * y,
mublas_int incy
)

function mublasZhemv

mublasStatus mublasZhemv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * beta,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of the Hermitian matrix AA is supplied.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of the Hermitian matrix AA is supplied.
  • n: [mublas_int] The order of the matrix AA.
  • alpha: Scalar α\alpha.
  • A: Pointer storing matrix AA.
    • If uplo == MUBLAS_FILL_MODE_UPPER: The upper triangular part of AA must contain the upper triangular part of a Hermitian matrix. The lower triangular part will not be referenced.
    • If uplo == MUBLAS_FILL_MODE_LOWER: The lower triangular part of AA must contain the lower triangular part of a Hermitian matrix. The upper triangular part will not be referenced.
    • The imaginary part of the main diagonal of AA is assumed to be zero (Hermitian matrix).
  • lda: [mublas_int] Specifies the leading dimension of AA. Must be max(1,n)\geq \max(1, n).
  • x: Pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • beta: Scalar β\beta.
  • y: Pointer storing vector yy.
  • incy: [mublas_int] Specifies the increment for the elements of yy.

Operation

The hemv function performs the following matrix-vector operation:

y:=αAx+βyy := \alpha A x + \beta y

Where:

  • α\alpha and β\beta are scalars.
  • xx and yy are nn-element vectors.
  • AA is an n×nn \times n Hermitian matrix, with the appropriate triangular part (upper or lower) referenced based on uplo.

function mublasCher

mublasStatus mublasCher(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const muComplex * x,
mublas_int incx,
muComplex * A,
mublas_int lda
)

function mublasZher

mublasStatus mublasZher(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const muDoubleComplex * x,
mublas_int incx,
muDoubleComplex * A,
mublas_int lda
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of matrix AA is supplied.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of matrix AA is supplied.
  • n: [mublas_int] The number of rows and columns of matrix AA, must be at least 0.
  • alpha: Scalar α\alpha.
  • x: Pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • A: Pointer storing the specified triangular portion of the Hermitian matrix AA.
    • If uplo == MUBLAS_FILL_MODE_UPPER: The upper triangular portion of AA is supplied. The lower triangular portion will not be accessed.
    • If uplo == MUBLAS_FILL_MODE_LOWER: The lower triangular portion of AA is supplied. The upper triangular portion will not be accessed.
    • The imaginary part of the diagonal elements of AA is not accessed and is assumed to be 0 (Hermitian matrix).
  • lda: [mublas_int] Specifies the leading dimension of AA. Must be at least max(1,n)\max(1, n).

Operation

The her function performs the following matrix-vector operation:

A:=A+αxxHA := A + \alpha x x^H

Where:

  • α\alpha is a real scalar.
  • xx is a vector.
  • AA is an n×nn \times n Hermitian matrix.
  • xHx^H is the conjugate transpose of xx.

function mublasCher2

mublasStatus mublasCher2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muComplex * alpha,
const muComplex * x,
mublas_int incx,
const muComplex * y,
mublas_int incy,
muComplex * A,
mublas_int lda
)

function mublasZher2

mublasStatus mublasZher2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * y,
mublas_int incy,
muDoubleComplex * A,
mublas_int lda
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of matrix AA is supplied.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of matrix AA is supplied.
  • n: [mublas_int] The number of rows and columns of matrix AA, must be at least 0.
  • alpha: Scalar α\alpha (complex scalar).
  • x: Pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • y: Pointer storing vector yy.
  • incy: [mublas_int] Specifies the increment for the elements of yy.
  • A: Pointer storing the specified triangular portion of the Hermitian matrix AA.
    • If uplo == MUBLAS_FILL_MODE_UPPER: The upper triangular portion of AA is supplied. The lower triangular portion will not be accessed.
    • If uplo == MUBLAS_FILL_MODE_LOWER: The lower triangular portion of AA is supplied. The upper triangular portion will not be accessed.
    • The imaginary part of the diagonal elements of AA is not accessed and is assumed to be 0 (Hermitian matrix).
  • lda: [mublas_int] Specifies the leading dimension of AA. Must be at least max(lda,1)\max(\text{lda}, 1).

Operation

The her2 function performs the following matrix-vector operation:

A:=A+αxyH+αyxHA := A + \alpha x y^H + \overline{\alpha} y x^H

Where:

  • α\alpha is a complex scalar.
  • xx and yy are vectors.
  • AA is an n×nn \times n Hermitian matrix.
  • xHx^H and yHy^H are the conjugate transposes of xx and yy, respectively.
  • α\overline{\alpha} denotes the complex conjugate of α\alpha.

function mublasCher2k

mublasStatus mublasCher2k(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * B,
mublas_int ldb,
const float * beta,
muComplex * C,
mublas_int ldc
)

function mublasZher2k

mublasStatus mublasZher2k(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublas_int n,
mublas_int k,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * B,
mublas_int ldb,
const double * beta,
muDoubleComplex * C,
mublas_int ldc
)

BLAS Level 3 API

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: CC is an upper triangular matrix.
    • MUBLAS_FILL_MODE_LOWER: CC is a lower triangular matrix.
  • trans: [mublasOperation_t]
    • MUBLAS_OP_C: op(A)=AH\text{op}(A) = A^H, op(B)=BH\text{op}(B) = B^H
    • MUBLAS_OP_N: op(A)=A\text{op}(A) = A, op(B)=B\text{op}(B) = B
  • n: [mublas_int] The number of rows and columns of matrix CC. Must be n0n \geq 0.
  • k: [mublas_int] The number of columns of op(A)\text{op}(A). Must be k0k \geq 0.
  • alpha: Scalar α\alpha. When α=0\alpha = 0, AA is not referenced, and AA need not be set before entry.
  • A: Pointer storing matrix AA on the GPU. Matrix dimension is:
    • (lda,k)(\text{lda}, k) when trans=MUBLAS_OP_Ntrans = MUBLAS\_OP\_N,
    • (lda,n)(\text{lda}, n) when trans=MUBLAS_OP_Ctrans = MUBLAS\_OP\_C.
    • Only the upper/lower triangular part is accessed.
  • lda: [mublas_int] The leading dimension of AA.
    • If trans=MUBLAS_OP_Ntrans = MUBLAS\_OP\_N, ldamax(1,n)\text{lda} \geq \max(1, n).
    • Otherwise, ldamax(1,k)\text{lda} \geq \max(1, k).
  • B: Pointer storing matrix BB on the GPU. Matrix dimension is:
    • (ldb,k)(\text{ldb}, k) when trans=MUBLAS_OP_Ntrans = MUBLAS\_OP\_N,
    • (ldb,n)(\text{ldb}, n) when trans=MUBLAS_OP_Ctrans = MUBLAS\_OP\_C.
    • Only the upper/lower triangular part is accessed.
  • ldb: [mublas_int] The leading dimension of BB.
    • If trans=MUBLAS_OP_Ntrans = MUBLAS\_OP\_N, ldbmax(1,n)\text{ldb} \geq \max(1, n).
    • Otherwise, ldbmax(1,k)\text{ldb} \geq \max(1, k).
  • beta: Scalar β\beta. When β=0\beta = 0, CC need not be set before entry.
  • C: Pointer storing matrix CC on the GPU. The imaginary part of the diagonal elements of CC is not accessed and is assumed to be 0 unless a quick return is performed.
  • ldc: [mublas_int] The leading dimension of CC. Must be ldcmax(1,n)\text{ldc} \geq \max(1, n).

Operation

The her2k function performs the Hermitian rank-2k update for matrix-matrix operations:

C:=αop(A)op(B)H+αop(B)op(A)H+βCC := \alpha \, \text{op}(A) \, \text{op}(B)^H + \overline{\alpha} \, \text{op}(B) \, \text{op}(A)^H + \beta C

Where:

  • α\alpha and β\beta are scalars.
  • op(A)\text{op}(A) and op(B)\text{op}(B) are n×kn \times k matrices.
  • CC is an n×nn \times n Hermitian matrix.
  • If trans=MUBLAS_OP_Ntrans = MUBLAS\_OP\_N, then op(A)=A\text{op}(A) = A and op(B)=B\text{op}(B) = B.
  • If trans=MUBLAS_OP_Ctrans = MUBLAS\_OP\_C, then op(A)=AH\text{op}(A) = A^H and op(B)=BH\text{op}(B) = B^H.

function mublasCherk

mublasStatus mublasCherk(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const float * alpha,
const muComplex * A,
mublas_int lda,
const float * beta,
muComplex * C,
mublas_int ldc
)

function mublasZherk

mublasStatus mublasZherk(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const double * alpha,
const muDoubleComplex * A,
mublas_int lda,
const double * beta,
muDoubleComplex * C,
mublas_int ldc
)

BLAS Level 3 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: CC is an upper triangular matrix.
    • MUBLAS_FILL_MODE_LOWER: CC is a lower triangular matrix.
  • transA: [mublasOperation_t]
    • MUBLAS_OP_C: op(A)=AH\text{op}(A) = A^H
    • MUBLAS_OP_N: op(A)=A\text{op}(A) = A
  • n: [mublas_int] The number of rows and columns of matrix CC. Must be n0n \geq 0.
  • k: [mublas_int] The number of columns of op(A)\text{op}(A). Must be k0k \geq 0.
  • alpha: Scalar α\alpha. When α=0\alpha = 0, AA is not referenced, and AA need not be set before entry.
  • A: Pointer storing matrix AA on the GPU. Matrix dimension is:
    • (lda,k)(\text{lda}, k) when transA=MUBLAS_OP_NtransA = MUBLAS\_OP\_N,
    • (lda,n)(\text{lda}, n) when transA=MUBLAS_OP_CtransA = MUBLAS\_OP\_C.
    • Only the upper/lower triangular part is accessed.
  • lda: [mublas_int] The leading dimension of AA.
    • If transA=MUBLAS_OP_NtransA = MUBLAS\_OP\_N, ldamax(1,n)\text{lda} \geq \max(1, n).
    • Otherwise, ldamax(1,k)\text{lda} \geq \max(1, k).
  • beta: Scalar β\beta. When β=0\beta = 0, CC need not be set before entry.
  • C: Pointer storing matrix CC on the GPU. The imaginary component of the diagonal elements of CC is not accessed and is assumed to be 0 unless a quick return is performed.
  • ldc: [mublas_int] The leading dimension of CC. Must be ldcmax(1,n)\text{ldc} \geq \max(1, n).

Operation

The herk function performs one of the matrix-matrix operations for a Hermitian rank-k update:

C:=αop(A)op(A)H+βCC := \alpha \, \text{op}(A) \, \text{op}(A)^H + \beta C

Where:

  • α\alpha and β\beta are scalars.
  • op(A)\text{op}(A) is an n×kn \times k matrix.
  • CC is an n×nn \times n Hermitian matrix stored as either upper or lower.
  • If trans=MUBLAS_OP_Ntrans = MUBLAS\_OP\_N, then op(A)=A\text{op}(A) = A and AA is n×kn \times k.
  • If trans=MUBLAS_OP_Ctrans = MUBLAS\_OP\_C, then op(A)=AH\text{op}(A) = A^H and AA is k×nk \times n.

function mublasCherkStridedBatched

mublasStatus mublasCherkStridedBatched(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const float * alpha,
const muComplex * A,
mublas_int lda,
mublas_stride stride_A,
const float * beta,
muComplex * C,
mublas_int ldc,
mublas_stride stride_C,
mublas_int batch_count
)

BLAS Level 3 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: CiC_i is an upper triangular matrix.
    • MUBLAS_FILL_MODE_LOWER: CiC_i is a lower triangular matrix.
  • transA: [mublasOperation_t]
    • MUBLAS_OP_C: op(A)=AH\text{op}(A) = A^H
    • MUBLAS_OP_N: op(A)=A\text{op}(A) = A
  • n: [mublas_int] The number of rows and columns of matrix CiC_i. Must be n0n \geq 0.
  • k: [mublas_int] The number of columns of op(A)\text{op}(A). Must be k0k \geq 0.
  • alpha: Scalar α\alpha. When α=0\alpha = 0, AA is not referenced, and AA need not be set before entry.
  • A: Device pointer to the first matrix A1A_1 on the GPU. Matrix dimension is:
    • (lda,k)(\text{lda}, k) when transA=MUBLAS_OP_NtransA = MUBLAS\_OP\_N.
    • (lda,n)(\text{lda}, n) when transA=MUBLAS_OP_CtransA = MUBLAS\_OP\_C.
  • lda: [mublas_int] The leading dimension of AiA_i.
    • If transA=MUBLAS_OP_NtransA = MUBLAS\_OP\_N, ldamax(1,n)\text{lda} \geq \max(1, n).
    • Otherwise, ldamax(1,k)\text{lda} \geq \max(1, k).
  • stride_A: [mublas_stride] The stride from the start of one matrix (AiA_i) and the next one (Ai+1A_{i+1}).
  • beta: Scalar β\beta. When β=0\beta = 0, CC need not be set before entry.
  • C: Device pointer to the first matrix C1C_1 on the GPU. The imaginary part of the diagonal elements of CC is not accessed and is assumed to be 0 unless a quick return is performed.
  • ldc: [mublas_int] The leading dimension of CC. Must be ldcmax(1,n)\text{ldc} \geq \max(1, n).
  • stride_C: [mublas_stride] The stride from the start of one matrix (CiC_i) and the next one (Ci+1C_{i+1}).
  • batch_count: [mublas_int] The number of instances in the batch.

Operation

The herk_strided_batched function performs a batch of matrix-matrix operations for a Hermitian rank-k update:

Ci:=αop(Ai)op(Ai)H+βCiC_i := \alpha \, \text{op}(A_i) \, \text{op}(A_i)^H + \beta C_i

Where:

  • α\alpha and β\beta are scalars.
  • op(Ai)\text{op}(A_i) is an n×kn \times k matrix.
  • CiC_i is an n×nn \times n Hermitian matrix.
  • If transA=MUBLAS_OP_NtransA = MUBLAS\_OP\_N, then op(Ai)=Ai\text{op}(A_i) = A_i.
  • If transA=MUBLAS_OP_CtransA = MUBLAS\_OP\_C, then op(Ai)=AiH\text{op}(A_i) = A_i^H.

function mublasChpmv

mublasStatus mublasChpmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muComplex * alpha,
const muComplex * AP,
const muComplex * x,
mublas_int incx,
const muComplex * beta,
muComplex * y,
mublas_int incy
)

function mublasZhpmv

mublasStatus mublasZhpmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * AP,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * beta,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of the Hermitian matrix AA is supplied in APAP.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of the Hermitian matrix AA is supplied in APAP.
  • n: [mublas_int] The order of the matrix AA. Must be n0n \geq 0.
  • alpha: Device pointer or host pointer to scalar α\alpha.
  • AP: Device pointer storing the packed version of the specified triangular portion of the Hermitian matrix AA. It must be of at least size n(n+1)2\frac{n(n + 1)}{2}. If uplo=MUBLAS_FILL_MODE_UPPERuplo = MUBLAS\_FILL\_MODE\_UPPER, the upper triangular portion of AA is supplied. The matrix is packed such that:
    • AP(0)=A(0,0)AP(0) = A(0,0),
    • AP(1)=A(0,1)AP(1) = A(0,1),
    • AP(2)=A(1,1)AP(2) = A(1,1), and so on.
    • If uplo=MUBLAS_FILL_MODE_LOWERuplo = MUBLAS\_FILL\_MODE\_LOWER, the lower triangular portion of AA is supplied. The matrix is packed such that:
    • AP(0)=A(0,0)AP(0) = A(0,0),
    • AP(1)=A(1,0)AP(1) = A(1,0),
    • AP(2)=A(2,1)AP(2) = A(2,1), and so on.
    • Note: The imaginary part of the diagonal elements is not accessed and is assumed to be 0.
  • x: Device pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • beta: Device pointer or host pointer to scalar β\beta.
  • y: Device pointer storing vector yy.
  • incy: [mublas_int] Specifies the increment for the elements of yy.

Operation

The hpmv function performs the matrix-vector operation:

y:=αAx+βyy := \alpha A x + \beta y

Where:

  • α\alpha and β\beta are scalars.
  • AA is an n×nn \times n Hermitian matrix supplied in packed form.
  • xx and yy are nn-element vectors.

function mublasChpr

mublasStatus mublasChpr(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const muComplex * x,
mublas_int incx,
muComplex * AP
)

function mublasZhpr

mublasStatus mublasZhpr(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const muDoubleComplex * x,
mublas_int incx,
muDoubleComplex * AP
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t] Specifies whether the upper or lower triangular part of AA is supplied in APAP.
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of AA is supplied in APAP.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of AA is supplied in APAP.
  • n: [mublas_int] The number of rows and columns of matrix AA. Must be at least 0.
  • alpha: Device or host pointer to scalar α\alpha.
  • x: Device pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • AP: Device pointer storing the packed version of the specified triangular portion of the Hermitian matrix AA. The size must be at least ((n×(n+1))/2)((n \times (n + 1)) / 2).
    • If uplo=MUBLAS_FILL_MODE_UPPERuplo = MUBLAS\_FILL\_MODE\_UPPER: The upper triangular portion of AA is supplied.
    • If uplo=MUBLAS_FILL_MODE_LOWERuplo = MUBLAS\_FILL\_MODE\_LOWER: The lower triangular portion of AA is supplied.

Operation

The hpr function performs the matrix-vector operation:

A:=A+αxxHA := A + \alpha \, x \, x^H

Where:

  • α\alpha is a real scalar.
  • xx is a vector.
  • AA is an n×nn \times n Hermitian matrix, supplied in packed form.

function mublasChpr2

mublasStatus mublasChpr2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muComplex * alpha,
const muComplex * x,
mublas_int incx,
const muComplex * y,
mublas_int incy,
muComplex * AP
)

function mublasZhpr2

mublasStatus mublasZhpr2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * x,
mublas_int incx,
const muDoubleComplex * y,
mublas_int incy,
muDoubleComplex * AP
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t] Specifies whether the upper or lower triangular part of AA is supplied in APAP.
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of AA is supplied in APAP.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of AA is supplied in APAP.
  • n: [mublas_int] The number of rows and columns of matrix AA. Must be at least 0.
  • alpha: Device or host pointer to complex scalar α\alpha.
  • x: Device pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • y: Device pointer storing vector yy.
  • incy: [mublas_int] Specifies the increment for the elements of yy.
  • AP: Device pointer storing the packed version of the specified triangular portion of the Hermitian matrix AA. The size must be at least ((n×(n+1))/2)((n \times (n + 1)) / 2).
    • If uplo=MUBLAS_FILL_MODE_UPPERuplo = MUBLAS\_FILL\_MODE\_UPPER: The upper triangular portion of AA is supplied.
    • If uplo=MUBLAS_FILL_MODE_LOWERuplo = MUBLAS\_FILL\_MODE\_LOWER: The lower triangular portion of AA is supplied.

Operation

The hpr2 function performs the matrix-vector operation:

A:=A+αxyH+αyxHA := A + \alpha \, x \, y^H + \overline{\alpha} \, y \, x^H

Where:

  • α\alpha is a complex scalar.
  • xx and yy are vectors.
  • AA is an n×nn \times n Hermitian matrix, supplied in packed form.

function mublasSnrm2

mublasStatus mublasSnrm2(
mublasHandle_t handle,
mublas_int n,
const float * x,
mublas_int incx,
float * result
)

function mublasScnrm2

mublasStatus mublasScnrm2(
mublasHandle_t handle,
mublas_int n,
const muComplex * x,
mublas_int incx,
float * result
)

function mublasDznrm2

mublasStatus mublasDznrm2(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * x,
mublas_int incx,
double * result
)

function mublasDnrm2

mublasStatus mublasDnrm2(
mublasHandle_t handle,
mublas_int n,
const double * x,
mublas_int incx,
double * result
)

BLAS Level 1 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • n: [mublas_int] The number of elements in vector xx.
  • x: Device pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • result: Device or host pointer to store the nrm2nrm2 result. The return value is 0.00.0 if n0n \leq 0 or incx0incx \leq 0.

Operation

The nrm2 function computes the Euclidean norm of a real or complex vector:

  • For real vectors:
result:=xTx\text{result} := \sqrt{x^T x}
  • For complex vectors:
result:=xHx\text{result} := \sqrt{x^H x}

function mublasSrot

mublasStatus mublasSrot(
mublasHandle_t handle,
mublas_int n,
float * x,
mublas_int incx,
float * y,
mublas_int incy,
const float * c,
const float * s
)

function mublasCsrot

mublasStatus mublasCsrot(
mublasHandle_t handle,
mublas_int n,
muComplex * x,
mublas_int incx,
muComplex * y,
mublas_int incy,
const float * c,
const float * s
)

function mublasDrot

mublasStatus mublasDrot(
mublasHandle_t handle,
mublas_int n,
double * x,
mublas_int incx,
double * y,
mublas_int incy,
const double * c,
const double * s
)

function mublasZdrot

mublasStatus mublasZdrot(
mublasHandle_t handle,
mublas_int n,
muDoubleComplex * x,
mublas_int incx,
muDoubleComplex * y,
mublas_int incy,
const double * c,
const double * s
)

BLAS Level 1 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • n: [mublas_int] The number of elements in the vectors xx and yy.
  • x: Device pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment between elements of xx.
  • y: Device pointer storing vector yy.
  • incy: [mublas_int] Specifies the increment between elements of yy.
  • c: Device or host pointer storing the scalar cosine component (c=cos(α)c = \cos(\alpha)) of the rotation matrix.
  • s: Device or host pointer storing the scalar sine component (s=sin(α)s = \sin(\alpha)) of the rotation matrix.

Operation

The rot function applies the Givens rotation matrix to vectors xx and yy. The rotation is defined by the cosine and sine components cc and ss, respectively, which are related to an angle α\alpha:

[xy][cssc][xy]\begin{bmatrix} x \\ y \end{bmatrix} \leftarrow \begin{bmatrix} c & s \\ -s & c \end{bmatrix} \begin{bmatrix} x \\ y \end{bmatrix}

Where:

  • c=cos(α)c = \cos(\alpha)
  • s=sin(α)s = \sin(\alpha)

function mublasSrotg

mublasStatus mublasSrotg(
mublasHandle_t handle,
float * a,
float * b,
float * c,
float * s
)

function mublasCrotg

mublasStatus mublasCrotg(
mublasHandle_t handle,
muComplex * a,
muComplex * b,
float * c,
muComplex * s
)

function mublasDrotg

mublasStatus mublasDrotg(
mublasHandle_t handle,
double * a,
double * b,
double * c,
double * s
)

function mublasZrotg

mublasStatus mublasZrotg(
mublasHandle_t handle,
muDoubleComplex * a,
muDoubleComplex * b,
double * c,
muDoubleComplex * s
)

BLAS Level 1 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • a: Device pointer or host pointer to the input vector element, overwritten with rr.
  • b: Device pointer or host pointer to the input vector element, overwritten with zz.
  • c: Device pointer or host pointer to the cosine element of the Givens rotation.
  • s: Device pointer or host pointer to the sine element of the Givens rotation.

Operation

The rotg function creates the Givens rotation matrix for the vector (a,b)(a, b). The rotation matrix is defined by the cosine and sine components cc and ss, and is applied to the vector:

[ab][rz]\begin{bmatrix} a \\ b \end{bmatrix} \leftarrow \begin{bmatrix} r \\ z \end{bmatrix}

Where:

  • rr is the new value of aa after the rotation.
  • zz is the new value of bb after the rotation.
  • c=cos(α)c = \cos(\alpha)
  • s=sin(α)s = \sin(\alpha)

The result of the rotation is stored in aa and bb as rr and zz, respectively.

If the pointer mode is set to MUBLAS_POINTER_MODE_HOST, the function blocks the CPU until the GPU finishes and the results are available in host memory. If set to MUBLAS_POINTER_MODE_DEVICE, the function returns immediately, and synchronization is required to read the results.

function mublasSrotm

mublasStatus mublasSrotm(
mublasHandle_t handle,
mublas_int n,
float * x,
mublas_int incx,
float * y,
mublas_int incy,
const float * param
)

function mublasDrotm

mublasStatus mublasDrotm(
mublasHandle_t handle,
mublas_int n,
double * x,
mublas_int incx,
double * y,
mublas_int incy,
const double * param
)

BLAS Level 1 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • n: [mublas_int] The number of elements in the vectors xx and yy.
  • x: Device pointer storing vector xx.
  • incx: [mublas_int] Specifies the increment between elements of xx.
  • y: Device pointer storing vector yy.
  • incy: [mublas_int] Specifies the increment between elements of yy.
  • param: Device or host vector of 5 elements defining the rotation:
    • param[0]: flag (Defines the form of matrix HH).
    • param[1]: H11H_{11} (Element in the first row, first column).
    • param[2]: H21H_{21} (Element in the second row, first column).
    • param[3]: H12H_{12} (Element in the first row, second column).
    • param[4]: H22H_{22} (Element in the second row, second column).

The flag defines the form of the matrix HH:

  • flag = -1: H=(H11H12H21H22)H = \begin{pmatrix} H_{11} & H_{12} \\ H_{21} & H_{22} \end{pmatrix}
  • flag = 0: H=(1.0H12H211.0)H = \begin{pmatrix} 1.0 & H_{12} \\ H_{21} & 1.0 \end{pmatrix}
  • flag = 1: H=(H111.01.0H22)H = \begin{pmatrix} H_{11} & 1.0 \\ -1.0 & H_{22} \end{pmatrix}
  • flag = -2: H=(1.00.00.01.0)H = \begin{pmatrix} 1.0 & 0.0 \\ 0.0 & 1.0 \end{pmatrix}

The param vector may be stored in either host or device memory, and the location is specified by calling mublasSetPointerMode.

Operation

The rotm function applies the modified Givens rotation matrix defined by param to the vectors xx and yy. The operation performed is:

(xy)H(xy)\begin{pmatrix} x \\ y \end{pmatrix} \leftarrow H \begin{pmatrix} x \\ y \end{pmatrix}

Where HH is one of the four possible matrices defined by the param vector.

function mublasSrotmg

mublasStatus mublasSrotmg(
mublasHandle_t handle,
float * d1,
float * d2,
float * x1,
const float * y1,
float * param
)

function mublasDrotmg

mublasStatus mublasDrotmg(
mublasHandle_t handle,
double * d1,
double * d2,
double * x1,
const double * y1,
double * param
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • d1 device pointer or host pointer to input scalar that is overwritten.
  • d2 device pointer or host pointer to input scalar that is overwritten.
  • x1 device pointer or host pointer to input scalar that is overwritten.
  • y1 device pointer or host pointer to input scalar.
  • param device vector or host vector of 5 elements defining the rotation. param[0] = flag param[1] = H11 param[2] = H21 param[3] = H12 param[4] = H22 The flag parameter defines the form of H: flag = -1 => H = ( H11 H12 H21 H22 ) flag = 0 => H = ( 1.0 H12 H21 1.0 ) flag = 1 => H = ( H11 1.0 -1.0 H22 ) flag = -2 => H = ( 1.0 0.0 0.0 1.0 ) param may be stored in either host or device memory, location is specified by calling mublasSetPointerMode.

rotmg creates the modified Givens rotation matrix for the vector (d1 _ x1, d2 _ y1). Parameters may be stored in either host or device memory, location is specified by calling mublasSetPointerMode. If the pointer mode is set to MUBLAS_POINTER_MODE_HOST, this function blocks the CPU until the GPU has finished and the results are available in host memory. If the pointer mode is set to MUBLAS_POINTER_MODE_DEVICE, this function returns immediately and synchronization is required to read the results.

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • d1: Device pointer or host pointer to the input scalar that is overwritten.
  • d2: Device pointer or host pointer to the input scalar that is overwritten.
  • x1: Device pointer or host pointer to the input scalar that is overwritten.
  • y1: Device pointer or host pointer to the input scalar.
  • param: Device or host vector of 5 elements defining the rotation:
    • param[0]: flag (Defines the form of matrix HH).
    • param[1]: H11H_{11} (Element in the first row, first column).
    • param[2]: H21H_{21} (Element in the second row, first column).
    • param[3]: H12H_{12} (Element in the first row, second column).
    • param[4]: H22H_{22} (Element in the second row, second column).

The flag defines the form of the matrix HH:

  • flag = -1: H=(H11H12H21H22)H = \begin{pmatrix} H_{11} & H_{12} \\ H_{21} & H_{22} \end{pmatrix}
  • flag = 0: H=(1.0H12H211.0)H = \begin{pmatrix} 1.0 & H_{12} \\ H_{21} & 1.0 \end{pmatrix}
  • flag = 1: H=(H111.01.0H22)H = \begin{pmatrix} H_{11} & 1.0 \\ -1.0 & H_{22} \end{pmatrix}
  • flag = -2: H=(1.00.00.01.0)H = \begin{pmatrix} 1.0 & 0.0 \\ 0.0 & 1.0 \end{pmatrix}

The param vector may be stored in either host or device memory, and the location is specified by calling mublasSetPointerMode.

Operation

The rotmg function creates the modified Givens rotation matrix for the vector (d1x1,d2y1)(d1 \cdot x1, d2 \cdot y1). Parameters may be stored in either host or device memory, and the location is specified by calling mublasSetPointerMode.

If the pointer mode is set to MUBLAS_POINTER_MODE_HOST, this function blocks the CPU until the GPU has finished and the results are available in host memory.

If the pointer mode is set to MUBLAS_POINTER_MODE_DEVICE, this function returns immediately, and synchronization is required to read the results.

function mublasSsbmv

mublasStatus mublasSsbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
mublas_int k,
const float * alpha,
const float * A,
mublas_int lda,
const float * x,
mublas_int incx,
const float * beta,
float * y,
mublas_int incy
)

function mublasDsbmv

mublasStatus mublasDsbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
mublas_int k,
const double * alpha,
const double * A,
mublas_int lda,
const double * x,
mublas_int incx,
const double * beta,
double * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • uplo: [mublasFillMode_t] Specifies whether the upper (MUBLAS_FILL_MODE_UPPER) or lower (MUBLAS_FILL_MODE_LOWER) part of AA is used. If MUBLAS_FILL_MODE_UPPER, the lower part of AA is not referenced. If MUBLAS_FILL_MODE_LOWER, the upper part of AA is not referenced.
  • n: [mublas_int] Specifies the order of the symmetric banded matrix AA (number of rows and columns).
  • k: [mublas_int] Specifies the number of sub- and super-diagonals in the symmetric banded matrix AA.
  • alpha: [float] Specifies the scalar α\alpha.
  • A: Pointer to the symmetric banded matrix AA stored on the GPU.
  • lda: [mublas_int] Specifies the leading dimension of the array containing AA. Must be at least k+1k + 1.
  • x: Pointer to the vector xx stored on the GPU.
  • incx: [mublas_int] Specifies the increment for the elements of xx.
  • beta: [float] Specifies the scalar β\beta.
  • y: Pointer to the vector yy stored on the GPU.
  • incy: [mublas_int] Specifies the increment for the elements of yy.

Operation

The sbmv function performs the matrix-vector operation:

y:=αAx+βyy := \alpha \cdot A \cdot x + \beta \cdot y

where:

  • α\alpha and β\beta are scalars,
  • xx and yy are nn-element vectors,
  • AA is a symmetric banded matrix of order nn with kk sub- and super-diagonals, stored in a compact form as specified by the lda parameter.

function mublasCscal

mublasStatus mublasCscal(
mublasHandle_t handle,
mublas_int n,
const muComplex * alpha,
muComplex * x,
mublas_int incx
)

function mublasZscal

mublasStatus mublasZscal(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * alpha,
muDoubleComplex * x,
mublas_int incx
)

function mublasCsscal

mublasStatus mublasCsscal(
mublasHandle_t handle,
mublas_int n,
const float * alpha,
muComplex * x,
mublas_int incx
)

function mublasSscal

mublasStatus mublasSscal(
mublasHandle_t handle,
mublas_int n,
const float * alpha,
float * x,
mublas_int incx
)

function mublasDscal

mublasStatus mublasDscal(
mublasHandle_t handle,
mublas_int n,
const double * alpha,
double * x,
mublas_int incx
)

function mublasZscal

mublasStatus mublasZscal(
mublasHandle_t handle,
mublas_int n,
const muDoubleComplex * alpha,
muDoubleComplex * x,
mublas_int incx
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in x.
  • alpha device pointer or host pointer for the scalar alpha.
  • x device pointer storing vector x.
  • incx [mublas_int] specifies the increment for the elements of x.

Operation

scal scales each element of vector xx with scalar α\alpha:

x:=αxx := \alpha \cdot x

function mublasSspmv

mublasStatus mublasSspmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const float * A,
const float * x,
mublas_int incx,
const float * beta,
float * y,
mublas_int incy
)

function mublasDspmv

mublasStatus mublasDspmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const double * A,
const double * x,
mublas_int incx,
const double * beta,
double * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo mublasFillMode_t specifies whether the upper 'MUBLAS_FILL_MODE_UPPER' or lower 'MUBLAS_FILL_MODE_LOWER'. If MUBLAS_FILL_MODE_UPPER, the lower part of AA is not referenced. If MUBLAS_FILL_MODE_LOWER, the upper part of AA is not referenced.
  • n [mublas_int] the number of elements in the vectors xx and yy.
  • alpha specifies the scalar α\alpha.
  • A pointer storing matrix AA on the GPU.
  • x pointer storing vector xx on the GPU.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • beta specifies the scalar β\beta.
  • y pointer storing vector yy on the GPU.
  • incy [mublas_int] specifies the increment for the elements of yy.

Operation

The spmv function performs the matrix-vector operation:

y:=αAx+βyy := \alpha A x + \beta y

Where α\alpha and β\beta are scalars, xx and yy are nn-element vectors, and AA is a packed symmetric matrix of size n×nn \times n that is either upper or lower triangular.

function mublasSspr

mublasStatus mublasSspr(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const float * x,
mublas_int incx,
float * AP
)

function mublasDspr

mublasStatus mublasDspr(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const double * x,
mublas_int incx,
double * AP
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether the upper 'MUBLAS_FILL_MODE_UPPER' or lower 'MUBLAS_FILL_MODE_LOWER':
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of AA is supplied in APAP.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of AA is supplied in APAP.
  • n [mublas_int] the number of rows and columns of matrix AA, must be at least 0.
  • alpha device pointer or host pointer to scalar α\alpha.
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • AP device pointer storing the packed version of the specified triangular portion of the symmetric matrix AA, of at least size n(n+1)2\frac{n(n+1)}{2}.
    • If uplo == MUBLAS_FILL_MODE_UPPER, the upper triangular portion of the symmetric matrix AA is supplied. The matrix is compacted so that APAP contains the triangular portion column-by-column.
    • If uplo == MUBLAS_FILL_MODE_LOWER, the lower triangular portion of the symmetric matrix AA is supplied. The matrix is compacted so that APAP contains the triangular portion column-by-column.

Operation

The spr function performs the matrix-vector operation:

A:=A+αxxTA := A + \alpha x x^T

Where α\alpha is a scalar, xx is a vector, and AA is an n×nn \times n symmetric matrix, supplied in packed form.

function mublasSspr2

mublasStatus mublasSspr2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const float * x,
mublas_int incx,
const float * y,
mublas_int incy,
float * AP
)

function mublasDspr2

mublasStatus mublasDspr2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const double * x,
mublas_int incx,
const double * y,
mublas_int incy,
double * AP
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether the upper 'MUBLAS_FILL_MODE_UPPER' or lower 'MUBLAS_FILL_MODE_LOWER':
    • MUBLAS_FILL_MODE_UPPER: The upper triangular part of AA is supplied in APAP.
    • MUBLAS_FILL_MODE_LOWER: The lower triangular part of AA is supplied in APAP.
  • n [mublas_int] the number of rows and columns of matrix AA, must be at least 0.
  • alpha device pointer or host pointer to scalar α\alpha.
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • y device pointer storing vector yy.
  • incy [mublas_int] specifies the increment for the elements of yy.
  • AP device pointer storing the packed version of the specified triangular portion of the symmetric matrix AA, of at least size n(n+1)2\frac{n(n+1)}{2}.
    • If uplo == MUBLAS_FILL_MODE_UPPER, the upper triangular portion of the symmetric matrix AA is supplied. The matrix is compacted so that APAP contains the triangular portion column-by-column.
    • If uplo == MUBLAS_FILL_MODE_LOWER, the lower triangular portion of the symmetric matrix AA is supplied. The matrix is compacted so that APAP contains the triangular portion column-by-column.

Operation

The spr2 function performs the matrix-vector operation:

A:=A+αxyT+αyxTA := A + \alpha x y^T + \alpha y x^T

Where α\alpha is a scalar, xx and yy are vectors, and AA is an n×nn \times n symmetric matrix, supplied in packed form.

function mublasCswap

mublasStatus mublasCswap(
mublasHandle_t handle,
mublas_int n,
muComplex * x,
mublas_int incx,
muComplex * y,
mublas_int incy
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in xx and yy.
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • y device pointer storing vector yy.
  • incy [mublas_int] specifies the increment for the elements of yy.

Operation

The swap function interchanges vectors xx and yy:

y:=x;x:=yy := x; \quad x := y

function mublasSswap

mublasStatus mublasSswap(
mublasHandle_t handle,
mublas_int n,
float * x,
mublas_int incx,
float * y,
mublas_int incy
)

function mublasDswap

mublasStatus mublasDswap(
mublasHandle_t handle,
mublas_int n,
double * x,
mublas_int incx,
double * y,
mublas_int incy
)

function mublasZswap

mublasStatus mublasZswap(
mublasHandle_t handle,
mublas_int n,
muDoubleComplex * x,
mublas_int incx,
muDoubleComplex * y,
mublas_int incy
)

BLAS Level 1 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • n [mublas_int] the number of elements in xx and yy.
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • y device pointer storing vector yy.
  • incy [mublas_int] specifies the increment for the elements of yy.

Operation

The swap function interchanges vectors xx and yy:

y:=x;x:=yy := x; \quad x := y

function mublasSsymm

mublasStatus mublasSsymm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const float * alpha,
const float * A,
mublas_int lda,
const float * B,
mublas_int ldb,
const float * beta,
float * C,
mublas_int ldc
)

function mublasCsymm

mublasStatus mublasCsymm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * B,
mublas_int ldb,
const muComplex * beta,
muComplex * C,
mublas_int ldc
)

function mublasDsymm

mublasStatus mublasDsymm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const double * alpha,
const double * A,
mublas_int lda,
const double * B,
mublas_int ldb,
const double * beta,
double * C,
mublas_int ldc
)

function mublasZsymm

mublasStatus mublasZsymm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * B,
mublas_int ldb,
const muDoubleComplex * beta,
muDoubleComplex * C,
mublas_int ldc
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • side [mublasSideMode_t]
    • MUBLAS_SIDE_LEFT: C:=αAB+βCC := \alpha A B + \beta C
    • MUBLAS_SIDE_RIGHT: C:=αBA+βCC := \alpha B A + \beta C
  • uplo [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • m [mublas_int] the number of rows of BB and CC, m0m \geq 0.
  • n [mublas_int] the number of columns of BB and CC, n0n \geq 0.
  • alpha scalar α\alpha. When α\alpha is zero, AA and BB are not referenced.
  • A pointer storing matrix AA on the GPU. AA is m×mm \times m if side == MUBLAS_SIDE_LEFT, AA is n×nn \times n if side == MUBLAS_SIDE_RIGHT; only the upper/lower triangular part is accessed.
  • lda [mublas_int] specifies the first dimension of AA. If side == MUBLAS_SIDE_LEFT, ldamax(1,m)\text{lda} \geq \max(1, m), otherwise ldamax(1,n)\text{lda} \geq \max(1, n).
  • B pointer storing matrix BB on the GPU. Matrix dimension is m×nm \times n.
  • ldb [mublas_int] specifies the first dimension of BB. ldbmax(1,m)\text{ldb} \geq \max(1, m).
  • beta scalar β\beta. When β\beta is zero, CC need not be set before entry.
  • C pointer storing matrix CC on the GPU. Matrix dimension is m×nm \times n.
  • ldc [mublas_int] specifies the first dimension of CC. ldcmax(1,m)\text{ldc} \geq \max(1, m).

Operation

The symm function performs one of the matrix-matrix operations:

  • C:=αAB+βCC := \alpha A B + \beta C if side == MUBLAS_SIDE_LEFT
  • C:=αBA+βCC := \alpha B A + \beta C if side == MUBLAS_SIDE_RIGHT

where α\alpha and β\beta are scalars, BB and CC are m×nm \times n matrices, and AA is a symmetric matrix stored as either upper or lower triangular.

function mublasSsymmStridedBatched

mublasStatus mublasSsymmStridedBatched(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const float * alpha,
const float * A,
mublas_int lda,
mublas_stride stride_A,
const float * B,
mublas_int ldb,
mublas_stride stride_B,
const float * beta,
float * C,
mublas_int ldc,
mublas_stride stride_C,
mublas_int batch_count
)

function mublasCsymmStridedBatched

mublasStatus mublasCsymmStridedBatched(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
mublas_stride stride_A,
const muComplex * B,
mublas_int ldb,
mublas_stride stride_B,
const muComplex * beta,
muComplex * C,
mublas_int ldc,
mublas_stride stride_C,
mublas_int batch_count
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • side [mublasSideMode_t]
    • MUBLAS_SIDE_LEFT: Ci:=αAiBi+βCiC_i := \alpha A_i B_i + \beta C_i
    • MUBLAS_SIDE_RIGHT: Ci:=αBiAi+βCiC_i := \alpha B_i A_i + \beta C_i
  • uplo [mublasFillMode_t]
    • MUBLAS_FILL_MODE_UPPER: AiA_i is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AiA_i is a lower triangular matrix
  • m [mublas_int] specifies the number of rows of BiB_i and CiC_i, m0m \geq 0.
  • n [mublas_int] specifies the number of columns of BiB_i and CiC_i, n0n \geq 0.
  • alpha scalar α\alpha. When α\alpha is zero, AiA_i and BiB_i are not referenced.
  • A device pointer to the first matrix A1A_1. AiA_i is m×mm \times m if side == MUBLAS_SIDE_LEFT, AiA_i is n×nn \times n if side == MUBLAS_SIDE_RIGHT; only the upper/lower triangular part is accessed.
  • lda [mublas_int] specifies the first dimension of AiA_i. If side == MUBLAS_SIDE_LEFT, ldamax(1,m)\text{lda} \geq \max(1, m), otherwise ldamax(1,n)\text{lda} \geq \max(1, n).
  • stride_A [mublas_stride] stride from the start of one matrix (AiA_i) to the next one (Ai+1A_{i+1}).
  • B device pointer to the first matrix B1B_1 of dimension (ldb,n)(\text{ldb}, n) on the GPU.
  • ldb [mublas_int] specifies the first dimension of BiB_i. ldbmax(1,m)\text{ldb} \geq \max(1, m).
  • stride_B [mublas_stride] stride from the start of one matrix (BiB_i) to the next one (Bi+1B_{i+1}).
  • beta scalar β\beta. When β\beta is zero, CC need not be set before entry.
  • C device pointer to the first matrix C1C_1 of dimension (ldc,n)(\text{ldc}, n) on the GPU.
  • ldc [mublas_int] specifies the first dimension of CC. ldcmax(1,m)\text{ldc} \geq \max(1, m).
  • stride_C [mublas_stride] stride from the start of one matrix (CiC_i) to the next one (Ci+1C_{i+1}).
  • batch_count [mublas_int] the number of instances in the batch.

Operation

The symm_strided_batched function performs a batch of the matrix-matrix operations:

  • Ci:=αAiBi+βCiC_i := \alpha A_i B_i + \beta C_i if side == MUBLAS_SIDE_LEFT
  • Ci:=αBiAi+βCiC_i := \alpha B_i A_i + \beta C_i if side == MUBLAS_SIDE_RIGHT

where α\alpha and β\beta are scalars, BiB_i and CiC_i are m×nm \times n matrices, and AiA_i is a symmetric matrix stored as either upper or lower triangular.

function mublasSsymv

mublasStatus mublasSsymv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const float * A,
mublas_int lda,
const float * x,
mublas_int incx,
const float * beta,
float * y,
mublas_int incy
)

function mublasDsymv

mublasStatus mublasDsymv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const double * A,
mublas_int lda,
const double * x,
mublas_int incx,
const double * beta,
double * y,
mublas_int incy
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether the upper or lower part of AA is referenced:
    • MUBLAS_FILL_MODE_UPPER: the lower part of AA is not referenced
    • MUBLAS_FILL_MODE_LOWER: the upper part of AA is not referenced
  • n [mublas_int] the number of elements in vector xx and yy.
  • alpha scalar α\alpha.
  • A pointer storing matrix AA on the GPU. AA is an n×nn \times n symmetric matrix, stored either as upper or lower triangular.
  • lda [mublas_int] specifies the leading dimension of AA.
  • x pointer storing vector xx on the GPU.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • beta scalar β\beta.
  • y pointer storing vector yy on the GPU.
  • incy [mublas_int] specifies the increment for the elements of yy.

Operation

The symv function performs the matrix-vector operation:

y:=αAx+βyy := \alpha A x + \beta y

where α\alpha and β\beta are scalars, xx and yy are nn-element vectors, and AA is a symmetric n×nn \times n matrix, stored in either upper or lower triangular form.

function mublasSsyr

mublasStatus mublasSsyr(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const float * x,
mublas_int incx,
float * A,
mublas_int lda
)

function mublasDsyr

mublasStatus mublasDsyr(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const double * x,
mublas_int incx,
double * A,
mublas_int lda
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether the upper or lower part of AA is referenced:
    • MUBLAS_FILL_MODE_UPPER: the lower part of AA is not referenced
    • MUBLAS_FILL_MODE_LOWER: the upper part of AA is not referenced
  • n [mublas_int] the number of rows and columns of matrix AA.
  • alpha device pointer or host pointer to scalar α\alpha.
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • A device pointer storing matrix AA.
  • lda [mublas_int] specifies the leading dimension of AA.

Operation

The syr function performs the matrix-vector operation:

A:=A+αxxTA := A + \alpha x x^T

where α\alpha is a scalar, xx is a vector, and AA is an n×nn \times n symmetric matrix.

function mublasSsyr2

mublasStatus mublasSsyr2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const float * alpha,
const float * x,
mublas_int incx,
const float * y,
mublas_int incy,
float * A,
mublas_int lda
)

function mublasDsyr2

mublasStatus mublasDsyr2(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublas_int n,
const double * alpha,
const double * x,
mublas_int incx,
const double * y,
mublas_int incy,
double * A,
mublas_int lda
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether the upper or lower part of AA is referenced:
    • MUBLAS_FILL_MODE_UPPER: the lower part of AA is not referenced
    • MUBLAS_FILL_MODE_LOWER: the upper part of AA is not referenced
  • n [mublas_int] the number of rows and columns of matrix AA.
  • alpha device pointer or host pointer to scalar α\alpha.
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.
  • y device pointer storing vector yy.
  • incy [mublas_int] specifies the increment for the elements of yy.
  • A device pointer storing matrix AA.
  • lda [mublas_int] specifies the leading dimension of AA.

Operation

The syr2 function performs the matrix-vector operation:

A:=A+αxyT+αyxTA := A + \alpha x y^T + \alpha y x^T

where α\alpha is a scalar, xx and yy are vectors, and AA is an n×nn \times n symmetric matrix.

function mublasCsyr2k

mublasStatus mublasCsyr2k(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * B,
mublas_int ldb,
const muComplex * beta,
muComplex * C,
mublas_int ldc
)

function mublasSsyr2k

mublasStatus mublasSsyr2k(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublas_int n,
mublas_int k,
const float * alpha,
const float * A,
mublas_int lda,
const float * B,
mublas_int ldb,
const float * beta,
float * C,
mublas_int ldc
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix CC is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: CC is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: CC is a lower triangular matrix
  • trans [mublasOperation_t] specifies the operation on matrices AA and BB:
    • MUBLAS_OP_T: op(A)=ATop(A) = A^T, op(B)=BTop(B) = B^T
    • MUBLAS_OP_N: op(A)=Aop(A) = A, op(B)=Bop(B) = B
  • n [mublas_int] specifies the number of rows and columns of CC. n0n \geq 0.
  • k [mublas_int] specifies the number of columns of op(A)op(A) and op(B)op(B). k0k \geq 0.
  • alpha specifies the scalar α\alpha. When α\alpha is zero, AA and BB are not referenced.
  • A pointer to matrix AA on the GPU. Matrix dimension is (lda,k)(\text{lda}, k) if trans=MUBLASOPNtrans = MUBLAS_OP_N, otherwise (lda,n)(\text{lda}, n). Only the upper/lower triangular part of AA is accessed.
  • lda [mublas_int] specifies the first dimension of AA. If trans=MUBLASOPNtrans = MUBLAS_OP_N, ldamax(1,n)\text{lda} \geq \max(1, n), otherwise ldamax(1,k)\text{lda} \geq \max(1, k).
  • B pointer to matrix BB on the GPU. Matrix dimension is (ldb,k)(\text{ldb}, k) if trans=MUBLASOPNtrans = MUBLAS_OP_N, otherwise (ldb,n)(\text{ldb}, n). Only the upper/lower triangular part of BB is accessed.
  • ldb [mublas_int] specifies the first dimension of BB. If trans=MUBLASOPNtrans = MUBLAS_OP_N, ldbmax(1,n)\text{ldb} \geq \max(1, n), otherwise ldbmax(1,k)\text{ldb} \geq \max(1, k).
  • beta specifies the scalar β\beta. When β\beta is zero, CC need not be set before entry.
  • C pointer to matrix CC on the GPU.
  • ldc [mublas_int] specifies the first dimension of CC. ldcmax(1,n)\text{ldc} \geq \max(1, n).

Operation

The syr2k function performs the symmetric rank-2k update:

C:=α(op(A)op(B)T+op(B)op(A)T)+βCC := \alpha ( op(A) \cdot op(B)^T + op(B) \cdot op(A)^T ) + \beta C

where α\alpha and β\beta are scalars, op(A)op(A) and op(B)op(B) are n×kn \times k matrices, and CC is an n×nn \times n symmetric matrix stored as either upper or lower triangular.

The operation can be either:

  • op(A)=Aop(A) = A, op(B)=Bop(B) = B when trans=MUBLAS_OP_Ntrans = \text{MUBLAS\_OP\_N}
  • op(A)=ATop(A) = A^T, op(B)=BTop(B) = B^T when trans = \text{MUBLAS_OP_T}

function mublasCsyrk

mublasStatus mublasCsyrk(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * beta,
muComplex * C,
mublas_int ldc
)

function mublasSsyrk

mublasStatus mublasSsyrk(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const float * alpha,
const float * A,
mublas_int lda,
const float * beta,
float * C,
mublas_int ldc
)

function mublasDsyrk

mublasStatus mublasDsyrk(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const double * alpha,
const double * A,
mublas_int lda,
const double * beta,
double * C,
mublas_int ldc
)

function mublasZsyrk

mublasStatus mublasZsyrk(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
const muDoubleComplex * beta,
muDoubleComplex * C,
mublas_int ldc
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix CC is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: CC is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: CC is a lower triangular matrix
  • transA [mublasOperation_t] specifies the operation on matrix AA:
    • MUBLAS_OP_T: op(A)=ATop(A) = A^T
    • MUBLAS_OP_N: op(A)=Aop(A) = A
    • MUBLAS_OP_C: op(A)=ATop(A) = A^T
  • n [mublas_int] specifies the number of rows and columns of CC. n0n \geq 0.
  • k [mublas_int] specifies the number of columns of op(A)op(A). k0k \geq 0.
  • alpha specifies the scalar α\alpha. When α\alpha is zero, AA is not referenced and need not be set before entry.
  • A pointer to matrix AA on the GPU. Matrix dimension is (lda,k)(\text{lda}, k) if transA=MUBLASOPNtransA = MUBLAS_OP_N, otherwise (lda,n)(\text{lda}, n). Only the upper/lower triangular part of AA is accessed.
  • lda [mublas_int] specifies the first dimension of AA. If transA=MUBLASOPNtransA = MUBLAS_OP_N, ldamax(1,n)\text{lda} \geq \max(1, n), otherwise ldamax(1,k)\text{lda} \geq \max(1, k).
  • beta specifies the scalar β\beta. When β\beta is zero, CC need not be set before entry.
  • C pointer to matrix CC on the GPU.
  • ldc [mublas_int] specifies the first dimension of CC. ldcmax(1,n)\text{ldc} \geq \max(1, n).

Operation

The syrk function performs the symmetric rank-k update:

C:=αop(A)op(A)T+βCC := \alpha \cdot op(A) \cdot op(A)^T + \beta \cdot C

where α\alpha and β\beta are scalars, op(A)op(A) is an n×kn \times k matrix, and CC is a symmetric n×nn \times n matrix stored as either upper or lower triangular.

The operation can be either:

  • op(A)=Aop(A) = A, and AA is n×kn \times k if transA = \text{MUBLAS_OP_N}
  • op(A)=ATop(A) = A^T, and AA is k×nk \times n if transA = \text{MUBLAS_OP_T}

Note: MUBLAS_OP_C is not supported for complex types. See cherk and zherk.

function mublasCsyrkStridedBatched

mublasStatus mublasCsyrkStridedBatched(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
mublas_stride stride_A,
const muComplex * beta,
muComplex * C,
mublas_int ldc,
mublas_stride stride_C,
mublas_int batch_count
)

function mublasSsyrkStridedBatched

mublasStatus mublasSsyrkStridedBatched(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublas_int n,
mublas_int k,
const float * alpha,
const float * A,
mublas_int lda,
mublas_stride stride_A,
const float * beta,
float * C,
mublas_int ldc,
mublas_stride stride_C,
mublas_int batch_count
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix CiC_i is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: CiC_i is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: CiC_i is a lower triangular matrix
  • transA [mublasOperation_t] specifies the operation on matrix AiA_i:
    • MUBLAS_OP_T: op(Ai)=AiTop(A_i) = A_i^T
    • MUBLAS_OP_N: op(Ai)=Aiop(A_i) = A_i
    • MUBLAS_OP_C: op(Ai)=AiTop(A_i) = A_i^T
  • n [mublas_int] specifies the number of rows and columns of CiC_i. n0n \geq 0.
  • k [mublas_int] specifies the number of columns of op(Ai)op(A_i). k0k \geq 0.
  • alpha specifies the scalar α\alpha. When α\alpha is zero, AiA_i is not referenced and need not be set before entry.
  • A pointer to the first matrix A1A_1 on the GPU. The matrix dimension is (lda,k)(\text{lda}, k) if transA=MUBLASOPNtransA = MUBLAS_OP_N, otherwise (lda,n)(\text{lda}, n).
  • lda [mublas_int] specifies the first dimension of AiA_i. If transA=MUBLASOPNtransA = MUBLAS_OP_N, ldamax(1,n)\text{lda} \geq \max(1, n), otherwise ldamax(1,k)\text{lda} \geq \max(1, k).
  • stride_A [mublas_stride] stride from the start of one matrix (AiA_i) and the next one (Ai+1A_{i+1}).
  • beta specifies the scalar β\beta. When β\beta is zero, CiC_i need not be set before entry.
  • C pointer to the first matrix C1C_1 on the GPU.
  • ldc [mublas_int] specifies the first dimension of CC. ldcmax(1,n)\text{ldc} \geq \max(1, n).
  • stride_C [mublas_stride] stride from the start of one matrix (CiC_i) and the next one (Ci+1C_{i+1}).
  • batch_count [mublas_int] number of instances in the batch.

Operation

The syrk_strided_batched function performs a batch of the matrix-matrix operations for a symmetric rank-k update:

Ci:=αop(Ai)op(Ai)T+βCiC_i := \alpha \cdot op(A_i) \cdot op(A_i)^T + \beta \cdot C_i

where α\alpha and β\beta are scalars, op(Ai)op(A_i) is an n×kn \times k matrix, and CiC_i is a symmetric n×nn \times n matrix stored as either upper or lower triangular.

The operation can be either:

  • op(Ai)=Aiop(A_i) = A_i, and AiA_i is n×kn \times k if transA = \text{MUBLAS_OP_N}
  • op(Ai)=AiTop(A_i) = A_i^T, and AiA_i is k×nk \times n if transA = \text{MUBLAS_OP_T}

Note: MUBLAS_OP_C is not supported for complex types. See cherk and zherk.

function mublasCsyrkx

mublasStatus mublasCsyrkx(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
const muComplex * B,
mublas_int ldb,
const muComplex * beta,
muComplex * C,
mublas_int ldc
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix CC is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: CC is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: CC is a lower triangular matrix
  • trans [mublasOperation_t] specifies the operation on matrices AA and BB:
    • MUBLAS_OP_T: op(A)=ATop(A) = A^T, op(B)=BTop(B) = B^T
    • MUBLAS_OP_N: op(A)=Aop(A) = A, op(B)=Bop(B) = B
  • n [mublas_int] specifies the number of rows and columns of CC. n0n \geq 0.
  • k [mublas_int] specifies the number of columns of op(A)op(A) and op(B)op(B). k0k \geq 0.
  • alpha specifies the scalar α\alpha. When α\alpha is zero, AA is not referenced and need not be set before entry.
  • A pointer to matrix AA on the GPU. Matrix dimension is (lda,k)(\text{lda}, k) if trans=MUBLASOPNtrans = MUBLAS_OP_N, otherwise (lda,n)(\text{lda}, n).
  • lda [mublas_int] specifies the first dimension of AA. If trans=MUBLASOPNtrans = MUBLAS_OP_N, ldamax(1,n)\text{lda} \geq \max(1, n), otherwise ldamax(1,k)\text{lda} \geq \max(1, k).
  • B pointer to matrix BB on the GPU. Matrix dimension is (ldb,k)(\text{ldb}, k) if trans=MUBLASOPNtrans = MUBLAS_OP_N, otherwise (ldb,n)(\text{ldb}, n).
  • ldb [mublas_int] specifies the first dimension of BB. If trans=MUBLASOPNtrans = MUBLAS_OP_N, ldbmax(1,n)\text{ldb} \geq \max(1, n), otherwise ldbmax(1,k)\text{ldb} \geq \max(1, k).
  • beta specifies the scalar β\beta. When β\beta is zero, CC need not be set before entry.
  • C pointer to matrix CC on the GPU.
  • ldc [mublas_int] specifies the first dimension of CC. ldcmax(1,n)\text{ldc} \geq \max(1, n).

Operation

The syrkx function performs a matrix-matrix operation for a symmetric rank-k update:

C:=αop(A)op(B)T+βCC := \alpha \cdot op(A) \cdot op(B)^T + \beta \cdot C

where α\alpha and β\beta are scalars, op(A)op(A) and op(B)op(B) are n×kn \times k matrices, and CC is a symmetric n×nn \times n matrix stored as either upper or lower triangular.

The operation can be either:

  • op(A)=Aop(A) = A, op(B)=Bop(B) = B, and AA and BB are n×kn \times k if trans=MUBLAS_OP_Ntrans = \text{MUBLAS\_OP\_N}
  • op(A)=ATop(A) = A^T, op(B)=BTop(B) = B^T, and AA and BB are k×nk \times n if trans=MUBLAS_OP_Ttrans = MUBLAS\_OP\_T

This routine should only be used when the result of op(A)op(B)Top(A) \cdot op(B)^T is guaranteed to be symmetric.

function mublasCsyrkxStridedBatched

mublasStatus mublasCsyrkxStridedBatched(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublas_int n,
mublas_int k,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
mublas_stride stride_A,
const muComplex * B,
mublas_int ldb,
mublas_stride stride_B,
const muComplex * beta,
muComplex * C,
mublas_int ldc,
mublas_stride stride_C,
mublas_int batch_count
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix CiC_i is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: CiC_i is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: CiC_i is a lower triangular matrix
  • trans [mublasOperation_t] specifies the operation on matrices AiA_i and BiB_i:
    • MUBLAS_OP_T: op(Ai)=AiTop(A_i) = A_i^T, op(Bi)=BiTop(B_i) = B_i^T
    • MUBLAS_OP_N: op(Ai)=Aiop(A_i) = A_i, op(Bi)=Biop(B_i) = B_i
  • n [mublas_int] specifies the number of rows and columns of CiC_i. n0n \geq 0.
  • k [mublas_int] specifies the number of columns of op(Ai)op(A_i). k0k \geq 0.
  • alpha specifies the scalar α\alpha. When α\alpha is zero, AiA_i is not referenced and need not be set before entry.
  • A pointer to matrix A1A_1 on the GPU. Matrix dimension is (lda,k)(\text{lda}, k) if trans=MUBLAS_OP_Ntrans = \text{MUBLAS\_OP\_N}, otherwise (lda,n)(\text{lda}, n).
  • lda [mublas_int] specifies the first dimension of AiA_i. If trans=MUBLAS_OP_Ntrans = \text{MUBLAS\_OP\_N}, ldamax(1,n)\text{lda} \geq \max(1, n), otherwise ldamax(1,k)\text{lda} \geq \max(1, k).
  • stride_A [mublas_stride] specifies the stride from the start of one matrix (AiA_i) to the next one (Ai+1A_{i+1}).
  • B pointer to matrix B1B_1 on the GPU. Matrix dimension is (ldb,k)(\text{ldb}, k) if trans=MUBLAS_OP_Ntrans = \text{MUBLAS\_OP\_N}, otherwise (ldb,n)(\text{ldb}, n).
  • ldb [mublas_int] specifies the first dimension of BiB_i. If trans=MUBLAS_OP_Ntrans = \text{MUBLAS\_OP\_N}, ldbmax(1,n)\text{ldb} \geq \max(1, n), otherwise ldbmax(1,k)\text{ldb} \geq \max(1, k).
  • stride_B [mublas_stride] specifies the stride from the start of one matrix (BiB_i) to the next one (Bi+1B_{i+1}).
  • beta specifies the scalar β\beta. When β\beta is zero, CiC_i need not be set before entry.
  • C pointer to matrix C1C_1 on the GPU.
  • ldc [mublas_int] specifies the first dimension of CC. ldcmax(1,n)\text{ldc} \geq \max(1, n).
  • stride_C [mublas_stride] specifies the stride from the start of one matrix (CiC_i) to the next one (Ci+1C_{i+1}).
  • batch_count [mublas_int] specifies the number of instances in the batch.

Operation

The syrkx_strided_batched function performs a batch of matrix-matrix operations for a symmetric rank-k update:

Ci:=αop(Ai)op(Bi)T+βCiC_i := \alpha \cdot op(A_i) \cdot op(B_i)^T + \beta \cdot C_i

where α\alpha and β\beta are scalars, op(Ai)op(A_i) and op(Bi)op(B_i) are n×kn \times k matrices, and CiC_i is a symmetric n×nn \times n matrix stored as either upper or lower triangular.

The operation can be either:

  • op(Ai)=Aiop(A_i) = A_i, op(Bi)=Biop(B_i) = B_i, and AiA_i, BiB_i are n×kn \times k if trans=MUBLAS_OP_Ntrans = \text{MUBLAS\_OP\_N}
  • op(Ai)=AiTop(A_i) = A_i^T, op(Bi)=BiTop(B_i) = B_i^T, and AiA_i, BiB_i are k×nk \times n if trans=MUBLAS_OP_Ttrans = \text{MUBLAS\_OP\_T}

This routine should only be used when the result of op(Ai)op(Bi)Top(A_i) \cdot op(B_i)^T is guaranteed to be symmetric.

function mublasStbmv

mublasStatus mublasStbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublasDiagType_t diag,
mublas_int m,
mublas_int k,
const float * A,
mublas_int lda,
float * x,
mublas_int incx
)

function mublasCtbmv

mublasStatus mublasCtbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublasDiagType_t diag,
mublas_int m,
mublas_int k,
const muComplex * A,
mublas_int lda,
muComplex * x,
mublas_int incx
)

function mublasDtbmv

mublasStatus mublasDtbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublasDiagType_t diag,
mublas_int m,
mublas_int k,
const double * A,
mublas_int lda,
double * x,
mublas_int incx
)

function mublasZtbmv

mublasStatus mublasZtbmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t trans,
mublasDiagType_t diag,
mublas_int m,
mublas_int k,
const muDoubleComplex * A,
mublas_int lda,
muDoubleComplex * x,
mublas_int incx
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix AA is stored as upper or lower banded triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper banded triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower banded triangular matrix
  • trans [mublasOperation_t] specifies the operation on matrix AA:
    • MUBLAS_OP_T: op(A)=ATop(A) = A^T
    • MUBLAS_OP_N: op(A)=Aop(A) = A
  • diag [mublasDiagType_t] specifies the type of diagonal of AA:
    • MUBLAS_DIAG_UNIT: The main diagonal of AA is assumed to consist of only 1's and is not referenced
    • MUBLAS_DIAG_NON_UNIT: No assumptions are made about AA's main diagonal
  • m [mublas_int] specifies the number of rows and columns of the matrix represented by AA.
  • k [mublas_int] specifies the number of diagonals of AA:
    • If uplo=MUBLAS_FILL_MODE_UPPERuplo = \text{MUBLAS\_FILL\_MODE\_UPPER}, kk specifies the number of super-diagonals.
    • If uplo=MUBLAS_FILL_MODE_LOWERuplo = \text{MUBLAS\_FILL\_MODE\_LOWER}, kk specifies the number of sub-diagonals.
    • kk must satisfy k>0k > 0 and k<ldak < \text{lda}
  • A device pointer storing the banded triangular matrix AA.
    • If uplo=MUBLAS_FILL_MODE_UPPERuplo = \text{MUBLAS\_FILL\_MODE\_UPPER}, AA represents an upper banded triangular matrix with the main diagonal and kk super-diagonals.
    • If uplo=MUBLAS_FILL_MODE_LOWERuplo = \text{MUBLAS\_FILL\_MODE\_LOWER}, AA represents a lower banded triangular matrix with the main diagonal and kk sub-diagonals.
  • lda [mublas_int] specifies the leading dimension of AA. Must satisfy lda>k\text{lda} > k.
  • x device pointer storing the vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.

Operation

The tbmv function performs one of the following matrix-vector operations:

x:=Axorx:=ATxorx:=AHxx := A \cdot x \quad \text{or} \quad x := A^T \cdot x \quad \text{or} \quad x := A^H \cdot x

where xx is a vector and AA is a banded m×mm \times m matrix.

function mublasStbsv

mublasStatus mublasStbsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
mublas_int k,
const float * A,
mublas_int lda,
float * x,
mublas_int incx
)

function mublasCtbsv

mublasStatus mublasCtbsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
mublas_int k,
const muComplex * A,
mublas_int lda,
muComplex * x,
mublas_int incx
)

function mublasDtbsv

mublasStatus mublasDtbsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
mublas_int k,
const double * A,
mublas_int lda,
double * x,
mublas_int incx
)

function mublasZtbsv

mublasStatus mublasZtbsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
mublas_int k,
const muDoubleComplex * A,
mublas_int lda,
muDoubleComplex * x,
mublas_int incx
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix AA is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • transA [mublasOperation_t] specifies the operation on matrix AA:
    • MUBLAS_OP_N: Solves Ax=bA \cdot x = b
    • MUBLAS_OP_T: Solves ATx=bA^T \cdot x = b
    • MUBLAS_OP_C: Solves AHx=bA^H \cdot x = b
  • diag [mublasDiagType_t] specifies the type of diagonal of AA:
    • MUBLAS_DIAG_UNIT: AA is assumed to be unit triangular (i.e., the diagonal elements of AA are not used in computations)
    • MUBLAS_DIAG_NON_UNIT: AA is not assumed to be unit triangular
  • n [mublas_int] specifies the number of rows of bb. n0n \geq 0.
  • k [mublas_int] specifies the number of diagonals of AA:
    • If uplo=MUBLAS_FILL_MODE_UPPERuplo = \text{MUBLAS\_FILL\_MODE\_UPPER}, kk specifies the number of super-diagonals of AA.
    • If uplo=MUBLAS_FILL_MODE_LOWERuplo = \text{MUBLAS\_FILL\_MODE\_LOWER}, kk specifies the number of sub-diagonals of AA.
    • k0k \geq 0
  • A device pointer storing the matrix AA in banded format.
  • lda [mublas_int] specifies the leading dimension of AA. lda(k+1)\text{lda} \geq (k + 1).
  • x device pointer storing input vector bb. Overwritten by the output vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.

Operation

The tbsv function solves the following systems of equations:

Ax=borATx=borAHx=bA \cdot x = b \quad \text{or} \quad A^T \cdot x = b \quad \text{or} \quad A^H \cdot x = b

where xx and bb are vectors, and AA is a banded triangular matrix.

function mublasCtpmv

mublasStatus mublasCtpmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const muComplex * A,
muComplex * x,
mublas_int incx
)

function mublasStpmv

mublasStatus mublasStpmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const float * A,
float * x,
mublas_int incx
)

function mublasDtpmv

mublasStatus mublasDtpmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const double * A,
double * x,
mublas_int incx
)

function mublasZtpmv

mublasStatus mublasZtpmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const muDoubleComplex * A,
muDoubleComplex * x,
mublas_int incx
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix AA is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • transA [mublasOperation_t] specifies the operation on matrix AA:
    • MUBLAS_OP_N: Solves AxA \cdot x
    • MUBLAS_OP_T: Solves ATxA^T \cdot x
  • diag [mublasDiagType_t] specifies the type of diagonal of AA:
    • MUBLAS_DIAG_UNIT: AA is assumed to be unit triangular (i.e., the diagonal elements of AA are not used in computations)
    • MUBLAS_DIAG_NON_UNIT: AA is not assumed to be unit triangular
  • m [mublas_int] specifies the number of rows of AA. m0m \geq 0.
  • A device pointer storing the matrix AA. The matrix is stored in packed form:
    • If uplo=MUBLAS_FILL_MODE_UPPERuplo = \text{MUBLAS\_FILL\_MODE\_UPPER}, the array AA contains the upper triangular matrix packed sequentially, column by column.
    • If uplo=MUBLAS_FILL_MODE_LOWERuplo = \text{MUBLAS\_FILL\_MODE\_LOWER}, the array AA contains the lower triangular matrix packed sequentially, column by column.
    • When diag=MUBLAS_DIAG_UNITdiag = \text{MUBLAS\_DIAG\_UNIT}, the diagonal elements of AA are not referenced, but are assumed to be unity.
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx. incx\text{incx} must not be zero.

Operation

The tpmv function performs the following matrix-vector operation:

x=Axorx=ATxx = A \cdot x \quad \text{or} \quad x = A^T \cdot x

where xx is an nn-element vector, and AA is an n×nn \times n unit or non-unit upper or lower triangular matrix, supplied in packed form.

The vector xx is overwritten.

function mublasCtpsv

mublasStatus mublasCtpsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
const muComplex * AP,
muComplex * x,
mublas_int incx
)

function mublasStpsv

mublasStatus mublasStpsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
const float * AP,
float * x,
mublas_int incx
)

function mublasDtpsv

mublasStatus mublasDtpsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
const double * AP,
double * x,
mublas_int incx
)

function mublasZtpsv

mublasStatus mublasZtpsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int n,
const muDoubleComplex * AP,
muDoubleComplex * x,
mublas_int incx
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix AA is stored as upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • transA [mublasOperation_t] specifies the operation on matrix AA:
    • MUBLAS_OP_N: Solves Ax=bA \cdot x = b
    • MUBLAS_OP_T: Solves ATx=bA^T \cdot x = b
    • MUBLAS_OP_C: Solves AHx=bA^H \cdot x = b
  • diag [mublasDiagType_t] specifies the type of diagonal of AA:
    • MUBLAS_DIAG_UNIT: AA is assumed to be unit triangular (i.e., the diagonal elements of AA are not used in computations)
    • MUBLAS_DIAG_NON_UNIT: AA is not assumed to be unit triangular
  • n [mublas_int] specifies the number of rows of bb. n0n \geq 0.
  • AP device pointer storing the packed version of matrix AA, with dimension n(n+1)2\geq \frac{n \cdot (n + 1)}{2}.
  • x device pointer storing vector bb on input, overwritten by xx on output.
  • incx [mublas_int] specifies the increment for the elements of xx.

Operation

The tpsv function performs the following matrix-vector operation:

Ax=borATx=borAHx=bA \cdot x = b \quad \text{or} \quad A^T \cdot x = b \quad \text{or} \quad A^H \cdot x = b

where xx and bb are vectors, and AA is a triangular matrix stored in packed format.

The input vector bb is overwritten by the output vector xx.

function mublasCtrmm

mublasStatus mublasCtrmm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
muComplex * B,
mublas_int ldb
)

function mublasStrmm

mublasStatus mublasStrmm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const float * alpha,
const float * A,
mublas_int lda,
float * B,
mublas_int ldb
)

function mublasDtrmm

mublasStatus mublasDtrmm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const double * alpha,
const double * A,
mublas_int lda,
double * B,
mublas_int ldb
)

function mublasZtrmm

mublasStatus mublasZtrmm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
muDoubleComplex * B,
mublas_int ldb
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • side [mublasSideMode_t] specifies whether op(AA) multiplies BB from the left or right:
    • MUBLAS_SIDE_LEFT: B:=αop(A)BB := \alpha \cdot \text{op}( A ) \cdot B
    • MUBLAS_SIDE_RIGHT: B:=αBop(A)B := \alpha \cdot B \cdot \text{op}( A )
  • uplo [mublasFillMode_t] specifies whether matrix AA is upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • transA [mublasOperation_t] specifies the form of op(A)\text{op}(A) to be used in the matrix multiplication:
    • MUBLAS_OP_N: op(A)=A\text{op}(A) = A
    • MUBLAS_OP_T: op(A)=AT\text{op}(A) = A^T
    • MUBLAS_OP_C: op(A)=AH\text{op}(A) = A^H
  • diag [mublasDiagType_t] specifies whether or not AA is unit triangular:
    • MUBLAS_DIAG_UNIT: AA is assumed to be unit triangular
    • MUBLAS_DIAG_NON_UNIT: AA is not assumed to be unit triangular
  • m [mublas_int] specifies the number of rows of BB. m0m \geq 0.
  • n [mublas_int] specifies the number of columns of BB. n0n \geq 0.
  • alpha specifies the scalar α\alpha. When α=0\alpha = 0, AA is not referenced, and BB need not be set before entry.
  • A device pointer to matrix AA on the GPU. AA has dimension (lda,k)(\text{lda}, k), where kk is mm when side=MUBLAS_SIDE_LEFT\text{side} = \text{MUBLAS\_SIDE\_LEFT} and kk is nn when side=MUBLAS_SIDE_RIGHT\text{side} = \text{MUBLAS\_SIDE\_RIGHT}.
  • lda [mublas_int] specifies the first dimension of AA. If side=MUBLAS_SIDE_LEFT\text{side} = \text{MUBLAS\_SIDE\_LEFT}, ldamax(1,m)\text{lda} \geq \max( 1, m ), if side=MUBLAS_SIDE_RIGHT\text{side} = \text{MUBLAS\_SIDE\_RIGHT}, ldamax(1,n)\text{lda} \geq \max( 1, n ).
  • B device pointer to the first matrix B0B_0 on the GPU. On entry, the leading m×nm \times n part of the array BB must contain the matrix BB, and on exit, it is overwritten by the transformed matrix.
  • ldb [mublas_int] specifies the first dimension of BB. ldbmax(1,m)\text{ldb} \geq \max( 1, m ).

Operation

The trmm function performs one of the matrix-matrix operations:

B:=αop(A)BorB:=αBop(A)B := \alpha \cdot \text{op}( A ) \cdot B \quad \text{or} \quad B := \alpha \cdot B \cdot \text{op}( A )

where α\alpha is a scalar, BB is an m×nm \times n matrix, AA is a unit or non-unit upper or lower triangular matrix, and op(A)\text{op}( A ) is one of:

op(A)=Aorop(A)=ATorop(A)=AH\text{op}( A ) = A \quad \text{or} \quad \text{op}( A ) = A^T \quad \text{or} \quad \text{op}( A ) = A^H

  • When uplo=MUBLAS_FILL_MODE_UPPER\text{uplo} = \text{MUBLAS\_FILL\_MODE\_UPPER}, the leading k×kk \times k upper triangular part of the array AA must contain the upper triangular matrix, and the strictly lower triangular part of AA is not referenced. Here, kk is mm when side=MUBLAS_SIDE_LEFT\text{side} = \text{MUBLAS\_SIDE\_LEFT} and kk is nn when side=MUBLAS_SIDE_RIGHT\text{side} = \text{MUBLAS\_SIDE\_RIGHT}.
  • When uplo=MUBLAS_FILL_MODE_LOWER\text{uplo} = \text{MUBLAS\_FILL\_MODE\_LOWER}, the leading k×kk \times k lower triangular part of the array AA must contain the lower triangular matrix, and the strictly upper triangular part of AA is not referenced. Here, kk is mm when side=MUBLAS_SIDE_LEFT\text{side} = \text{MUBLAS\_SIDE\_LEFT} and kk is nn when side=MUBLAS_SIDE_RIGHT\text{side} = \text{MUBLAS\_SIDE\_RIGHT}.

Note that when diag=MUBLAS_DIAG_UNIT\text{diag} = \text{MUBLAS\_DIAG\_UNIT}, the diagonal elements of AA are not referenced and are assumed to be unity.

function mublasCtrmmStridedBatched

mublasStatus mublasCtrmmStridedBatched(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
mublas_stride stride_A,
muComplex * B,
mublas_int ldb,
mublas_stride stride_B,
mublas_int batch_count
)

function mublasStrmmStridedBatched

mublasStatus mublasStrmmStridedBatched(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const float * alpha,
const float * A,
mublas_int lda,
mublas_stride stride_A,
float * B,
mublas_int ldb,
mublas_stride stride_B,
mublas_int batch_count
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • side [mublasSideMode_t] specifies whether op(AiA_i) multiplies BiB_i from the left or right:
    • MUBLAS_SIDE_LEFT: Bi:=αop(Ai)BiB_i := \alpha \cdot \text{op}( A_i ) \cdot B_i
    • MUBLAS_SIDE_RIGHT: Bi:=αBiop(Ai)B_i := \alpha \cdot B_i \cdot \text{op}( A_i )
  • uplo [mublasFillMode_t] specifies whether matrix AA is upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • transA [mublasOperation_t] specifies the form of op(Ai)\text{op}(A_i) to be used in the matrix multiplication:
    • MUBLAS_OP_N: op(Ai)=Ai\text{op}(A_i) = A_i
    • MUBLAS_OP_T: op(Ai)=AiT\text{op}(A_i) = A_i^T
    • MUBLAS_OP_C: op(Ai)=AiH\text{op}(A_i) = A_i^H
  • diag [mublasDiagType_t] specifies whether or not AiA_i is unit triangular:
    • MUBLAS_DIAG_UNIT: AiA_i is assumed to be unit triangular
    • MUBLAS_DIAG_NON_UNIT: AiA_i is not assumed to be unit triangular
  • m [mublas_int] specifies the number of rows of BiB_i. m0m \geq 0.
  • n [mublas_int] specifies the number of columns of BiB_i. n0n \geq 0.
  • alpha specifies the scalar α\alpha. When α=0\alpha = 0, AiA_i is not referenced, and BiB_i need not be set before entry.
  • A device pointer to the first matrix A0A_0 on the GPU. Each AiA_i is of dimension (lda,k)(\text{lda}, k), where kk is mm when side=MUBLAS_SIDE_LEFT\text{side} = \text{MUBLAS\_SIDE\_LEFT} and kk is nn when side=MUBLAS_SIDE_RIGHT\text{side} = \text{MUBLAS\_SIDE\_RIGHT}.
  • lda [mublas_int] specifies the first dimension of AA. If side=MUBLAS_SIDE_LEFT\text{side} = \text{MUBLAS\_SIDE\_LEFT}, ldamax(1,m)\text{lda} \geq \max( 1, m ), if side=MUBLAS_SIDE_RIGHT\text{side} = \text{MUBLAS\_SIDE\_RIGHT}, ldamax(1,n)\text{lda} \geq \max( 1, n ).
  • stride_A [mublas_stride] stride from the start of one matrix (AiA_i) to the next one (Ai+1A_{i+1}).
  • B device pointer to the first matrix B0B_0 on the GPU. On entry, the leading m×nm \times n part of the array BiB_i must contain the matrix BiB_i, and on exit, it is overwritten by the transformed matrix.
  • ldb [mublas_int] specifies the first dimension of BiB_i. ldbmax(1,m)\text{ldb} \geq \max( 1, m ).
  • stride_B [mublas_stride] stride from the start of one matrix (BiB_i) to the next one (Bi+1B_{i+1}).
  • batch_count [mublas_int] specifies the number of instances ii in the batch.

Operation

The trmm_strided_batched function performs one of the strided-batched matrix-matrix operations:

B_i := \alpha \cdot \text{op}( A_i ) \cdot B_i \quad \text{or} \quad B_i := \alpha \cdot B_i \cdot \text{op}( A_i ) \quad \text{for} \quad i = 0, 1, \dots, \text{batch_count} - 1

where α\alpha is a scalar, BiB_i is an m×nm \times n matrix, AiA_i is a unit or non-unit upper or lower triangular matrix, and op(Ai)\text{op}( A_i ) is one of:

op(Ai)=Aiorop(Ai)=AiTorop(Ai)=AiH\text{op}( A_i ) = A_i \quad \text{or} \quad \text{op}( A_i ) = A_i^T \quad \text{or} \quad \text{op}( A_i ) = A_i^H

  • When uplo=MUBLAS_FILL_MODE_UPPER\text{uplo} = \text{MUBLAS\_FILL\_MODE\_UPPER}, the leading k×kk \times k upper triangular part of the array AA must contain the upper triangular matrix, and the strictly lower triangular part of AA is not referenced.
  • When uplo=MUBLAS_FILL_MODE_LOWER\text{uplo} = \text{MUBLAS\_FILL\_MODE\_LOWER}, the leading k×kk \times k lower triangular part of the array AA must contain the lower triangular matrix, and the strictly upper triangular part of AA is not referenced.

Note that when diag=MUBLAS_DIAG_UNIT\text{diag} = \text{MUBLAS\_DIAG\_UNIT}, the diagonal elements of AiA_i are not referenced and are assumed to be unity.

function mublasStrmv

mublasStatus mublasStrmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const float * A,
mublas_int lda,
float * x,
mublas_int incx
)

function mublasCtrmv

mublasStatus mublasCtrmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const muComplex * A,
mublas_int lda,
muComplex * x,
mublas_int incx
)

function mublasDtrmv

mublasStatus mublasDtrmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const double * A,
mublas_int lda,
double * x,
mublas_int incx
)

function mublasZtrmv

mublasStatus mublasZtrmv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const muDoubleComplex * A,
mublas_int lda,
muDoubleComplex * x,
mublas_int incx
)

#### BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix AA is upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • transA [mublasOperation_t] specifies the form of op(A)\text{op}(A) to be used in the matrix-vector operation:
    • MUBLAS_OP_N: op(A)=A\text{op}(A) = A
    • MUBLAS_OP_T: op(A)=AT\text{op}(A) = A^T
    • MUBLAS_OP_C: op(A)=AH\text{op}(A) = A^H
  • diag [mublasDiagType_t] specifies whether or not AA is unit triangular:
    • MUBLAS_DIAG_UNIT: AA is assumed to be unit triangular
    • MUBLAS_DIAG_NON_UNIT: AA is not assumed to be unit triangular
  • m [mublas_int] specifies the number of rows of AA. m0m \geq 0.
  • A device pointer storing matrix AA, of dimension (lda,m)(\text{lda}, m).
  • lda [mublas_int] specifies the leading dimension of AA. lda=max(1,m)\text{lda} = \max( 1, m ).
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.

trmv performs one of the matrix-vector operations:

x=Axorx=ATx,x = A \cdot x \quad \text{or} \quad x = A^T \cdot x,

where xx is an nn-element vector and AA is an n×nn \times n unit, or non-unit, upper or lower triangular matrix.

The vector xx is overwritten.

function mublasCtrsm

mublasStatus mublasCtrsm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const muComplex * alpha,
const muComplex * A,
mublas_int lda,
muComplex * B,
mublas_int ldb
)

function mublasStrsm

mublasStatus mublasStrsm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const float * alpha,
const float * A,
mublas_int lda,
float * B,
mublas_int ldb
)

function mublasDtrsm

mublasStatus mublasDtrsm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const double * alpha,
const double * A,
mublas_int lda,
double * B,
mublas_int ldb
)

function mublasZtrsm

mublasStatus mublasZtrsm(
mublasHandle_t handle,
mublasSideMode_t side,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
mublas_int n,
const muDoubleComplex * alpha,
const muDoubleComplex * A,
mublas_int lda,
muDoubleComplex * B,
mublas_int ldb
)

BLAS Level 3 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • side [mublasSideMode_t] MUBLAS_SIDE_LEFT: op(A)X=αBop(A) \cdot X = \alpha \cdot B. MUBLAS_SIDE_RIGHT: Xop(A)=αBX \cdot op(A) = \alpha \cdot B.
  • uplo [mublasFillMode_t] MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix. MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix.
  • transA [mublasOperation_t] MUBLAS_OP_N: op(A)=Aop(A) = A. MUBLAS_OP_T: op(A)=ATop(A) = A^T. MUBLAS_OP_C: op(A)=AHop(A) = A^H.
  • diag [mublasDiagType_t] MUBLAS_DIAG_UNIT: AA is assumed to be unit triangular. MUBLAS_DIAG_NON_UNIT: AA is not assumed to be unit triangular.
  • m [mublas_int] mm specifies the number of rows of BB. m0m \geq 0.
  • n [mublas_int] nn specifies the number of columns of BB. n0n \geq 0.
  • alpha device pointer or host pointer specifying the scalar α\alpha. When α\alpha is zero then AA is not referenced and BB need not be set before entry.
  • A device pointer storing matrix AA, of dimension (lda\text{lda}, kk), where kk is mm when MUBLAS_SIDE_LEFT and is nn when MUBLAS_SIDE_RIGHT. Only the upper/lower triangular part is accessed.
  • lda [mublas_int] lda\text{lda} specifies the first dimension of AA. If side = MUBLAS_SIDE_LEFT, ldamax(1,m)\text{lda} \geq \max( 1, m ), if side = MUBLAS_SIDE_RIGHT, ldamax(1,n)\text{lda} \geq \max( 1, n ).
  • B device pointer storing matrix BB.
  • ldb [mublas_int] ldb\text{ldb} specifies the first dimension of BB. ldbmax(1,m)\text{ldb} \geq \max( 1, m ).

trsm solves one of the following matrix equations:

op(A)X=αBorXop(A)=αB,op(A) \cdot X = \alpha \cdot B \quad \text{or} \quad X \cdot op(A) = \alpha \cdot B,

where α\alpha is a scalar, XX and BB are m×nm \times n matrices, AA is a triangular matrix and op(A)op(A) is one of:

op(A)=Aorop(A)=ATorop(A)=AH.op(A) = A \quad \text{or} \quad op(A) = A^T \quad \text{or} \quad op(A) = A^H.

The matrix XX is overwritten on BB.

Note about memory allocation: When trsm is launched with a kk evenly divisible by the internal block size of 128, and is no larger than 10 of these blocks, the API takes advantage of utilizing pre-allocated memory found in the handle to increase overall performance. This memory can be managed by using the environment variable WORKBUF_TRSM_B_CHNK. When this variable is not set, the device memory used for temporary storage will default to 1 MB and may result in chunking, which in turn may reduce performance. Under these circumstances, it is recommended that WORKBUF_TRSM_B_CHNK be set to the desired chunk of right-hand sides to be used at a time.

(where kk is mm when MUBLAS_SIDE_LEFT and is nn when MUBLAS_SIDE_RIGHT)

function mublasStrsv

mublasStatus mublasStrsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const float * A,
mublas_int lda,
float * x,
mublas_int incx
)

function mublasDtrsv

mublasStatus mublasDtrsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const double * A,
mublas_int lda,
double * x,
mublas_int incx
)

function mublasCtrsv

mublasStatus mublasCtrsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const muComplex * A,
mublas_int lda,
muComplex * x,
mublas_int incx
)

function mublasZtrsv

mublasStatus mublasZtrsv(
mublasHandle_t handle,
mublasFillMode_t uplo,
mublasOperation_t transA,
mublasDiagType_t diag,
mublas_int m,
const muDoubleComplex * A,
mublas_int lda,
muDoubleComplex * x,
mublas_int incx
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • uplo [mublasFillMode_t] specifies whether matrix AA is upper or lower triangular:
    • MUBLAS_FILL_MODE_UPPER: AA is an upper triangular matrix
    • MUBLAS_FILL_MODE_LOWER: AA is a lower triangular matrix
  • transA [mublasOperation_t] specifies the form of op(A)\text{op}(A) to be used in the matrix-vector operation:
    • MUBLAS_OP_N: op(A)=A\text{op}(A) = A
    • MUBLAS_OP_T: op(A)=AT\text{op}(A) = A^T
    • MUBLAS_OP_C: op(A)=AH\text{op}(A) = A^H
  • diag [mublasDiagType_t] specifies whether or not AA is unit triangular:
    • MUBLAS_DIAG_UNIT: AA is assumed to be unit triangular
    • MUBLAS_DIAG_NON_UNIT: AA is not assumed to be unit triangular
  • m [mublas_int] specifies the number of rows of bb. m0m \geq 0.
  • A device pointer storing matrix AA, of dimension (lda,m)(\text{lda}, m).
  • lda [mublas_int] specifies the leading dimension of AA. lda=max(1,m)\text{lda} = \max( 1, m ).
  • x device pointer storing vector xx.
  • incx [mublas_int] specifies the increment for the elements of xx.

trsv solves:

Ax=borATx=b,A \cdot x = b \quad \text{or} \quad A^T \cdot x = b,

where xx and bb are vectors and AA is a triangular matrix.

The vector xx is overwritten on bb.

function mublasSgemvBatched

mublasStatus mublasSgemvBatched(
mublasHandle_t handle,
mublasOperation_t trans,
mublas_int m,
mublas_int n,
const float * alpha,
const float *const A[],
mublas_int lda,
const float *const x[],
mublas_int incx,
const float * beta,
float *const y[],
mublas_int incy,
mublas_int batch_count
)

BLAS Level 2 API

Parameters:

  • handle [mublasHandle_t] handle to the mublas library context queue.
  • trans [mublasOperation_t] indicates whether matrices AiA_i are transposed (conjugated) or not.
  • m [mublas_int] number of rows of each matrix AiA_i.
  • n [mublas_int] number of columns of each matrix AiA_i.
  • alpha device pointer or host pointer to scalar α\alpha.
  • A device array of device pointers storing each matrix AiA_i.
  • lda [mublas_int] specifies the leading dimension of each matrix AiA_i.
  • x device array of device pointers storing each vector xix_i.
  • incx [mublas_int] specifies the increment for the elements of each vector xix_i.
  • beta device pointer or host pointer to scalar β\beta.
  • y device array of device pointers storing each vector yiy_i.
  • incy [mublas_int] specifies the increment for the elements of each vector yiy_i.
  • batch_count [mublas_int] number of instances in the batch.

gemv_batched performs a batch of matrix-vector operations:

yi:=αAixi+βyioryi:=αAiTxi+βyioryi:=αAiHxi+βyi,y_i := \alpha \cdot A_i \cdot x_i + \beta \cdot y_i \quad \text{or} \quad y_i := \alpha \cdot A_i^T \cdot x_i + \beta \cdot y_i \quad \text{or} \quad y_i := \alpha \cdot A_i^H \cdot x_i + \beta \cdot y_i,

where (Ai,xi,yi)(A_i, x_i, y_i) is the ii-th instance of the batch. α\alpha and β\beta are scalars, xix_i and yiy_i are vectors, and AiA_i is an m×nm \times n matrix, for i=1,,batch_counti = 1, \dots, \text{batch\_count}.

function mublasGetMathMode

mublasStatus mublasGetMathMode(
mublasHandle_t handle,
mublasMathMode_t * math_mode
)

Retrieves the current math mode.

function mublasSetMathMode

mublasStatus mublasSetMathMode(
mublasHandle_t handle,
mublasMathMode_t math_mode
)

Sets the math mode.

function mublasGetVersion

mublasStatus mublasGetVersion(
mublasHandle_t handle,
int * version
)

Retrieves the version number of the muBLAS library.

function mublasCreate

mublasStatus mublasCreate(
mublasHandle_t * handle
)

create handle

function mublasDestroy

mublasStatus mublasDestroy(
mublasHandle_t handle
)

destroy handle

function mublasSetStream

mublasStatus mublasSetStream(
mublasHandle_t handle,
MUstream stream
)

set stream for handle

function mublasGetPointerMode

mublasStatus mublasGetPointerMode(
mublasHandle_t handle,
mublasPointerMode_t * pointer_mode
)

get mublasPointerMode_t

function mublasSetPointerMode

mublasStatus mublasSetPointerMode(
mublasHandle_t handle,
mublasPointerMode_t pointer_mode
)

set mublasPointerMode_t

function mublasGetMatrixAsync

mublasStatus mublasGetMatrixAsync(
mublas_int rows,
mublas_int cols,
mublas_int elem_size,
const void * a,
mublas_int lda,
void * b,
mublas_int ldb,
MUstream stream
)

asynchronously copy matrix from device to host

Parameters

  • rows [mublas_int]
    Number of rows in the matrices.

  • cols [mublas_int]
    Number of columns in the matrices.

  • elem_size [mublas_int]
    Number of bytes per element in the matrix.

  • a
    Pointer to the matrix on the GPU.

  • lda [mublas_int]
    Specifies the leading dimension of AA, where ldarows\text{lda} \geq \text{rows}.

  • b
    Pointer to the matrix on the host.

  • ldb [mublas_int]
    Specifies the leading dimension of BB, where ldbrows\text{ldb} \geq \text{rows}.

  • stream
    Specifies the stream into which this transfer request is queued.

mublasGetMatrixAsync copies a matrix from device memory to pinned host memory asynchronously.

  • Host memory must be allocated with hipHostMalloc.
  • If the host memory is not pinned, the transfer will occur synchronously.

function mublasGetError

mublasStatus mublasGetError(
void
)

This function is deprecated.

function mublasGetMatrix

mublasStatus mublasGetMatrix(
mublas_int rows,
mublas_int cols,
mublas_int elem_size,
const void * a,
mublas_int lda,
void * b,
mublas_int ldb
)

copy matrix from device to host

Parameters

  • rows [mublas_int]
    Number of rows in the matrices.

  • cols [mublas_int]
    Number of columns in the matrices.

  • elem_size [mublas_int]
    Number of bytes per element in the matrix.

  • a
    Pointer to the matrix on the GPU.

  • lda [mublas_int]
    Specifies the leading dimension of AA, where ldarows\text{lda} \geq \text{rows}.

  • b
    Pointer to the matrix on the host.

  • ldb [mublas_int]
    Specifies the leading dimension of BB, where ldbrows\text{ldb} \geq \text{rows}.

function mublasShutdown

mublasStatus mublasShutdown(
void
)

This function is deprecated.

function mublasGetVector

mublasStatus mublasGetVector(
mublas_int n,
mublas_int elem_size,
const void * x,
mublas_int incx,
void * y,
mublas_int incy
)

copy vector from device to host

Parameters

  • n [mublas_int]
    Number of elements in the vector.

  • elem_size [mublas_int]
    Number of bytes per element in the vector.

  • x
    Pointer to the vector on the device.

  • incx [mublas_int]
    Specifies the increment for the elements of the vector xx.

  • y
    Pointer to the vector on the host.

  • incy [mublas_int]
    Specifies the increment for the elements of the vector yy.

function mublasGetLoggerCallback

mublasStatus mublasGetLoggerCallback(
mublasLogCallback * userCallback
)

This function retrieves function pointer to previously installed custom user defined callback function via mublasSetLoggerCallback() or zero otherwise.

Parameters:

  • userCallback Pointer to user defined callback function.

function mublasGetProperty

mublasStatus mublasGetProperty(
libraryPropertyType_t type,
int * value
)

get the value of the requested property

function mublasSetMatrixAsync

mublasStatus mublasSetMatrixAsync(
mublas_int rows,
mublas_int cols,
mublas_int elem_size,
const void * a,
mublas_int lda,
void * b,
mublas_int ldb,
MUstream stream
)

asynchronously copy matrix from host to device

Parameters:

  • rows [mublas_int] number of rows in matrices
  • cols [mublas_int] number of columns in matrices
  • elem_size [mublas_int] number of bytes per element in the matrix
  • a pointer to matrix on the host
  • lda [mublas_int] specifies the leading dimension of A, lda >= rows
  • b pointer to matrix on the GPU
  • ldb [mublas_int] specifies the leading dimension of B, ldb >= rows
  • stream specifies the stream into which this transfer request is queued

mublasSetMatrixAsync copies a matrix from pinned host memory to device memory asynchronously. Memory on the host must be allocated with hipHostMalloc or the transfer will be synchronous.

function mublasSetMatrix

mublasStatus mublasSetMatrix(
mublas_int rows,
mublas_int cols,
mublas_int elem_size,
const void * a,
mublas_int lda,
void * b,
mublas_int ldb
)

copy matrix from host to device

Parameters:

  • rows [mublas_int] number of rows in matrices
  • cols [mublas_int] number of columns in matrices
  • elem_size [mublas_int] number of bytes per element in the matrix
  • a pointer to matrix on the host
  • lda [mublas_int] specifies the leading dimension of A, lda >= rows
  • b pointer to matrix on the GPU
  • ldb [mublas_int] specifies the leading dimension of B, ldb >= rows

function mublasGetVectorAsync

mublasStatus mublasGetVectorAsync(
mublas_int n,
mublas_int elem_size,
const void * x,
mublas_int incx,
void * y,
mublas_int incy,
MUstream stream
)

asynchronously copy vector from device to host

Parameters:

  • n [mublas_int] number of elements in the vector
  • elem_size [mublas_int] number of bytes per element in the matrix
  • x pointer to vector on the device
  • incx [mublas_int] specifies the increment for the elements of the vector
  • y pointer to vector on the host
  • incy [mublas_int] specifies the increment for the elements of the vector
  • stream specifies the stream into which this transfer request is queued

mublasGetVectorAsync copies a vector from pinned host memory to device memory asynchronously. Memory on the host must be allocated with hipHostMalloc or the transfer will be synchronous.

mublasFree

mublasSetAtomicsMode

mublasSetVectorAsync

mublasGetAtomicsMode

mublasGetmudartVersion

mublasSetVector

mublasInit

mublasAlloc

mublasSetKernelStream

mublasSetLoggerCallback

mublasLoggerConfigure

function mublasSetMatrixAsync

mublasStatus mublasSetMatrixAsync(
mublas_int rows,
mublas_int cols,
mublas_int elem_size,
const void * a,
mublas_int lda,
void * b,
mublas_int ldb,
MUstream stream
)

asynchronously copy matrix from host to device

Parameters:

  • rows [mublas_int] number of rows in matrices
  • cols [mublas_int] number of columns in matrices
  • elem_size [mublas_int] number of bytes per element in the matrix
  • a pointer to matrix on the host
  • lda [mublas_int] specifies the leading dimension of A, lda >= rows
  • b pointer to matrix on the GPU
  • ldb [mublas_int] specifies the leading dimension of B, ldb >= rows
  • stream specifies the stream into which this transfer request is queued

mublasSetMatrixAsync copies a matrix from pinned host memory to device memory asynchronously. Memory on the host must be allocated with hipHostMalloc or the transfer will be synchronous.

function mublasSetMatrix

mublasStatus mublasSetMatrix(
mublas_int rows,
mublas_int cols,
mublas_int elem_size,
const void * a,
mublas_int lda,
void * b,
mublas_int ldb
)

copy matrix from host to device

Parameters:

  • rows [mublas_int] number of rows in matrices
  • cols [mublas_int] number of columns in matrices
  • elem_size [mublas_int] number of bytes per element in the matrix
  • a pointer to matrix on the host
  • lda [mublas_int] specifies the leading dimension of A, lda >= rows
  • b pointer to matrix on the GPU
  • ldb [mublas_int] specifies the leading dimension of B, ldb >= rows

function mublasGetVectorAsync

mublasStatus mublasGetVectorAsync(
mublas_int n,
mublas_int elem_size,
const void * x,
mublas_int incx,
void * y,
mublas_int incy,
MUstream stream
)

asynchronously copy vector from device to host

Parameters:

  • n [mublas_int] number of elements in the vector
  • elem_size [mublas_int] number of bytes per element in the matrix
  • x pointer to vector on the device
  • incx [mublas_int] specifies the increment for the elements of the vector
  • y pointer to vector on the host
  • incy [mublas_int] specifies the increment for the elements of the vector
  • stream specifies the stream into which this transfer request is queued

mublasGetVectorAsync copies a vector from pinned host memory to device memory asynchronously. Memory on the host must be allocated with hipHostMalloc or the transfer will be synchronous.

mublasFree

mublasSetAtomicsMode

mublasSetVectorAsync

mublasGetAtomicsMode

mublasGetmudartVersion

mublasSetVector

mublasInit

mublasAlloc

mublasSetKernelStream

mublasSetLoggerCallback

mublasLoggerConfigure

function mublasGemmGroupedBatchedEx

mublasGemmGroupedBatchedEx(
mublasHandle_t handle,
const mublasOperation_t transa_array[],
const mublasOperation_t transb_array[],
const int m_array[],
const int n_array[],
const int k_array[],
const void* alpha_array,
const void* const Aarray[],
musaDataType_t Atype,
const int lda_array[],
const void* const Barray[],
musaDataType_t Btype,
const int ldb_array[],
const void* beta_array,
void* const Carray[],
musaDataType_t Ctype,
const int ldc_array[],
int group_count,
const int group_size[],
mublasComputeType_t computeType
)

function mublasGemmEx

mublasStatus mublasGemmEx(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const void * alpha,
const void * a,
musaDataType_t a_type,
mublas_int lda,
const void * b,
musaDataType_t b_type,
mublas_int ldb,
const void * beta,
void * c,
musaDataType_t c_type,
mublas_int ldc,
mublasComputeType_t compute_type,
mublasGemmAlgo_t algo
)


static inline mublasStatus mublasGemmEx(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const void * alpha,
const void * a,
musaDataType_t a_type,
mublas_int lda,
const void * b,
musaDataType_t b_type,
mublas_int ldb,
const void * beta,
void * c,
musaDataType_t c_type,
mublas_int ldc,
musaDataType_t compute_type,
mublasGemmAlgo_t algo
)

BLAS EX API

Parameters:

  • handle: [mublasHandle_t] Handle to the mublas library context queue.
  • transA: [mublasOperation_t] Specifies the form of op(A)\text{op}(A).
  • transB: [mublasOperation_t] Specifies the form of op(B)\text{op}(B).
  • m: [mublas_int] Matrix dimension mm.
  • n: [mublas_int] Matrix dimension nn.
  • k: [mublas_int] Matrix dimension kk.
  • alpha: [const void *] Device pointer or host pointer specifying the scalar α\alpha. Same datatype as compute_type.
  • a: [void *] Device pointer storing matrix AA.
  • a_type: [musaDataType_t] Specifies the datatype of matrix AA.
  • lda: [mublas_int] Specifies the leading dimension of AA.
  • b: [void *] Device pointer storing matrix BB.
  • b_type: [musaDataType_t] Specifies the datatype of matrix BB.
  • ldb: [mublas_int] Specifies the leading dimension of BB.
  • beta: [const void *] Device pointer or host pointer specifying the scalar β\beta. Same datatype as compute_type.
  • c: [void *] Device pointer storing matrix CC.
  • c_type: [musaDataType_t] Specifies the datatype of matrix CC.
  • ldc: [mublas_int] Specifies the leading dimension of CC.
  • compute_type: Specifies the datatype of computation.
  • algo: [mublasGemmAlgo_t] Enumerant specifying the algorithm type.

gemm_ex performs one of the matrix-matrix operations:

C=αop(A)op(B)+βC,C = \alpha \cdot \text{op}(A) \cdot \text{op}(B) + \beta \cdot C,

where op(X)\text{op}(X) is one of:

op(X)=X,op(X)=XT,op(X)=XH,\text{op}(X) = X, \quad \text{op}(X) = X^T, \quad \text{op}(X) = X^H,

and α\alpha and β\beta are scalars. AA, BB, and CC are matrices, with op(A)\text{op}(A) being an m×km \times k matrix, op(B)\text{op}(B) a k×nk \times n matrix, and CC an m×nm \times n matrix.

Supported types:

compute_typea_type / b_typec_type
MUSA_R_16F or MUBLAS_COMPUTE_16FMUSA_R_16FMUSA_R_16F
MUSA_R_32F or MUBLAS_COMPUTE_32FMUSA_R_16FMUSA_R_32F
MUBLAS_COMPUTE_32F_FAST_TF32MUSA_R_32FMUSA_R_32F
MUSA_R_16BF or MUBLAS_COMPUTE_32FMUSA_R_16BFMUSA_R_16BF
MUSA_R_32F or MUBLAS_COMPUTE_32FMUSA_R_32FMUSA_R_32F
MUSA_R_64F or MUBLAS_COMPUTE_64FMUSA_R_64FMUSA_R_64F

function mublasGemmStridedBatchedEx

mublasStatus mublasGemmStridedBatchedEx(
mublasHandle_t handle,
mublasOperation_t transa,
mublasOperation_t transb,
mublas_int m,
mublas_int n,
mublas_int k,
const void * alpha,
const void * a,
musaDataType_t a_type,
mublas_int lda,
mublas_stride stride_a,
const void * b,
musaDataType_t b_type,
mublas_int ldb,
mublas_stride stride_b,
const void * beta,
void * c,
musaDataType_t c_type,
mublas_int ldc,
mublas_stride stride_c,
mublas_int batch_count,
mublasComputeType_t compute_type,
mublasGemmAlgo_t algo
)

static inline mublasStatus mublasGemmStridedBatchedEx(
mublasHandle_t handle,
mublasOperation_t transa,
mublasOperation_t transb,
mublas_int m,
mublas_int n,
mublas_int k,
const void * alpha,
const void * a,
musaDataType_t a_type,
mublas_int lda,
mublas_stride stride_a,
const void * b,
musaDataType_t b_type,
mublas_int ldb,
mublas_stride stride_b,
const void * beta,
void * c,
musaDataType_t c_type,
mublas_int ldc,
mublas_stride stride_c,
mublas_int batch_count,
musaDataType_t compute_type,
mublasGemmAlgo_t algo
)

BLAS EX API

Parameters:

  • handle [mublasHandle_t]: Handle to the mublas library context queue.
  • transA [mublasOperation_t]: Specifies the form of op(A)\text{op}(A).
  • transB [mublasOperation_t]: Specifies the form of op(B)\text{op}(B).
  • m [mublas_int]: Number of rows of op(A)\text{op}(A) and CC.
  • n [mublas_int]: Number of columns of op(B)\text{op}(B) and CC.
  • k [mublas_int]: Number of columns of op(A)\text{op}(A) and rows of op(B)\text{op}(B).
  • alpha [const void *]: Device or host pointer specifying the scalar α\alpha. Must have the same datatype as compute_type.
  • a [const void *]: Device pointer to the first matrix A1A_1.
  • a_type [musaDataType_t]: Specifies the datatype of each matrix AiA_i.
  • lda [mublas_int]: Specifies the leading dimension of each AiA_i.
  • stride_a [mublas_stride]: Stride from the start of one AiA_i matrix to the next Ai+1A_{i+1}.
  • b [const void *]: Device pointer to the first matrix B1B_1.
  • b_type [musaDataType_t]: Specifies the datatype of each matrix BiB_i.
  • ldb [mublas_int]: Specifies the leading dimension of each BiB_i.
  • stride_b [mublas_stride]: Stride from the start of one BiB_i matrix to the next Bi+1B_{i+1}.
  • beta [const void *]: Device or host pointer specifying the scalar β\beta. Must have the same datatype as compute_type.
  • c [void *]: Device pointer to the first matrix C1C_1.
  • c_type [musaDataType_t]: Specifies the datatype of each matrix CiC_i.
  • ldc [mublas_int]: Specifies the leading dimension of each CiC_i.
  • stride_c [mublas_stride]: Stride from the start of one CiC_i matrix to the next Ci+1C_{i+1}.
  • batch_count [mublas_int]: Number of GEMM operations in the batch.
  • compute_type [mublasComputeType_t]: Specifies the datatype for computation.
  • algo [mublasGemmAlgo_t]: Specifies the algorithm type.

gemm_strided_batched_ex performs one of the strided batched matrix-matrix operations:

Ci=αop(Ai)op(Bi)+βCi,for i=1,,batch_count,C_i = \alpha \cdot \text{op}(A_i) \cdot \text{op}(B_i) + \beta \cdot C_i, \quad \text{for } i = 1, \ldots, \text{batch\_count},

where op(X)\text{op}(X) is one of:

  • op(X)=X\text{op}(X) = X
  • op(X)=XT\text{op}(X) = X^T
  • op(X)=XH\text{op}(X) = X^H

α\alpha and β\beta are scalars, and AA, BB, CC are strided batched matrices, where:

  • op(A)\text{op}(A) is an m×k×batch_countm \times k \times \text{batch\_count} strided batched matrix.
  • op(B)\text{op}(B) is a k×n×batch_countk \times n \times \text{batch\_count} strided batched matrix.
  • CC is an m×n×batch_countm \times n \times \text{batch\_count} strided batched matrix.

Strided batched matrices are multiple matrices separated by a constant stride. The total number of matrices is specified by batch_count.

Supported types

The following types are supported:

compute_typea_type / b_typec_type
MUSA_R_16F, MUBLAS_COMPUTE_16FMUSA_R_16FMUSA_R_16F
MUSA_R_32F, MUBLAS_COMPUTE_32FMUSA_R_16FMUSA_R_32F
MUBLAS_COMPUTE_32F_FAST_TF32MUSA_R_32FMUSA_R_32F
MUSA_R_16BF, MUBLAS_COMPUTE_32FMUSA_R_16BFMUSA_R_16BF
MUSA_R_32F, MUBLAS_COMPUTE_32FMUSA_R_32FMUSA_R_32F
MUBLAS_COMPUTE_64F, MUSA_R_64FMUSA_R_64FMUSA_R_64F

function mublasGemmBatchedEx

mublasStatus mublasGemmBatchedEx(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const void * alpha,
const void *const a[],
musaDataType_t a_type,
mublas_int lda,
const void *const b[],
musaDataType_t b_type,
mublas_int ldb,
const void * beta,
void *const c[],
musaDataType_t c_type,
mublas_int ldc,
mublas_int batch_count,
mublasComputeType_t compute_type,
mublasGemmAlgo_t algo
)


static inline mublasStatus mublasGemmBatchedEx(
mublasHandle_t handle,
mublasOperation_t transA,
mublasOperation_t transB,
mublas_int m,
mublas_int n,
mublas_int k,
const void * alpha,
const void *const a[],
musaDataType_t a_type,
mublas_int lda,
const void *const b[],
musaDataType_t b_type,
mublas_int ldb,
const void * beta,
void *const c[],
musaDataType_t c_type,
mublas_int ldc,
mublas_int batch_count,
musaDataType_t compute_type,
mublasGemmAlgo_t algo
)

BLAS EX API

Parameters

  • handle [mublasHandle_t]
    Handle to the mublas library context queue.

  • transA [mublasOperation_t]
    Specifies the form of op(A)\text{op}(A).

  • transB [mublasOperation_t]
    Specifies the form of op(B)\text{op}(B).

  • m [mublas_int]
    Matrix dimension mm.

  • n [mublas_int]
    Matrix dimension nn.

  • k [mublas_int]
    Matrix dimension kk.

  • alpha [const void *]
    Device pointer or host pointer specifying the scalar α\alpha. Same datatype as compute_type.

  • a [void *]
    Device pointer storing an array of pointers to each matrix AiA_i.

  • a_type [musaDataType_t]
    Specifies the datatype of each matrix AiA_i.

  • lda [mublas_int]
    Specifies the leading dimension of each AiA_i.

  • b [void *]
    Device pointer storing an array of pointers to each matrix BiB_i.

  • b_type [musaDataType_t]
    Specifies the datatype of each matrix BiB_i.

  • ldb [mublas_int]
    Specifies the leading dimension of each BiB_i.

  • beta [const void *]
    Device pointer or host pointer specifying the scalar β\beta. Same datatype as compute_type.

  • c [void *]
    Device array of device pointers to each matrix CiC_i.

  • c_type [musaDataType_t]
    Specifies the datatype of each matrix CiC_i.

  • ldc [mublas_int]
    Specifies the leading dimension of each CiC_i.

  • batch_count [mublas_int]
    Number of GEMM operations in the batch.

  • compute_type Specifies the datatype of computation.

  • algo [mublasGemmAlgo_t]
    Enumerant specifying the algorithm type.

GemmBatchedEx performs one of the batched matrix-matrix operations:

Ci=αop(Ai)op(Bi)+βCi,for i=1,,batch_count.C_i = \alpha \cdot \text{op}(A_i) \cdot \text{op}(B_i) + \beta \cdot C_i, \quad \text{for } i = 1, \dots, \text{batch\_count}.

Where:

  • op(X)\text{op}(X) is one of:

    • op(X)=X\text{op}(X) = X,
    • op(X)=XT\text{op}(X) = X^T, or
    • op(X)=XH\text{op}(X) = X^H.
  • α\alpha and β\beta are scalars.

  • AA, BB, and CC are batched pointers to matrices:

    • op(A)\text{op}(A) is an m×k×batch_countm \times k \times \text{batch\_count} batched matrix,
    • op(B)\text{op}(B) is a k×n×batch_countk \times n \times \text{batch\_count} batched matrix,
    • CC is an m×n×batch_countm \times n \times \text{batch\_count} batched matrix.

The batched matrices are stored as an array of pointers, with the number of pointers equal to batch_count\text{batch\_count}.

Supported types

compute_typea_type / b_typec_type
MUSA_R_16F, MUBLAS_COMPUTE_16FMUSA_R_16FMUSA_R_16F
MUSA_R_32F, MUBLAS_COMPUTE_32FMUSA_R_16FMUSA_R_32F
MUBLAS_COMPUTE_32F_FAST_TF32MUSA_R_32FMUSA_R_32F
MUSA_R_16BF, MUBLAS_COMPUTE_32FMUSA_R_16BFMUSA_R_16BF
MUSA_R_32F, MUBLAS_COMPUTE_32FMUSA_R_32FMUSA_R_32F
MUBLAS_COMPUTE_64F, MUSA_R_64FMUSA_R_64FMUSA_R_64F