muBLAS API Reference
The muBLAS library provides GPU-accelerated Basic Linear Algebra Subprograms for MUSA applications. This reference describes the muBLAS APIs available in MUSA SDK 5.1.0.
API Function Reference
mublasCreate
mublasStatus mublasCreate(mublasHandle_t* handle);
Create handle
Parameters:
- handle
Return type: mublasStatus
mublasDestroy
mublasStatus mublasDestroy(mublasHandle_t handle);
Destroy handle
Parameters:
- handle
Return type: mublasStatus
mublasGetVersion
mublasStatus mublasGetVersion(mublasHandle_t handle, int* version);
Get mublasVersion
Parameters:
- handle
- version
Return type: mublasStatus
mublasGetProperty
mublasStatus mublasGetProperty(libraryPropertyType_t type, int* value);
Get the value of the requested property
Parameters:
- type
- value
Return type: mublasStatus
mublasSetStream
mublasStatus mublasSetStream(mublasHandle_t handle, MUstream stream);
Set stream for handle
Parameters:
- handle
- stream
Return type: mublasStatus
mublasSetWorkspace
mublasStatus mublasSetWorkspace(mublasHandle_t handle, void* workspace, size_t workspaceSizeInBytes);
Set workspace to user-owned device buffer
Parameters:
- handle
- workspace
- workspaceSizeInBytes
Return type: mublasStatus
mublasGetStream
mublasStatus mublasGetStream(mublasHandle_t handle, MUstream* stream);
Get stream [0] from handle
Parameters:
- handle
- stream
Return type: mublasStatus
mublasGetPointerMode
mublasStatus mublasGetPointerMode(mublasHandle_t handle, mublasPointerMode_t* pointer_mode);
Get mublasPointerMode_t
Parameters:
- handle
- pointer_mode
Return type: mublasStatus
mublasSetPointerMode
mublasStatus mublasSetPointerMode(mublasHandle_t handle, mublasPointerMode_t pointer_mode);
Set mublasPointerMode_t
Parameters:
- handle
- pointer_mode
Return type: mublasStatus
mublasSetVector
mublasStatus mublasSetVector(int n, int elem_size, const void* x, int incx, void* y, int incy);
Copy vector from host to device
Parameters:
- n: [int] number of elements in the vector
- elem_size: [int] number of bytes per element in the matrix
- x: pointer to vector on the host
- incx: [int] specifies the increment for the elements of the vector
- y: pointer to vector on the device
- incy: [int] specifies the increment for the elements of the vector
Return type: mublasStatus
mublasGetVector
mublasStatus mublasGetVector(int n, int elem_size, const void* x, int incx, void* y, int incy);
Copy vector from device to host
Parameters:
- n: [int] number of elements in the vector
- elem_size: [int] number of bytes per element in the matrix
- x: pointer to vector on the device
- incx: [int] specifies the increment for the elements of the vector
- y: pointer to vector on the host
- incy: [int] specifies the increment for the elements of the vector
Return type: mublasStatus
mublasSetMatrix
mublasStatus mublasSetMatrix(int rows, int cols, int elem_size, const void* a, int lda, void* b, int ldb);
Copy matrix from host to device
Parameters:
- rows: [int] number of rows in matrices
- cols: [int] number of columns in matrices
- elem_size: [int] number of bytes per element in the matrix
- a: pointer to matrix on the host
- lda: [int] specifies the leading dimension of A, lda >= rows
- b: pointer to matrix on the GPU
- ldb: [int] specifies the leading dimension of B, ldb >= rows
Return type: mublasStatus
mublasGetMatrix
mublasStatus mublasGetMatrix(int rows, int cols, int elem_size, const void* a, int lda, void* b, int ldb);
Copy matrix from device to host
Parameters:
- rows: [int] number of rows in matrices
- cols: [int] number of columns in matrices
- elem_size: [int] number of bytes per element in the matrix
- a: pointer to matrix on the GPU
- lda: [int] specifies the leading dimension of A, lda >= rows
- b: pointer to matrix on the host
- ldb: [int] specifies the leading dimension of B, ldb >= rows
Return type: mublasStatus
mublasSetVectorAsync
mublasStatus mublasSetVectorAsync( int n, int elem_size, const void* x, int incx, void* y, int incy, MUstream stream);
Asynchronously copy vector from host to device
mublasSetVectorAsync copies a vector from pinned host memory to device memory asynchronously. Memory on the host must be allocated with musaHostMalloc or the transfer will be synchronous.
Parameters:
- n: [int] number of elements in the vector
- elem_size: [int] number of bytes per element in the matrix
- x: pointer to vector on the host
- incx: [int] specifies the increment for the elements of the vector
- y: pointer to vector on the device
- incy: [int] specifies the increment for the elements of the vector
- stream: specifies the stream into which this transfer request is queued
Return type: mublasStatus
mublasGetVectorAsync
mublasStatus mublasGetVectorAsync( int n, int elem_size, const void* x, int incx, void* y, int incy, MUstream stream);
Asynchronously copy vector from device to host
mublasGetVectorAsync copies a vector from pinned host memory to device memory asynchronously. Memory on the host must be allocated with musaHostMalloc or the transfer will be synchronous.
Parameters:
- n: [int] number of elements in the vector
- elem_size: [int] number of bytes per element in the matrix
- x: pointer to vector on the device
- incx: [int] specifies the increment for the elements of the vector
- y: pointer to vector on the host
- incy: [int] specifies the increment for the elements of the vector
- stream: specifies the stream into which this transfer request is queued
Return type: mublasStatus
mublasSetMatrixAsync
mublasStatus mublasSetMatrixAsync( int rows, int cols, int elem_size, const void* a, int lda, void* b, int ldb, MUstream stream);
Asynchronously copy matrix from host to device
mublasSetMatrixAsync copies a matrix from pinned host memory to device memory asynchronously. Memory on the host must be allocated with musaHostMalloc or the transfer will be synchronous.
Parameters:
- rows: [int] number of rows in matrices
- cols: [int] number of columns in matrices
- elem_size: [int] number of bytes per element in the matrix
- a: pointer to matrix on the host
- lda: [int] specifies the leading dimension of A, lda >= rows
- b: pointer to matrix on the GPU
- ldb: [int] specifies the leading dimension of B, ldb >= rows
- stream: specifies the stream into which this transfer request is queued
Return type: mublasStatus
mublasGetMatrixAsync
mublasStatus mublasGetMatrixAsync( int rows, int cols, int elem_size, const void* a, int lda, void* b, int ldb, MUstream stream);
Asynchronously copy matrix from device to host
mublasGetMatrixAsync copies a matrix from device memory to pinned host memory asynchronously. Memory on the host must be allocated with musaHostMalloc or the transfer will be synchronous.
Parameters:
- rows: [int] number of rows in matrices
- cols: [int] number of columns in matrices
- elem_size: [int] number of bytes per element in the matrix
- a: pointer to matrix on the GPU
- lda: [int] specifies the leading dimension of A, lda >= rows
- b: pointer to matrix on the host
- ldb: [int] specifies the leading dimension of B, ldb >= rows
- stream: specifies the stream into which this transfer request is queued
Return type: mublasStatus
mublasSetAtomicsMode
mublasStatus mublasSetAtomicsMode(mublasHandle_t handle, mublasAtomicsMode_t atomics_mode);
Set mublasAtomicsMode_t
Parameters:
- handle
- atomics_mode
Return type: mublasStatus
mublasGetAtomicsMode
mublasStatus mublasGetAtomicsMode(mublasHandle_t handle, mublasAtomicsMode_t* atomics_mode);
Get mublasAtomicsMode_t
Parameters:
- handle
- atomics_mode
Return type: mublasStatus
mublasSetMathMode
mublasStatus mublasSetMathMode(mublasHandle_t handle, mublasMath_t math_mode);
Set mublasMath_t
Parameters:
- handle
- math_mode
Return type: mublasStatus
mublasGetMathMode
mublasStatus mublasGetMathMode(mublasHandle_t handle, mublasMath_t* math_mode);
Get mublasMath_t
Parameters:
- handle
- math_mode
Return type: mublasStatus
mublasSetSmCountTarget
mublasStatus mublasSetSmCountTarget(mublasHandle_t handle, int smCountTarget);
Override the number of multiprocessors available to the library during kernels execution
Parameters:
- handle
- smCountTarget
Return type: mublasStatus
mublasGetSmCountTarget
mublasStatus mublasGetSmCountTarget(mublasHandle_t handle, int* smCountTarget);
Get the number of available multiprocessors previously programmed to the library handle
Parameters:
- handle
- smCountTarget
Return type: mublasStatus