cuda.cuBlas

Module Contents

class cuda.cuBlas.cuBlas

Wrapper for cublas lib utitilies

CUBLAS_FILL_MODE_LOWER = 0
CUBLAS_FILL_MODE_UPPER = 1
CUBLAS_FILL_MODE_FULL = 2
CUBLAS_DIAG_NON_UNIT = 0
CUBLAS_DIAG_UNIT = 1
CUBLAS_SIDE_LEFT = 0
CUBLAS_SIDE_RIGHT = 1
CUBLAS_OP_N = 0
CUBLAS_OP_T = 1
CUBLAS_OP_C = 2
CUBLAS_OP_HERMITAN = 2
CUBLAS_OP_CONJG = 3
FillModeLower = 0
FillModeUpper = 1
DiagNonUnit = 0
DiagUnit = 1
SideLeft = 0
SideRight = 1
OpNoTrans = 0
OpTrans = 1
create_handle()

create a cublas handle

get_current_handle()
axpy(alpha, x, y, handle=None, batch=None, incx=1, incy=1)

axpy : y = alpha x + y

gemm(A, B, handle=None, out=None, alpha=1.0, beta=0.0, rows=None, transa=0, transb=0)

Matrix-matrix multiplication (no complex support yet) Args: op(A) with shape(m,k), op(B) with shape (k, n) in row major

op(A) = A if transa=0, else A^T rows - only first rows are calculated (rows <=m)
Returns: out (C) with shape (m, n)
C = alpha A B + beta C
gemv(A, x, handle=None, out=None, trans=0, alpha=1.0, beta=0.0)

y(out) = alpha op(A) x + beta y :param A: matrix (m, n) :param x: vector with size= n/m if trans=0/1 (notrans/transpose) :param handle: cublas handle :param out: vector y with size = m/n if trans=0/1 :param trans: :param alpha: :param beta: :return: y

trmv(A, x, handle=None, uplo=1, transa=0, diag=0, incx=1, n=None)

triangular matrix-vector multiplication x= op(A) x Args: A symmetric nxn, x vector n Return: x

trmm(A, B, handle=None, out=None, alpha=1.0, uplo=1, side=0, transa=0, diag=0)

symmetric matrix-matrix multiplication C= A B (Note in blas B = A B) Args: if SideLeft A symmetric mxm, B mxn

if SideRight, A symmetric nxn B mxn

Return: out(C) m x n

symv(A, x, handle=None, uplo=1, n=None, alpha=1.0, beta=0.0, out=None)

symmetric matrix-vector multiplication y = alpha A x + beta y Args: A symmetric nxn, x vector n Return: x

symm(A, B, handle=None, out=None, alpha=1.0, beta=0.0, uplo=1, side=0)

symmetric matrix-matrix multiplication C= A B (Note in blas B = A B) Args: if SideLeft A symmetric mxm, B mxn

if SideRight, A symmetric nxn B mxn

Return: out(C) m x n