muSPARSE API Reference
Functions
| Name | |
|---|---|
| MUSPARSE_EXPORT musparseStatus_t | musparseSetMatDiagType(musparseMatDescr_t descr, musparseDiagType_t diag_type) Specify the matrix diagonal type of a matrix descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSetMatFillMode(musparseMatDescr_t descr, musparseFillMode_t fill_mode) Specify the matrix fill mode of a matrix descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSetMatIndexBase(musparseMatDescr_t descr, musparseIndexBase_t base) Specify the index base of a matrix descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrsv_bufferSize() Sparse triangular solve using BSR storage format. |
| musparseStatus_t | musparseXbsrsv_analysis() Sparse triangular solve using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrsv_solve() Sparse triangular solve using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrsv_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt * position) Sparse triangular solve using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrsm_bufferSize() Sparse triangular system solve using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrsm_analysis() Sparse triangular system solve using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrsm_solve() Sparse triangular system solve using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrsm_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt * position) Sparse triangular system solve using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrilu0_numericBoost() Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrilu0_bufferSize() Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrilu0_analysis() Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format. |
| musparseStatus_t | musparseXbsrilu0() Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrilu0_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt * position) Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseCreate(musparseHandle_t * handle) Create a musparse handle. |
| MUSPARSE_EXPORT musparseStatus_t | musparseDestroy(musparseHandle_t handle) Destroy a musparse handle. |
| MUSPARSE_EXPORT musparseStatus_t | musparseCreateMatDescr(musparseMatDescr_t * descr) Create a matrix descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseDestroyMatDescr(musparseMatDescr_t descr) Destroy a matrix descriptor. |
| musparseDiagType_t | musparseGetMatDiagType(const musparseMatDescr_t descr) Get the matrix diagonal type of a matrix descriptor. |
| musparseFillMode_t | musparseGetMatFillMode(const musparseMatDescr_t descr) Get the matrix fill mode of a matrix descriptor. |
| musparseIndexBase_t | musparseGetMatIndexBase(const musparseMatDescr_t descr) Get the index base of a matrix descriptor. |
| musparseMatrixType_t | musparseGetMatType(const musparseMatDescr_t descr) Get the matrix type of a matrix descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrmm() Sparse matrix dense matrix multiplication using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsric0_bufferSize() Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsric0_analysis() Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsric0() Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsric0_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt * position) Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsric0_bufferSize() Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsric0_analysis() Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsric0() Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsric0_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt * position) Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsrilu0_numericBoost() Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsrilu0_bufferSize() Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsrilu0_analysis() Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsrilu0() Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsrilu0_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt * position) Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseCreateCsr(musparseSpMatDescr_t * descr, int64_t rows, int64_t cols, int64_t nnz, void * csr_row_ptr, void * csr_col_ind, void * csr_val, musparseIndexType_t row_ptr_type, musparseIndexType_t col_ind_type, musparseIndexBase_t idx_base, musparseDataType_t data_type) Create a sparse CSR matrix descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseCreateDnVec(musparseDnVecDescr_t * descr, int64_t size, void * values, musparseDataType_t data_type) Create a dense vector descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseDestroyDnVec(musparseDnVecDescr_t descr) Destroy a dense vector descriptor. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSpMV(musparseHandle_t handle, musparseOperation_t trans, const void * alpha, const musparseSpMatDescr_t mat, const musparseDnVecDescr_t x, const void * beta, const musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpMVAlg_t alg, size_t * buffer_size, void * temp_buffer) Sparse matrix vector multiplication. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXgemvi() Dense matrix sparse vector multiplication. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSpMM_ex(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, const void * alpha, const musparseSpMatDescr_t mat_A, const musparseDnMatDescr_t mat_B, const void * beta, const musparseDnMatDescr_t mat_C, musparseDataType_t compute_type, musparseSpMMAlg_t alg, musparseSpMMStage_t stage, size_t * buffer_size, void * temp_buffer) Sparse matrix dense matrix multiplication, extension routine. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSpMM(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, const void * alpha, const musparseSpMatDescr_t mat_A, const musparseDnMatDescr_t mat_B, const void * beta, const musparseDnMatDescr_t mat_C, musparseDataType_t compute_type, musparseSpMMAlg_t alg, musparseSpMMStage_t stage, size_t * buffer_size, void * temp_buffer) |
| MUSPARSE_EXPORT musparseStatus_t | musparseSpSM(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, const void * alpha, const musparseSpMatDescr_t matA, const musparseDnMatDescr_t matB, const musparseDnMatDescr_t matC, musparseDataType_t compute_type, musparseSpSMAlg_t alg, musparseSpSMStage_t stage, size_t * buffer_size, void * temp_buffer) Sparse triangular system solve. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSpGEMM(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, const void * alpha, const musparseSpMatDescr_t A, const musparseSpMatDescr_t B, const void * beta, const musparseSpMatDescr_t D, musparseSpMatDescr_t C, musparseDataType_t compute_type, musparseSpGEMMAlg_t alg, musparseSpGEMMStage_t stage, size_t * buffer_size, void * temp_buffer) Sparse matrix sparse matrix multiplication. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsrmv() Sparse matrix vector multiplication using BSR storage format. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXbsr2csr() Convert a sparse BSR matrix into a sparse CSR matrix. |
| MUSPARSE_EXPORT musparseStatus_t | musparseXcsr2bsr() Convert a sparse CSR matrix into a sparse BSR matrix. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSparseToDense(musparseHandle_t handle, const musparseSpMatDescr_t mat_A, musparseDnMatDescr_t mat_B, musparseSparseToDenseAlg_t alg, size_t * buffer_size, void * temp_buffer) Sparse matrix to dense matrix conversion. |
| MUSPARSE_EXPORT musparseStatus_t | musparseDenseToSparse(musparseHandle_t handle, const musparseDnMatDescr_t mat_A, musparseSpMatDescr_t mat_B, musparseDenseToSparseAlg_t alg, size_t * buffer_size, void * temp_buffer) Dense matrix to sparse matrix conversion. |
| MUSPARSE_EXPORT musparseStatus_t | musparseAxpby(musparseHandle_t handle, const void * alpha, const musparseSpVecDescr_t x, const void * beta, musparseDnVecDescr_t y) Scale a sparse vector and add it to a scaled dense vector. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSpVV(musparseHandle_t handle, musparseOperation_t trans, const musparseSpVecDescr_t x, const musparseDnVecDescr_t y, void * result, musparseDataType_t compute_type, size_t * buffer_size, void * temp_buffer) Sparse vector inner dot product. |
| MUSPARSE_EXPORT musparseStatus_t | musparseSpSV(musparseHandle_t handle, musparseOperation_t trans, const void * alpha, const musparseSpMatDescr_t mat, const musparseDnVecDescr_t x, const musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpSVAlg_t alg, musparseSpSVStage_t stage, size_t * buffer_size, void * temp_buffer) Sparse triangular solve. |
Functions Documentation
function musparseSetMatDiagType
MUSPARSE_EXPORT musparseStatus_t musparseSetMatDiagType(
musparseMatDescr_t descr,
musparseDiagType_t diag_type
)
Specify the matrix diagonal type of a matrix descriptor.
Parameters:
- descr the matrix descriptor.
- diag_type MUSPARSE_DIAG_TYPE_UNIT or MUSPARSE_DIAG_TYPE_NON_UNIT.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_POINTER
descrpointer is invalid. - MUSPARSE_STATUS_INVALID_VALUE
diag_typeis invalid.
musparseSetMatDiagType sets the matrix diagonal type of a matrix descriptor. Valid diagonal types are MUSPARSE_DIAG_TYPE_UNIT or MUSPARSE_DIAG_TYPE_NON_UNIT.
function musparseSetMatFillMode
MUSPARSE_EXPORT musparseStatus_t musparseSetMatFillMode(
musparseMatDescr_t descr,
musparseFillMode_t fill_mode
)
Specify the matrix fill mode of a matrix descriptor.
Parameters:
- descr the matrix descriptor.
- fill_mode MUSPARSE_FILL_MODE_LOWER or MUSPARSE_FILL_MODE_UPPER.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_POINTER
descrpointer is invalid. - MUSPARSE_STATUS_INVALID_VALUE
fill_modeis invalid.
musparseSetMatFillMode sets the matrix fill mode of a matrix descriptor. Valid fill modes are MUSPARSE_FILL_MODE_LOWER or MUSPARSE_FILL_MODE_UPPER.
function musparseSetMatIndexBase
MUSPARSE_EXPORT musparseStatus_t musparseSetMatIndexBase(
musparseMatDescr_t descr,
musparseIndexBase_t base
)
Specify the index base of a matrix descriptor.
Parameters:
- descr the matrix descriptor.
- base MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_POINTER
descrpointer is invalid. - MUSPARSE_STATUS_INVALID_VALUE
baseis invalid.
musparseSetMatIndexBase sets the index base of a matrix descriptor. Valid options are MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.
function musparseXbsrsv_bufferSize
MUSPARSE_EXPORT musparseStatus_t musparseXbsrsv_bufferSize()
Sparse triangular solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir matrix storage of BSR blocks.
- trans matrix operation type.
- mb number of block rows of the sparse BSR matrix.
- nnzb number of non-zero blocks of the sparse BSR matrix.
- descr descriptor of the sparse BSR matrix.
- bsr_val array of
nnzbblocks of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzcontaining the block column indices of the sparse BSR matrix. - block_dim block dimension of the sparse BSR matrix.
- info structure that holds the information collected during the analysis step.
- buffer_size number of bytes of the temporary storage buffer required by musparseSbsrsv_analysis(), musparseDbsrsv_analysis(), musparseCbsrsv_analysis(), musparseZbsrsv_analysis(), musparseSbsrsv_solve(), musparseDbsrsv_solve(), musparseCbsrsv_solve() and musparseZbsrsv_solve().
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nnzborblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,bsr_val,bsr_row_ptr,bsr_col_ind,infoorbuffer_sizepointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED
trans== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
musparseXbsrsv_bufferSize returns the size of the temporary storage buffer that is required by musparseSbsrsv_analysis(), musparseDbsrsv_analysis(), musparseCbsrsv_analysis(), musparseZbsrsv_analysis(), musparseSbsrsv_solve(), musparseDbsrsv_solve(), musparseCbsrsv_solve() and musparseZbsrsv_solve(). The temporary storage buffer must be allocated by the user.
musparseStatus_t musparseSbsrsv_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr, const float* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, size_t* buffer_size);
musparseStatus_t musparseDbsrsv_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr, const double* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, size_t* buffer_size);
musparseStatus_t musparseCbsrsv_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr,
const muComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
size_t* buffer_size);
musparseStatus_t musparseZbsrsv_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr,
const muDoubleComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
size_t* buffer_size);
function musparseXbsrsv_analysis
musparseStatus_t musparseXbsrsv_analysis()
Sparse triangular solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir matrix storage of BSR blocks.
- trans matrix operation type.
- mb number of block rows of the sparse BSR matrix.
- nnzb number of non-zero blocks of the sparse BSR matrix.
- descr descriptor of the sparse BSR matrix.
- bsr_val array of
nnzbblocks of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzcontaining the block column indices of the sparse BSR matrix. - block_dim block dimension of the sparse BSR matrix.
- info structure that holds the information collected during the analysis step.
- analysis MUSPARSE_ANALYSIS_POLICY_REUSE or MUSPARSE_ANALYSIS_POLICY_FORCE.
- solve MUSPARSE_SOLVE_POLICY_USE_LEVEL.
- temp_buffer temporary storage buffer allocated by the user.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nnzborblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,bsr_row_ptr,bsr_col_ind,infoortemp_bufferpointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED
trans== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
Note:
- If the matrix sparsity pattern changes, the gathered information will become invalid.
- This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
musparseXbsrsv_analysis performs the analysis step for musparseSbsrsv_solve(), musparseDbsrsv_solve(), musparseCbsrsv_solve() and musparseZbsrsv_solve(). It is expected that this function will be executed only once for a given matrix and particular operation type. The analysis meta data can be cleared by musparseXbsrsv_clear().
musparseXbsrsv_analysis can share its meta data with musparseSbsrsm_analysis(), musparseDbsrsm_analysis(), musparseCbsrsm_analysis(), musparseZbsrsm_analysis(), musparseSbsrilu0_analysis(), musparseDbsrilu0_analysis(), musparseCbsrilu0_analysis(), musparseZbsrilu0_analysis(), musparseSbsric0_analysis(), musparseDbsric0_analysis(), musparseCbsric0_analysis() and musparseZbsric0_analysis(). Selecting MUSPARSE_ANALYSIS_POLICY_REUSE policy can greatly improve computation performance of meta data. However, the user need to make sure that the sparsity pattern remains unchanged. If this cannot be assured, MUSPARSE_ANALYSIS_POLICY_FORCE has to be used.
musparseStatus_t musparseSbsrsv_analysis(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr, const float* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
musparseStatus_t musparseDbsrsv_analysis(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr, const double* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
musparseStatus_t musparseCbsrsv_analysis(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr,
const muComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve,
void* temp_buffer);
musparseStatus_t musparseZbsrsv_analysis(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const musparseMatDescr_t descr,
const muDoubleComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve,
void* temp_buffer);
function musparseXbsrsv_solve
MUSPARSE_EXPORT musparseStatus_t musparseXbsrsv_solve()
Sparse triangular solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir matrix storage of BSR blocks.
- trans matrix operation type.
- mb number of block rows of the sparse BSR matrix.
- nnzb number of non-zero blocks of the sparse BSR matrix.
- alpha scalar .
- descr descriptor of the sparse BSR matrix.
- bsr_val array of
nnzbblocks of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzcontaining the block column indices of the sparse BSR matrix. - block_dim block dimension of the sparse BSR matrix.
- info structure that holds the information collected during the analysis step.
- x array of
melements, holding the right-hand side. - y array of
melements, holding the solution. - policy MUSPARSE_SOLVE_POLICY_USE_LEVEL.
- temp_buffer temporary storage buffer allocated by the user.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nnzborblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,alpha,bsr_val,bsr_row_ptr,bsr_col_ind,xorypointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
- MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED
trans== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
Note:
- The sparse BSR matrix has to be sorted.
- This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
- Currently, only
trans== MUSPARSE_OPERATION_NON_TRANSPOSE andtrans== MUSPARSE_OPERATION_TRANSPOSE is supported.
Example:
Consider the lower triangular matrix , stored in BSR storage format with unit diagonal. The following example solves .
// Create musparse handle
musparseHandle_t handle;
musparseCreate(&handle);
// Create matrix descriptor
musparseMatDescr_t descr;
musparseCreateMatDescr(&descr);
musparseSetMatFillMode(descr, MUSPARSE_FILL_MODE_LOWER);
musparseSetMatDiagType(descr, MUSPARSE_DIAG_TYPE_UNIT);
// Create matrix info structure
musparseMatInfo_t info;
musparseCreateMatInfo(&info);
// Obtain required buffer size
size_t buffer_size;
musparseDbsrsv_bufferSize(handle,
MUSPARSE_DIRECTION_COLUMN,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
nnzb,
descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
&buffer_size);
// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);
// Perform analysis step
musparseDbsrsv_analysis(handle,
MUSPARSE_DIRECTION_COLUMN,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
nnzb,
descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
// Solve Ly = x
musparseDbsrsv_solve(handle,
MUSPARSE_DIRECTION_COLUMN,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
nnzb,
&alpha,
descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
x,
y,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
// No zero pivot should be found, with L having unit diagonal
// Clean up
musaFree(temp_buffer);
musparseDestroyMatInfo(info);
musparseDestroyMatDescr(descr);
musparseDestroy(handle);
musparseXbsrsv_solve solves a sparse triangular linear system of a sparse matrix, defined in BSR storage format, a dense solution vector and the right-hand side that is multiplied by , such that:
with
musparseXbsrsv_solve requires a user allocated temporary buffer. Its size is returned by musparseSbsrsv_bufferSize(), musparseDbsrsv_bufferSize(), musparseCbsrsv_bufferSize() or musparseZbsrsv_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseSbsrsv_analysis(), musparseDbsrsv_analysis(), musparseCbsrsv_analysis() or musparseZbsrsv_analysis(). musparseXbsrsv_solve reports the first zero pivot (either numerical or structural zero). The zero pivot status can be checked calling musparseXbsrsv_zeroPivot(). If musparseDiagType_t == MUSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if for some .
musparseStatus_t musparseSbsrsv_solve(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const float* alpha, const musparseMatDescr_t descr,
const float* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, const float* x, float* y,
musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseDbsrsv_solve(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const double* alpha, const musparseMatDescr_t descr,
const double* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, const double* x, double* y,
musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseCbsrsv_solve(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const muComplex* alpha,
const musparseMatDescr_t descr, const muComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, const muComplex* x, muComplex* y,
musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseZbsrsv_solve(
musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans,
muInt mb, muInt nnzb, const muDoubleComplex* alpha,
const musparseMatDescr_t descr, const muDoubleComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, const muDoubleComplex* x, muDoubleComplex* y,
musparseSolvePolicy_t policy, void* temp_buffer);
function musparseXbsrsv_zeroPivot
MUSPARSE_EXPORT musparseStatus_t musparseXbsrsv_zeroPivot(
musparseHandle_t handle,
musparseMatInfo_t info,
muInt * position
)
Sparse triangular solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- info structure that holds the information collected during the analysis step.
- position pointer to zero pivot , can be in host or device memory.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_POINTER
infoorpositionpointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
Note: musparseXbsrsv_zeroPivot is a blocking function. It might influence performance negatively.
musparseXbsrsv_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseSbsrsv_solve(), musparseDbsrsv_solve(), musparseCbsrsv_solve() or musparseZbsrsv_solve() computation. The first zero pivot at is stored in position, using same index base as the BSR matrix.
musparseXbsrsv_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT if either a structural or numerical zero has been found during musparseSbsrsv_solve(), musparseDbsrsv_solve(), musparseCbsrsv_solve(), or musparseZbsrsv_solve() computation. The first zero pivot at is stored in position, using the same index base as the BSR matrix.
position can be in host or device memory. If no zero pivot has been found, position is set to -1 and MUSPARSE_STATUS_SUCCESS is returned instead.
function musparseXbsrsm_bufferSize
MUSPARSE_EXPORT musparseStatus_t musparseXbsrsm_bufferSize()
Sparse triangular system solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir matrix storage of BSR blocks.
- trans_A matrix A operation type.
- trans_X matrix X operation type.
- mb number of block rows of the sparse BSR matrix A.
- nrhs number of columns of the dense matrix op(X).
- nnzb number of non-zero blocks of the sparse BSR matrix A.
- descr descriptor of the sparse BSR matrix A.
- bsr_val array of
nnzbblocks of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzbcontaining the block column indices of the sparse BSR matrix. - block_dim block dimension of the sparse BSR matrix.
- info structure that holds the information collected during the analysis step.
- buffer_size number of bytes of the temporary storage buffer required by musparseSbsrsm_analysis(), musparseDbsrsm_analysis(), musparseCbsrsm_analysis(), musparseZbsrsm_analysis(), musparseSbsrsm_solve(), musparseDbsrsm_solve(), musparseCbsrsm_solve() and musparseZbsrsm_solve().
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nrhs,nnzborblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,bsr_val,bsr_row_ptr,bsr_col_ind,infoorbuffer_sizepointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED
trans_A== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE,trans_X== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
musparseXbsrsm_bufferSize returns the size of the temporary storage buffer that is required by musparseSbsrsm_analysis(), musparseDbsrsm_analysis(), musparseCbsrsm_analysis(), musparseZbsrsm_analysis(), musparseSbsrsm_solve(), musparseDbsrsm_solve(), musparseCbsrsm_solve() and musparseZbsrsm_solve(). The temporary storage buffer must be allocated by the user.
musparseStatus_t musparseSbsrsm_bufferSize(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const float* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, size_t* buffer_size);
musparseStatus_t musparseDbsrsm_bufferSize(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const double* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, size_t* buffer_size);
musparseStatus_t musparseCbsrsm_bufferSize(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const muComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
size_t* buffer_size);
musparseStatus_t musparseZbsrsm_bufferSize(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const muDoubleComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
size_t* buffer_size);
function musparseXbsrsm_analysis
MUSPARSE_EXPORT musparseStatus_t musparseXbsrsm_analysis()
Sparse triangular system solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir matrix storage of BSR blocks.
- trans_A matrix A operation type.
- trans_X matrix X operation type.
- mb number of block rows of the sparse BSR matrix A.
- nrhs number of columns of the dense matrix op(X).
- nnzb number of non-zero blocks of the sparse BSR matrix A.
- descr descriptor of the sparse BSR matrix A.
- bsr_val array of
nnzbblocks of the sparse BSR matrix A. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix A. - bsr_col_ind array of
nnzbcontaining the block column indices of the sparse BSR matrix A. - block_dim block dimension of the sparse BSR matrix A.
- info structure that holds the information collected during the analysis step.
- analysis MUSPARSE_ANALYSIS_POLICY_REUSE or MUSPARSE_ANALYSIS_POLICY_FORCE.
- solve MUSPARSE_SOLVE_POLICY_USE_LEVEL.
- temp_buffer temporary storage buffer allocated by the user.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nrhs,nnzborblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,bsr_val,bsr_row_ptr,bsr_col_ind,infoortemp_bufferpointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED
trans_A== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE,trans_X== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
Note:
- If the matrix sparsity pattern changes, the gathered information will become invalid.
- This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
musparseXbsrsm_analysis performs the analysis step for musparseSbsrsm_solve(), musparseDbsrsm_solve(), musparseCbsrsm_solve() and musparseZbsrsm_solve(). It is expected that this function will be executed only once for a given matrix and particular operation type. The analysis meta data can be cleared by musparseXbsrsm_clear().
musparseXbsrsm_analysis can share its meta data with musparseSbsrilu0_analysis(), musparseDbsrilu0_analysis(), musparseCbsrilu0_analysis(), musparseZbsrilu0_analysis(), musparseSbsric0_analysis(), musparseDbsric0_analysis(), musparseCbsric0_analysis(), musparseZbsric0_analysis(), musparseSbsrsv_analysis(), musparseDbsrsv_analysis(), musparseCbsrsv_analysis() and musparseZbsrsv_analysis(). Selecting MUSPARSE_ANALYSIS_POLICY_REUSE policy can greatly improve computation performance of meta data. However, the user need to make sure that the sparsity pattern remains unchanged. If this cannot be assured, MUSPARSE_ANALYSIS_POLICY_FORCE has to be used.
musparseStatus_t musparseSbsrsm_analysis(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const float* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
musparseStatus_t musparseDbsrsm_analysis(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const double* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
musparseStatus_t musparseCbsrsm_analysis(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const muComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve,
void* temp_buffer);
musparseStatus_t musparseZbsrsm_analysis(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const musparseMatDescr_t descr,
const muDoubleComplex* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve,
void* temp_buffer);
function musparseXbsrsm_solve
MUSPARSE_EXPORT musparseStatus_t musparseXbsrsm_solve()
Sparse triangular system solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir matrix storage of BSR blocks.
- trans_A matrix A operation type.
- trans_X matrix X operation type.
- mb number of block rows of the sparse BSR matrix A.
- nrhs number of columns of the dense matrix op(X).
- nnzb number of non-zero blocks of the sparse BSR matrix A.
- alpha scalar .
- descr descriptor of the sparse BSR matrix A.
- bsr_val array of
nnzbblocks of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzbcontaining the block column indices of the sparse BSR matrix. - block_dim block dimension of the sparse BSR matrix.
- info structure that holds the information collected during the analysis step.
- B rhs matrix B with leading dimension
ldb. - ldb leading dimension of rhs matrix B.
- X solution matrix X with leading dimension
ldx. - ldx leading dimension of solution matrix X.
- policy MUSPARSE_SOLVE_POLICY_USE_LEVEL.
- temp_buffer temporary storage buffer allocated by the user.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nrhs,nnzborblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
alpha,descr,bsr_val,bsr_row_ptr,bsr_col_ind,B,X``infoortemp_bufferpointer is invalid. * - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred. * *
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED
trans_A== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE,trans_X== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
Note:
- The sparse BSR matrix has to be sorted.
- Operation type of B and X must match, if .
- This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
- Currently, only
trans_A!= MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE andtrans_X!= MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE is supported.
musparseXbsrsm_solve solves a sparse triangular linear system of a sparse matrix, defined in BSR storage format, a dense solution matrix and the right-hand side matrix that is multiplied by , such that
with
and
musparseXbsrsm_solve requires a user allocated temporary buffer. Its size is returned by musparseSbsrsm_bufferSize(), musparseDbsrsm_bufferSize(), musparseCbsrsm_bufferSize() or musparseZbsrsm_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseSbsrsm_analysis(), musparseDbsrsm_analysis(), musparseCbsrsm_analysis() or musparseZbsrsm_analysis(). musparseXbsrsm_solve reports the first zero pivot (either numerical or structural zero). The zero pivot status can be checked calling [musparseXbsrsm_zeroPivot()]. If musparseDiagType_t == MUSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if for some .
musparseStatus_t musparseSbsrsm_solve(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const float* alpha, const musparseMatDescr_t descr,
const float* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, const float* B, muInt ldb,
float* X, muInt ldx, musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseDbsrsm_solve(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const double* alpha, const musparseMatDescr_t descr,
const double* bsr_val, const muInt* bsr_row_ptr, const muInt* bsr_col_ind,
muInt block_dim, musparseMatInfo_t info, const double* B, muInt ldb,
double* X, muInt ldx, musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseCbsrsm_solve(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const muComplex* alpha,
const musparseMatDescr_t descr, const muComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, const muComplex* B, muInt ldb, muComplex* X,
muInt ldx, musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseZbsrsm_solve(
musparseHandle_t handle, musparseDirection_t dir,
musparseOperation_t trans_A, musparseOperation_t trans_X, muInt mb,
muInt nrhs, muInt nnzb, const muDoubleComplex* alpha,
const musparseMatDescr_t descr, const muDoubleComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, const muDoubleComplex* B, muInt ldb,
muDoubleComplex* X, muInt ldx, musparseSolvePolicy_t policy,
void* temp_buffer);
function musparseXbsrsm_zeroPivot
MUSPARSE_EXPORT musparseStatus_t musparseXbsrsm_zeroPivot(
musparseHandle_t handle,
musparseMatInfo_t info,
muInt * position
)
Sparse triangular system solve using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- info structure that holds the information collected during the analysis step.
- position pointer to zero pivot , can be in host or device memory.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_POINTER
infoorpositionpointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
Note: musparseXbsrsm_zeroPivot is a blocking function. It might influence performance negatively.
musparseXbsrsm_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseSbsrsm_solve(), musparseDbsrsm_solve(), musparseCbsrsm_solve() or musparseZbsrsm_solve() computation. The first zero pivot at is stored in position, using same index base as the BSR matrix.
position can be in host or device memory. If no zero pivot has been found, position is set to -1 and MUSPARSE_STATUS_SUCCESS is returned instead.
function musparseXbsrilu0_numericBoost
MUSPARSE_EXPORT musparseStatus_t musparseXbsrilu0_numericBoost()
Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- info structure that holds the information collected during the analysis step.
- enable_boost enable/disable numeric boost.
- boost_tol tolerance to determine whether a numerical value is replaced or not.
- boost_val boost value to replace a numerical value.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_POINTER
info,tolorboost_valpointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
Note:
- The boost value is enabled by setting
enable_boostto 1 or disabled by settingenable_boostto 0. tolandboost_valcan be in host or device memory.
musparseXbsrilu0_numericBoost enables the user to replace a numerical value in an incomplete LU factorization. tol is used to determine whether a numerical value is replaced by boost_val, such that if
musparseStatus_t musparseSbsrilu0_numericBoost(musparseHandle_t handle,
musparseMatInfo_t info,
int enable_boost,
const float* boost_tol,
const float* boost_val);
musparseStatus_t musparseDbsrilu0_numericBoost(musparseHandle_t handle,
musparseMatInfo_t info,
int enable_boost,
const double* boost_tol,
const double* boost_val);
musparseStatus_t musparseCbsrilu0_numericBoost(musparseHandle_t handle,
musparseMatInfo_t info,
int enable_boost,
const float* boost_tol,
const muComplex* boost_val);
musparseStatus_t musparseZbsrilu0_numericBoost(
musparseHandle_t handle, musparseMatInfo_t info, int enable_boost,
const double* boost_tol, const muDoubleComplex* boost_val);
musparseStatus_t musparseDSbsrilu0_numericBoost(musparseHandle_t handle,
musparseMatInfo_t info,
int enable_boost,
const double* boost_tol,
const float* boost_val);
musparseStatus_t musparseDCbsrilu0_numericBoost(musparseHandle_t handle,
musparseMatInfo_t info,
int enable_boost,
const double* boost_tol,
const muComplex* boost_val);
function musparseXbsrilu0_bufferSize
MUSPARSE_EXPORT musparseStatus_t musparseXbsrilu0_bufferSize()
Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir direction that specifies whether to count nonzero elements by MUSPARSE_DIRECTION_ROW or by MUSPARSE_DIRECTION_ROW.
- mb number of block rows in the sparse BSR matrix.
- nnzb number of non-zero block entries of the sparse BSR matrix.
- descr descriptor of the sparse BSR matrix.
- bsr_val array of length
nnzb*block_dim*block_dimcontaining the values of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzbelements containing the block column indices of the sparse BSR matrix. - block_dim the block dimension of the BSR matrix. Between 1 and m where
m=mb*block_dim. - info structure that holds the information collected during the analysis step.
- buffer_size number of bytes of the temporary storage buffer required by musparseSbsrilu0_analysis(), musparseDbsrilu0_analysis(), musparseCbsrilu0_analysis(), musparseZbsrilu0_analysis(), musparseSbsrilu0(), musparseDbsrilu0(), musparseCbsrilu0() and musparseZbsrilu0().
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nnzb, orblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,bsr_val,bsr_row_ptr,bsr_col_ind,infoorbuffer_sizepointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
musparseXbsrilu0_bufferSize returns the size of the temporary storage buffer that is required by musparseSbsrilu0_analysis(), musparseDbsrilu0_analysis(), musparseCbsrilu0_analysis(), musparseZbsrilu0_analysis(), musparseSbsrilu0(), musparseDbsrilu0(), musparseSbsrilu0() and musparseDbsrilu0(). The temporary storage buffer must be allocated by the user. The size of the temporary storage buffer is identical to the size returned by musparseSbsrsv_bufferSize(), musparseDbsrsv_bufferSize(), musparseCbsrsv_bufferSize(), musparseZbsrsv_bufferSize(), musparseSbsric0_bufferSize(), musparseDbsric0_bufferSize(), musparseCbsric0_bufferSize() and musparseZbsric0_bufferSize() if the matrix sparsity pattern is identical. The user allocated buffer can thus be shared between subsequent calls to those functions.
musparseStatus_t musparseSbsrilu0_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const float* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, size_t* buffer_size);
musparseStatus_t musparseDbsrilu0_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const double* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, size_t* buffer_size);
musparseStatus_t musparseCbsrilu0_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const muComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, size_t* buffer_size);
musparseStatus_t musparseZbsrilu0_bufferSize(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const muDoubleComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, size_t* buffer_size);
function musparseXbsrilu0_analysis
MUSPARSE_EXPORT musparseStatus_t musparseXbsrilu0_analysis()
Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir direction that specified whether to count nonzero elements by MUSPARSE_DIRECTION_ROW or by MUSPARSE_DIRECTION_ROW.
- mb number of block rows in the sparse BSR matrix.
- nnzb number of non-zero block entries of the sparse BSR matrix.
- descr descriptor of the sparse BSR matrix.
- bsr_val array of length
nnzb*block_dim*block_dimcontaining the values of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzbelements containing the block column indices of the sparse BSR matrix. - block_dim the block dimension of the BSR matrix. Between 1 and m where
m=mb*block_dim. - info structure that holds the information collected during the analysis step.
- analysis MUSPARSE_ANALYSIS_POLICY_REUSE or MUSPARSE_ANALYSIS_POLICY_FORCE.
- solve MUSPARSE_SOLVE_POLICY_USE_LEVEL.
- temp_buffer temporary storage buffer allocated by the user.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nnzb, orblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,bsr_val,bsr_row_ptr,bsr_col_ind,infoortemp_bufferpointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
Note:
- If the matrix sparsity pattern changes, the gathered information will become invalid.
- This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
musparseXbsrilu0_analysis performs the analysis step for musparseSbsrilu0() musparseDbsrilu0(), musparseCbsrilu0(), and musparseZbsrilu0(). It is expected that this function will be executed only once for a given matrix. The analysis meta data can be cleared by musparseXbsrilu0_clear().
musparseXbsrilu0_analysis can share its meta data with musparseSbsric0_analysis(), musparseDbsric0_analysis(), musparseCbsric0_analysis(), musparseZbsric0_analysis(), musparseSbsrsv_analysis(), musparseDbsrsv_analysis(), musparseCbsrsv_analysis(), musparseZbsrsv_analysis(), musparseSbsrsm_analysis(), musparseDbsrsm_analysis(), musparseCbsrsm_analysis() and musparseZbsrsm_analysis(). Selecting MUSPARSE_ANALYSIS_POLICY_REUSE policy can greatly improve computation performance of meta data. However, the user need to make sure that the sparsity pattern remains unchanged. If this cannot be assured, MUSPARSE_ANALYSIS_POLICY_FORCE has to be used.
musparseStatus_t musparseSbsrilu0_analysis(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const float* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
musparseStatus_t musparseDbsrilu0_analysis(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const double* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
musparseStatus_t musparseCbsrilu0_analysis(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const muComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
musparseStatus_t musparseZbsrilu0_analysis(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, const muDoubleComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseAnalysisPolicy_t analysis,
musparseSolvePolicy_t solve, void* temp_buffer);
function musparseXbsrilu0
musparseStatus_t musparseXbsrilu0()
Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir direction that specified whether to count nonzero elements by MUSPARSE_DIRECTION_ROW or by MUSPARSE_DIRECTION_ROW.
- mb number of block rows in the sparse BSR matrix.
- nnzb number of non-zero block entries of the sparse BSR matrix.
- descr descriptor of the sparse BSR matrix.
- bsr_val array of length
nnzb*block_dim*block_dimcontaining the values of the sparse BSR matrix. - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix. - bsr_col_ind array of
nnzbelements containing the block column indices of the sparse BSR matrix. - block_dim the block dimension of the BSR matrix. Between 1 and m where
m=mb*block_dim. - info structure that holds the information collected during the analysis step.
- policy MUSPARSE_SOLVE_POLICY_USE_LEVEL.
- temp_buffer temporary storage buffer allocated by the user.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_SIZE
mb,nnzb, orblock_dimis invalid. - MUSPARSE_STATUS_INVALID_POINTER
descr,bsr_val,bsr_row_ptrorbsr_col_indpointer is invalid. * - MUSPARSE_EXPORT MUSPARSE_STATUS_ARCH_MISMATCH the device is not supported. *
- MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred. * *
- MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.
Note: This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
Example:
Consider the sparse matrix , stored in BSR storage format. The following example computes the incomplete LU factorization and solves the preconditioned system .
// Create musparse handle
musparseHandle_t handle;
musparseCreate(&handle);
// Create matrix descriptor for M
musparseMatDescr_t descr_M;
musparseCreateMatDescr(&descr_M);
// Create matrix descriptor for L
musparseMatDescr_t descr_L;
musparseCreateMatDescr(&descr_L);
musparseSetMatFillMode(descr_L, MUSPARSE_FILL_MODE_LOWER);
musparseSetMatDiagType(descr_L, MUSPARSE_DIAG_TYPE_UNIT);
// Create matrix descriptor for U
musparseMatDescr_t descr_U;
musparseCreateMatDescr(&descr_U);
musparseSetMatFillMode(descr_U, MUSPARSE_FILL_MODE_UPPER);
musparseSetMatDiagType(descr_U, MUSPARSE_DIAG_TYPE_NON_UNIT);
// Create matrix info structure
musparseMatInfo_t info;
musparseCreateMatInfo(&info);
// Obtain required buffer size
size_t buffer_size_M;
size_t buffer_size_L;
size_t buffer_size_U;
musparseDbsrilu0_bufferSize(handle,
MUSPARSE_DIRECTION_ROW,
mb,
nnzb,
descr_M,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
&buffer_size_M);
musparseDbsrsv_bufferSize(handle,
MUSPARSE_DIRECTION_ROW,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
nnzb,
descr_L,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
&buffer_size_L);
musparseDbsrsv_bufferSize(handle,
MUSPARSE_DIRECTION_ROW,
MUSPARSE_OPERATION_TRANSPOSE,
mb,
nnzb,
descr_U,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
&buffer_size_U);
size_t buffer_size = max(buffer_size_M, max(buffer_size_L,
buffer_size_U));
// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);
// Perform analysis steps, using MUSPARSE_ANALYSIS_POLICY_REUSE to
improve
// computation performance
musparseDbsrilu0_analysis(handle,
MUSPARSE_DIRECTION_ROW,
mb,
nnzb,
descr_M,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
musparseDbsrsv_analysis(handle,
MUSPARSE_DIRECTION_ROW,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
nnzb,
descr_L,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
musparseDbsrsv_analysis(handle,
MUSPARSE_DIRECTION_ROW,
MUSPARSE_OPERATION_TRANSPOSE,
mb,
nnzb,
descr_U,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
// Check for zero pivot
muInt position;
if(MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT == musparseXbsrilu0_zeroPivot(handle,
info,
&position))
{
printf("A has structural zero at A(%d,%d)\n", position, position);
}
// Compute incomplete LU factorization M = LU
musparseDbsrilu0(handle,
MUSPARSE_DIRECTION_ROW,
mb,
nnzb,
descr_M,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
// Check for zero pivot
if(MUSPARSE_EXPORT
MUSPARSE_STATUS_ZERO_PIVOT == musparseXbsrilu0_zeroPivot(handle,
info,
&position))
{
printf("L has structural and/or numerical zero at L(%d,%d)\n",
position,
position);
}
// Solve Lz = x
musparseDbsrsv_solve(handle,
MUSPARSE_DIRECTION_ROW,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
nnzb,
&alpha,
descr_L,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
x,
z,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
// Solve Uy = z
musparseDbsrsv_solve(handle,
MUSPARSE_DIRECTION_ROW,
MUSPARSE_OPERATION_TRANSPOSE,
mb,
nnzb,
&alpha,
descr_U,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
z,
y,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
// Clean up
musaFree(temp_buffer);
musparseDestroyMatInfo(info);
musparseDestroyMatDescr(descr_M);
musparseDestroyMatDescr(descr_L);
musparseDestroyMatDescr(descr_U);
musparseDestroy(handle);
musparseXbsrilu0 computes the incomplete LU factorization with 0 fill-ins and no pivoting of a sparse BSR matrix , such that
musparseXbsrilu0 requires a user allocated temporary buffer. Its size is returned by musparseSbsrilu0_bufferSize(), musparseDbsrilu0_bufferSize(), musparseCbsrilu0_bufferSize() or musparseZbsrilu0_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseSbsrilu0_analysis(), musparseDbsrilu0_analysis(), musparseCbsrilu0_analysis() or musparseZbsrilu0_analysis(). musparseXbsrilu0 reports the first zero pivot (either numerical or structural zero). The zero pivot status can be obtained by calling [musparseXbsrilu0_zeroPivot()].
musparseStatus_t musparseSbsrilu0(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, float* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseDbsrilu0(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, double* bsr_val, const muInt* bsr_row_ptr,
const muInt* bsr_col_ind, muInt block_dim, musparseMatInfo_t info,
musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseCbsrilu0(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, muComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseSolvePolicy_t policy, void* temp_buffer);
musparseStatus_t musparseZbsrilu0(
musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nnzb,
const musparseMatDescr_t descr, muDoubleComplex* bsr_val,
const muInt* bsr_row_ptr, const muInt* bsr_col_ind, muInt block_dim,
musparseMatInfo_t info, musparseSolvePolicy_t policy, void* temp_buffer);
function musparseXbsrilu0_zeroPivot
MUSPARSE_EXPORT musparseStatus_t musparseXbsrilu0_zeroPivot(
musparseHandle_t handle,
musparseMatInfo_t info,
muInt * position
)
Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- info structure that holds the information collected during the analysis step.
- position pointer to zero pivot , can be in host or device memory.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE the library context was not initialized.
- MUSPARSE_STATUS_INVALID_POINTER
infoorpositionpointer is invalid. - MUSPARSE_EXPORT MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
- MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.
Note:
- If a zero pivot is found,
positionmeans that either the diagonal block is missing (structural zero) or the diagonal block is not invertible (numerical zero). musparseXbsrilu0_zeroPivotis a blocking function. It might influence performance negatively.
musparseXbsrilu0_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseSbsrilu0(), musparseDbsrilu0(), musparseCbsrilu0() or musparseZbsrilu0() computation. The first zero pivot at is stored in position, using same index base as the BSR matrix.
position can be in host or device memory. If no zero pivot has been found, position is set to -1 and MUSPARSE_STATUS_SUCCESS is returned instead.
function musparseCreate
MUSPARSE_EXPORT musparseStatus_t musparseCreate(
musparseHandle_t * handle
)
Create a musparse handle.
Parameters:
- handle the pointer to the handle to the musparse library context.
Returns:
- MUSPARSE_STATUS_SUCCESS the initialization succeeded.
- MUSPARSE_STATUS_INVALID_HANDLE
handlepointer is invalid. - MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
musparseCreate creates the musparse library context. It must be initialized before any other musparse API function is invoked and must be passed to all subsequent library function calls. The handle should be destroyed at the end using [musparseDestroy()].
function musparseDestroy
MUSPARSE_EXPORT musparseStatus_t musparseDestroy(
musparseHandle_t handle
)
Destroy a musparse handle.
Parameters:
- handle the handle to the musparse library context.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_HANDLE
handleis invalid. - MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
musparseDestroy destroys the musparse library context and releases all resources used by the musparse library.
function musparseCreateMatDescr
MUSPARSE_EXPORT musparseStatus_t musparseCreateMatDescr(
musparseMatDescr_t * descr
)
Create a matrix descriptor.
Parameters:
- descr the pointer to the matrix descriptor.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_POINTER
descrpointer is invalid.
musparseCreateMatDescr creates a matrix descriptor. It initializes musparseMatrixType_t to MUSPARSE_MATRIX_TYPE_GENERAL and musparseIndexBase_t to MUSPARSE_INDEX_BASE_ZERO. It should be destroyed at the end using [musparseDestroyMatDescr()].
function musparseDestroyMatDescr
MUSPARSE_EXPORT musparseStatus_t musparseDestroyMatDescr(
musparseMatDescr_t descr
)
Destroy a matrix descriptor.
Parameters:
- descr the matrix descriptor.
Returns:
- MUSPARSE_STATUS_SUCCESS the operation completed successfully.
- MUSPARSE_STATUS_INVALID_POINTER
descris invalid.
musparseDestroyMatDescr destroys a matrix descriptor and releases all resources used by the descriptor.
function musparseGetMatDiagType
musparseDiagType_t musparseGetMatDiagType(
const musparseMatDescr_t descr
)
Get the matrix diagonal type of a matrix descriptor.
Parameters:
- descr the matrix descriptor.
Return: MUSPARSE_DIAG_TYPE_UNIT or MUSPARSE_DIAG_TYPE_NON_UNIT.
musparseGetMatDiagType returns the matrix diagonal type of a matrix descriptor.
function musparseGetMatFillMode
musparseFillMode_t musparseGetMatFillMode(
const musparseMatDescr_t descr
)
Get the matrix fill mode of a matrix descriptor.
Parameters:
- descr the matrix descriptor.
Return: MUSPARSE_FILL_MODE_LOWER or MUSPARSE_FILL_MODE_UPPER.
musparseGetMatFillMode returns the matrix fill mode of a matrix descriptor.
function musparseGetMatIndexBase
musparseIndexBase_t musparseGetMatIndexBase(
const musparseMatDescr_t descr
)
Get the index base of a matrix descriptor.
Parameters:
- descr the matrix descriptor.
Return: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.
musparseGetMatIndexBase returns the index base of a matrix descriptor.
function musparseGetMatType
musparseMatrixType_t musparseGetMatType(
const musparseMatDescr_t descr
)
Get the matrix type of a matrix descriptor.
Parameters:
- descr the matrix descriptor.
Return: MUSPARSE_MATRIX_TYPE_GENERAL, MUSPARSE_MATRIX_TYPE_SYMMETRIC, MUSPARSE_MATRIX_TYPE_HERMITIAN or MUSPARSE_MATRIX_TYPE_TRIANGULAR.
musparseGetMatType returns the matrix type of a matrix descriptor.
function musparseXbsrmm
MUSPARSE_EXPORT musparseStatus_t musparseXbsrmm()
Sparse matrix dense matrix multiplication using BSR storage format.
Parameters:
- handle handle to the musparse library context queue.
- dir the storage format of the blocks. Can be MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN.
- trans_A matrix operation type. Currently, only MUSPARSE_OPERATION_NON_TRANSPOSE is supported.
- trans_B matrix operation type. Currently, only MUSPARSE_OPERATION_NON_TRANSPOSE and MUSPARSE_OPERATION_TRANSPOSE are supported.
- mb number of block rows of the sparse BSR matrix .
- n number of columns of the dense matrix and .
- kb number of block columns of the sparse BSR matrix .
- nnzb number of non-zero blocks of the sparse BSR matrix .
- alpha scalar .
- descr descriptor of the sparse BSR matrix . Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
- bsr_val array of
nnzb*block_dim*block_dimelements of the sparse BSR matrix . - bsr_row_ptr array of
mb+1elements that point to the start of every block row of the sparse BSR matrix . - bsr_col_ind array of
nnzbelements containing the block column indices of the sparse BSR matrix . - block_dim size of the blocks in the sparse BSR matrix.
- B array of dimension ( ), otherwise.
- ldb leading dimension of , must be at least ( ) where , otherwise.
- beta scalar .
- C array of dimension .
- ldc leading dimension of , must be at least ( ) where , where