Skip to main content

muSPARSE API 参考


目录


Files


File musparse-auxiliary.h

Location: musparse-auxiliary.h

musparse-auxiliary.h provides auxilary functions in musparse

Includes

  • <stdint.h>
  • musparse-export.h
  • musparse-types.h

Function musparseCreateCsr

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.

musparseCreateCsr creates a sparse CSR matrix descriptor. It should be destroyed at the end using musparseDestroySpMat.

Parameters:

  • descr: the pointer to the sparse CSR matrix descriptor.
  • rows: number of rows in the CSR matrix.
  • cols: number of columns in the CSR matrix
  • nnz: number of non-zeros in the CSR matrix.
  • csr_row_ptr: row offsets of the CSR matrix (must be array of length rows+1 ).
  • csr_col_ind: column indices of the CSR matrix (must be array of length nnz ).
  • csr_val: values of the CSR matrix (must be array of length nnz ).
  • row_ptr_type: MUSPARSE_INDEX_32I or MUSPARSE_INDEX_64I.
  • col_ind_type: MUSPARSE_INDEX_32I or MUSPARSE_INDEX_64I.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.
  • data_type: MUSA_R_32F, MUSA_R_64F, MUSA_C_32F or MUSA_C_64F.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr or csr_row_ptr or csr_col_ind or csr_val is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if rows or cols or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: if row_ptr_type or col_ind_type or idx_base or data_type is invalid.

Parameters:

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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateDnVec

MUSPARSE_EXPORT musparseStatus_t musparseCreateDnVec(musparseDnVecDescr_t `descr, int64_t size, void `values, musparseDataType_t data_type)

Create a dense vector descriptor.

musparseCreateDnVec creates a dense vector descriptor. It should be destroyed at the end using musparseDestroyDnVec.

Parameters:

  • descr: the pointer to the dense vector descriptor.
  • size: size of the dense vector.
  • values: non-zero values in the dense vector (must be array of length size ).
  • data_type: MUSA_R_32F, MUSA_R_64F, MUSA_C_32F or MUSA_C_64F.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr or values is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if size is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: if data_type is invalid.

Parameters:

musparseDnVecDescr_t descr

  • int64_t size void values
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Macros

Functions

Function musparseCreate

MUSPARSE_EXPORT musparseStatus_t musparseCreate(musparseHandle_t *handle)

Create a musparse handle.

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().

Parameters:

  • handle: the pointer to the handle to the musparse library context.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the initialization succeeded.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle pointer is invalid.
  • MUSPARSE_STATUS_INTERNAL_ERROR: an internal error occurred.

Parameters:

musparseHandle_t handle

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroy

MUSPARSE_EXPORT musparseStatus_t musparseDestroy(musparseHandle_t handle)

Destroy a musparse handle.

musparseDestroy destroys the musparse library context and releases all resources used by the musparse library.

Parameters:

  • handle: the handle to the musparse library context.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle is invalid.
  • MUSPARSE_STATUS_INTERNAL_ERROR: an internal error occurred.

Parameters:

  • musparseHandle_t handle

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSetStream

MUSPARSE_EXPORT musparseStatus_t musparseSetStream(musparseHandle_t handle, musaStream_t stream)

Specify user defined MUSA stream.

musparseSetStream specifies the stream to be used by the musparse library context and all subsequent function calls.

Parameters:

  • handle: the handle to the musparse library context.
  • stream: the stream to be used by the musparse library context.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle is invalid.

Example:

This example illustrates, how a user defined stream can be used in musparse.

// Create musparse handle
musparseHandle_t handle;
musparseCreate(&handle);

// Create stream
MUstream stream;
musaStreamCreate(&stream);

// Set stream to musparse handle
musparseSetStream(handle, stream);

// Do some work
// ...

// Clean up
musparseDestroy(handle);
musaStreamDestroy(stream);

Parameters:

  • musparseHandle_t handle
  • musaStream_t stream

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetStream

MUSPARSE_EXPORT musparseStatus_t musparseGetStream(musparseHandle_t handle, musaStream_t *stream)

Get current stream from library context.

musparseGetStream gets the musparse library context stream which is currently used for all subsequent function calls.

Parameters:

  • handle: the handle to the musparse library context.
  • stream: the stream currently used by the musparse library context.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle is invalid.

Parameters:

  • musparseHandle_t handle musaStream_t stream

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSetPointerMode

MUSPARSE_EXPORT musparseStatus_t musparseSetPointerMode(musparseHandle_t handle, musparsePointerMode_t pointer_mode)

Specify pointer mode.

musparseSetPointerMode specifies the pointer mode to be used by the musparse library context and all subsequent function calls. By default, all values are passed by reference on the host. Valid pointer modes are MUSPARSE_POINTER_MODE_HOST or MUSPARSE_POINTER_MODE_DEVICE.

Parameters:

  • handle: the handle to the musparse library context.
  • pointer_mode: the pointer mode to be used by the musparse library context.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle is invalid.

Parameters:

  • musparseHandle_t handle
  • musparsePointerMode_t pointer_mode

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetPointerMode

MUSPARSE_EXPORT musparseStatus_t musparseGetPointerMode(musparseHandle_t handle, musparsePointerMode_t *pointer_mode)

Get current pointer mode from library context.

musparseGetPointerMode gets the musparse library context pointer mode which is currently used for all subsequent function calls.

Parameters:

  • handle: the handle to the musparse library context.
  • pointer_mode: the pointer mode that is currently used by the musparse library context.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle is invalid.

Parameters:

  • musparseHandle_t handle musparsePointerMode_t pointer_mode

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetVersion

MUSPARSE_EXPORT musparseStatus_t musparseGetVersion(musparseHandle_t handle, int *version)

Get musparse version.

musparseGetVersion gets the musparse library version number.

  • patch = version % 100

  • minor = version / 100 % 1000

  • major = version / 100000

Parameters:

  • handle: the handle to the musparse library context.
  • version: the version number of the musparse library.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle is invalid.

Parameters:

  • musparseHandle_t handle int version

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetGitRev

MUSPARSE_EXPORT musparseStatus_t musparseGetGitRev(musparseHandle_t handle, char *rev)

Get musparse git revision.

musparseGetGitRev gets the musparse library git commit revision (SHA-1).

Parameters:

  • handle: the handle to the musparse library context.
  • rev: the git commit revision (SHA-1).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: handle is invalid.

Parameters:

  • musparseHandle_t handle char rev

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateMatDescr

MUSPARSE_EXPORT musparseStatus_t musparseCreateMatDescr(musparseMatDescr_t *descr)

Create a matrix descriptor.

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().

Parameters:

  • descr: the pointer to the matrix descriptor.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr pointer is invalid.

Parameters:

musparseMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCopyMatDescr

MUSPARSE_EXPORT musparseStatus_t musparseCopyMatDescr(musparseMatDescr_t dest, const musparseMatDescr_t src)

Copy a matrix descriptor.

musparseCopyMatDescr copies a matrix descriptor. Both, source and destination matrix descriptors must be initialized prior to calling musparseCopyMatDescr.

Parameters:

  • dest: the pointer to the destination matrix descriptor.
  • src: the pointer to the source matrix descriptor.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: src or dest pointer is invalid.

Parameters:

  • musparseMatDescr_t dest
  • const musparseMatDescr_t src

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyMatDescr

MUSPARSE_EXPORT musparseStatus_t musparseDestroyMatDescr(musparseMatDescr_t descr)

Destroy a matrix descriptor.

musparseDestroyMatDescr destroys a matrix descriptor and releases all resources used by the descriptor.

Parameters:

  • descr: the matrix descriptor.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr is invalid.

Parameters:

  • musparseMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSetMatIndexBase

MUSPARSE_EXPORT musparseStatus_t musparseSetMatIndexBase(musparseMatDescr_t descr, musparseIndexBase_t base)

Specify the index base of a matrix descriptor.

musparseSetMatIndexBase sets the index base of a matrix descriptor. Valid options are MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Parameters:

  • descr: the matrix descriptor.
  • base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr pointer is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: base is invalid.

Parameters:

  • musparseMatDescr_t descr
  • musparseIndexBase_t base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetMatIndexBase

MUSPARSE_EXPORT musparseIndexBase_t musparseGetMatIndexBase(const musparseMatDescr_t descr)

Get the index base of a matrix descriptor.

musparseGetMatIndexBase returns the index base of a matrix descriptor.

Parameters:

  • descr: the matrix descriptor.

Returns:

MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Parameters:

  • const musparseMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseIndexBase_t

Function musparseSetMatType

MUSPARSE_EXPORT musparseStatus_t musparseSetMatType(musparseMatDescr_t descr, musparseMatrixType_t type)

Specify the matrix type of a matrix descriptor.

musparseSetMatType sets the matrix type of a matrix descriptor. Valid matrix types are MUSPARSE_MATRIX_TYPE_GENERAL, MUSPARSE_MATRIX_TYPE_SYMMETRIC, MUSPARSE_MATRIX_TYPE_HERMITIAN or MUSPARSE_MATRIX_TYPE_TRIANGULAR.

Parameters:

  • descr: the matrix descriptor.
  • type: MUSPARSE_MATRIX_TYPE_GENERAL, MUSPARSE_MATRIX_TYPE_SYMMETRIC, MUSPARSE_MATRIX_TYPE_HERMITIAN or MUSPARSE_MATRIX_TYPE_TRIANGULAR.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr pointer is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: type is invalid.

Parameters:

  • musparseMatDescr_t descr
  • musparseMatrixType_t type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetMatType

MUSPARSE_EXPORT musparseMatrixType_t musparseGetMatType(const musparseMatDescr_t descr)

Get the matrix type of a matrix descriptor.

musparseGetMatType returns the matrix type of a matrix descriptor.

Parameters:

  • descr: the matrix descriptor.

Returns:

MUSPARSE_MATRIX_TYPE_GENERAL, MUSPARSE_MATRIX_TYPE_SYMMETRIC, MUSPARSE_MATRIX_TYPE_HERMITIAN or MUSPARSE_MATRIX_TYPE_TRIANGULAR.

Parameters:

  • const musparseMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseMatrixType_t

Function musparseSetMatFillMode

MUSPARSE_EXPORT musparseStatus_t musparseSetMatFillMode(musparseMatDescr_t descr, musparseFillMode_t fill_mode)

Specify the matrix fill mode of a matrix descriptor.

musparseSetMatFillMode sets the matrix fill mode of a matrix descriptor. Valid fill modes are MUSPARSE_FILL_MODE_LOWER or MUSPARSE_FILL_MODE_UPPER.

Parameters:

  • descr: the matrix descriptor.
  • fill_mode: MUSPARSE_FILL_MODE_LOWER or MUSPARSE_FILL_MODE_UPPER.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr pointer is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: fill_mode is invalid.

Parameters:

  • musparseMatDescr_t descr
  • musparseFillMode_t fill_mode

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetMatFillMode

MUSPARSE_EXPORT musparseFillMode_t musparseGetMatFillMode(const musparseMatDescr_t descr)

Get the matrix fill mode of a matrix descriptor.

musparseGetMatFillMode returns the matrix fill mode of a matrix descriptor.

Parameters:

  • descr: the matrix descriptor.

Returns:

MUSPARSE_FILL_MODE_LOWER or MUSPARSE_FILL_MODE_UPPER.

Parameters:

  • const musparseMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseFillMode_t

Function musparseSetMatDiagType

MUSPARSE_EXPORT musparseStatus_t musparseSetMatDiagType(musparseMatDescr_t descr, musparseDiagType_t diag_type)

Specify the matrix diagonal type of a matrix descriptor.

musparseSetMatDiagType sets the matrix diagonal type of a matrix descriptor. Valid diagonal types are MUSPARSE_DIAG_TYPE_UNIT or MUSPARSE_DIAG_TYPE_NON_UNIT.

Parameters:

  • descr: the matrix descriptor.
  • diag_type: MUSPARSE_DIAG_TYPE_UNIT or MUSPARSE_DIAG_TYPE_NON_UNIT.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr pointer is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: diag_type is invalid.

Parameters:

  • musparseMatDescr_t descr
  • musparseDiagType_t diag_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetMatDiagType

MUSPARSE_EXPORT musparseDiagType_t musparseGetMatDiagType(const musparseMatDescr_t descr)

Get the matrix diagonal type of a matrix descriptor.

musparseGetMatDiagType returns the matrix diagonal type of a matrix descriptor.

Parameters:

  • descr: the matrix descriptor.

Returns:

MUSPARSE_DIAG_TYPE_UNIT or MUSPARSE_DIAG_TYPE_NON_UNIT.

Parameters:

  • const musparseMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseDiagType_t

Function musparseSetMatStorageMode

MUSPARSE_EXPORT musparseStatus_t musparseSetMatStorageMode(musparseMatDescr_t descr, musparseStorageMode_t storage_mode)

Specify the matrix storage mode of a matrix descriptor.

musparseSetMatStorageMode sets the matrix storage mode of a matrix descriptor. Valid fill modes are MUSPARSE_STORAGE_MODE_SORTED or MUSPARSE_STORAGE_MODE_UNSORTED.

Parameters:

  • descr: the matrix descriptor.
  • storage_mode: MUSPARSE_STORAGE_MODE_SORTED or MUSPARSE_STORAGE_MODE_UNSORTED.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr pointer is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: storage_mode is invalid.

Parameters:

  • musparseMatDescr_t descr
  • musparseStorageMode_t storage_mode

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetMatStorageMode

MUSPARSE_EXPORT musparseStorageMode_t musparseGetMatStorageMode(const musparseMatDescr_t descr)

Get the matrix storage mode of a matrix descriptor.

musparseGetMatStorageMode returns the matrix storage mode of a matrix descriptor.

Parameters:

  • descr: the matrix descriptor.

Returns:

MUSPARSE_STORAGE_MODE_SORTED or MUSPARSE_STORAGE_MODE_UNSORTED.

Parameters:

  • const musparseMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseStorageMode_t

Function musparseCreateHybMat

MUSPARSE_EXPORT musparseStatus_t musparseCreateHybMat(musparseHybMat_t *hyb)

Create a HYB matrix structure.

musparseCreateHybMat creates a structure that holds the matrix in HYB storage format. It should be destroyed at the end using musparseDestroyHybMat().

Parameters:

  • hyb: the pointer to the hybrid matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: hyb pointer is invalid.

Parameters:

musparseHybMat_t hyb

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCopyHybMat

MUSPARSE_EXPORT musparseStatus_t musparseCopyHybMat(musparseHybMat_t dest, const musparseHybMat_t src)

Copy a HYB matrix structure.

musparseCopyHybMat copies a matrix info structure. Both, source and destination matrix info structure must be initialized prior to calling musparseCopyHybMat.

Parameters:

  • dest: the pointer to the destination matrix info structure.
  • src: the pointer to the source matrix info structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: hyb pointer is invalid.

Parameters:

  • musparseHybMat_t dest
  • const musparseHybMat_t src

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyHybMat

MUSPARSE_EXPORT musparseStatus_t musparseDestroyHybMat(musparseHybMat_t hyb)

Destroy a HYB matrix structure.

musparseDestroyHybMat destroys a HYB structure.

Parameters:

  • hyb: the hybrid matrix structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: hyb pointer is invalid.
  • MUSPARSE_STATUS_INTERNAL_ERROR: an internal error occurred.

Parameters:

  • musparseHybMat_t hyb

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateMatInfo

MUSPARSE_EXPORT musparseStatus_t musparseCreateMatInfo(musparseMatInfo_t *info)

Create a matrix info structure.

musparseCreateMatInfo creates a structure that holds the matrix info data that is gathered during the analysis routines available. It should be destroyed at the end using musparseDestroyMatInfo().

Parameters:

  • info: the pointer to the info structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.

Parameters:

musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCopyMatInfo

MUSPARSE_EXPORT musparseStatus_t musparseCopyMatInfo(musparseMatInfo_t dest, const musparseMatInfo_t src)

Copy a matrix info structure.

musparseCopyMatInfo copies a matrix info structure. Both, source and destination matrix info structure must be initialized prior to calling musparseCopyMatInfo.

Parameters:

  • dest: the pointer to the destination matrix info structure.
  • src: the pointer to the source matrix info structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: src or dest pointer is invalid.

Parameters:

  • musparseMatInfo_t dest
  • const musparseMatInfo_t src

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyMatInfo

MUSPARSE_EXPORT musparseStatus_t musparseDestroyMatInfo(musparseMatInfo_t info)

Destroy a matrix info structure.

musparseDestroyMatInfo destroys a matrix info structure.

Parameters:

  • info: the info structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_STATUS_INTERNAL_ERROR: an internal error occurred.

Parameters:

  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateColorInfo

MUSPARSE_EXPORT musparseStatus_t musparseCreateColorInfo(musparseColorInfo_t *info)

Create a color info structure.

musparseCreateColorInfo creates a structure that holds the color info data that is gathered during the analysis routines available. It should be destroyed at the end using musparseDestroyColorInfo().

Parameters:

  • info: the pointer to the info structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.

Parameters:

musparseColorInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCopyColorInfo

MUSPARSE_EXPORT musparseStatus_t musparseCopyColorInfo(musparseColorInfo_t dest, const musparseColorInfo_t src)

Copy a color info structure.

musparseCopyColorInfo copies a color info structure. Both, source and destination color info structure must be initialized prior to calling musparseCopyColorInfo.

Parameters:

  • dest: the pointer to the destination color info structure.
  • src: the pointer to the source color info structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: src or dest pointer is invalid.

Parameters:

  • musparseColorInfo_t dest
  • const musparseColorInfo_t src

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyColorInfo

MUSPARSE_EXPORT musparseStatus_t musparseDestroyColorInfo(musparseColorInfo_t info)

Destroy a color info structure.

musparseDestroyColorInfo destroys a color info structure.

Parameters:

  • info: the info structure.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_STATUS_INTERNAL_ERROR: an internal error occurred.

Parameters:

  • musparseColorInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateSpVec

MUSPARSE_EXPORT musparseStatus_t musparseCreateSpVec(musparseSpVecDescr_t `descr, int64_t size, int64_t nnz, void `indices, void *values, musparseIndexType_t idx_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseSpVecDescr_t descr

  • int64_t size
  • int64_t nnz void indices void values
  • musparseIndexType_t idx_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstSpVec

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstSpVec(musparseConstSpVecDescr_t `descr, int64_t size, int64_t nnz, const void `indices, const void *values, musparseIndexType_t idx_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseConstSpVecDescr_t descr

  • int64_t size
  • int64_t nnz const void indices const void values
  • musparseIndexType_t idx_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroySpVec

MUSPARSE_EXPORT musparseStatus_t musparseDestroySpVec(musparseConstSpVecDescr_t descr)

Parameters:

  • musparseConstSpVecDescr_t descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpVecGet

MUSPARSE_EXPORT musparseStatus_t musparseSpVecGet(musparseSpVecDescr_t descr, int64_t `size, int64_t `nnz, void `indices, void `values, musparseIndexType_t `idx_type, musparseIndexBase_t `idx_base, musparseDataType_t *data_type)

Parameters:

  • musparseSpVecDescr_t descr int64_t size int64_t nnz void indices* void values* musparseIndexType_t idx_type musparseIndexBase_t idx_base musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpVecGetIndexBase

MUSPARSE_EXPORT musparseStatus_t musparseSpVecGetIndexBase(musparseConstSpVecDescr_t descr, musparseIndexBase_t *idx_base)

Parameters:

  • musparseConstSpVecDescr_t descr musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpVecGetValues

MUSPARSE_EXPORT musparseStatus_t musparseSpVecGetValues(musparseSpVecDescr_t descr, void ``values)

Parameters:

  • musparseSpVecDescr_t descr void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpVecSetValues

MUSPARSE_EXPORT musparseStatus_t musparseSpVecSetValues(musparseSpVecDescr_t descr, void *values)

Parameters:

  • musparseSpVecDescr_t descr void values

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateCoo

MUSPARSE_EXPORT musparseStatus_t musparseCreateCoo(musparseSpMatDescr_t `descr, int64_t rows, int64_t cols, int64_t nnz, void `coo_row_ind, void `coo_col_ind, void `coo_val, musparseIndexType_t idx_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseSpMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • int64_t nnz void coo_row_ind void coo_col_ind void coo_val
  • musparseIndexType_t idx_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateCooAos

MUSPARSE_EXPORT musparseStatus_t musparseCreateCooAos(musparseSpMatDescr_t `descr, int64_t rows, int64_t cols, int64_t nnz, void `coo_ind, void *coo_val, musparseIndexType_t idx_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseSpMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • int64_t nnz void coo_ind void coo_val
  • musparseIndexType_t idx_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstCsr

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstCsr(musparseConstSpMatDescr_t `spMatDescr, int64_t rows, int64_t cols, int64_t nnz, const void `csrRowOffsets, const void `csrColInd, const void `csrValues, musparseIndexType_t csrRowOffsetsType, musparseIndexType_t csrColIndType, musparseIndexBase_t idxBase, musaDataType valueType)

Parameters:

musparseConstSpMatDescr_t spMatDescr

  • int64_t rows
  • int64_t cols
  • int64_t nnz const void csrRowOffsets const void csrColInd const void csrValues
  • musparseIndexType_t csrRowOffsetsType
  • musparseIndexType_t csrColIndType
  • musparseIndexBase_t idxBase
  • musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateCsc

MUSPARSE_EXPORT musparseStatus_t musparseCreateCsc(musparseSpMatDescr_t `descr, int64_t rows, int64_t cols, int64_t nnz, void `csc_col_ptr, void `csc_row_ind, void `csc_val, musparseIndexType_t col_ptr_type, musparseIndexType_t row_ind_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseSpMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • int64_t nnz void csc_col_ptr void csc_row_ind void csc_val
  • musparseIndexType_t col_ptr_type
  • musparseIndexType_t row_ind_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateEll

MUSPARSE_EXPORT musparseStatus_t musparseCreateEll(musparseSpMatDescr_t `descr, int64_t rows, int64_t cols, void `ell_col_ind, void *ell_val, int64_t ell_width, musparseIndexType_t idx_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseSpMatDescr_t descr

  • int64_t rows
  • int64_t cols void ell_col_ind void ell_val
  • int64_t ell_width
  • musparseIndexType_t idx_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateBlockedEll_legacy

MUSPARSE_EXPORT musparseStatus_t musparseCreateBlockedEll_legacy(musparseSpMatDescr_t `descr, int64_t rows, int64_t cols, musparseDirection_t ell_block_dir, int64_t ell_block_dim, int64_t ell_cols, void `ell_col_ind, void *ell_val, musparseIndexType_t idx_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseSpMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • musparseDirection_t ell_block_dir
  • int64_t ell_block_dim
  • int64_t ell_cols void ell_col_ind void ell_val
  • musparseIndexType_t idx_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroySpMat

MUSPARSE_EXPORT musparseStatus_t musparseDestroySpMat(musparseConstSpMatDescr_t descr)

Parameters:

  • musparseConstSpMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCooAosGet

MUSPARSE_EXPORT musparseStatus_t musparseCooAosGet(const musparseSpMatDescr_t descr, int64_t `rows, int64_t `cols, int64_t `nnz, void `coo_ind, void `coo_val, musparseIndexType_t `idx_type, musparseIndexBase_t `idx_base, musparseDataType_t `data_type)

Parameters:

  • const musparseSpMatDescr_t descr int64_t rows int64_t cols int64_t nnz void coo_ind* void coo_val* musparseIndexType_t idx_type musparseIndexBase_t idx_base musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCooGet

MUSPARSE_EXPORT musparseStatus_t musparseCooGet(const musparseSpMatDescr_t descr, int64_t `rows, int64_t `cols, int64_t `nnz, void `coo_row_ind, void `coo_col_ind, void ``coo_val, musparseIndexType_t `idx_type, musparseIndexBase_t `idx_base, musparseDataType_t `data_type)

Parameters:

  • const musparseSpMatDescr_t descr int64_t rows int64_t cols int64_t nnz void coo_row_ind* void coo_col_ind* void coo_val* musparseIndexType_t idx_type musparseIndexBase_t idx_base musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCsrGet

MUSPARSE_EXPORT musparseStatus_t musparseCsrGet(const 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)

Parameters:

  • const 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseEllGet

MUSPARSE_EXPORT musparseStatus_t musparseEllGet(const musparseSpMatDescr_t descr, int64_t `rows, int64_t `cols, void `ell_col_ind, void `ell_val, int64_t `ell_width, musparseIndexType_t `idx_type, musparseIndexBase_t `idx_base, musparseDataType_t `data_type)

Parameters:

  • const musparseSpMatDescr_t descr int64_t rows int64_t cols void ell_col_ind* void ell_val* int64_t ell_width musparseIndexType_t idx_type musparseIndexBase_t idx_base musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseBlockedEllGet_legacy

MUSPARSE_EXPORT musparseStatus_t musparseBlockedEllGet_legacy(const musparseSpMatDescr_t descr, int64_t `rows, int64_t `cols, musparseDirection_t `ell_block_dir, int64_t `ell_block_dim, int64_t `ell_cols, void `ell_col_ind, void `ell_val, musparseIndexType_t `idx_type, musparseIndexBase_t `idx_base, musparseDataType_t `data_type)

Parameters:

  • const musparseSpMatDescr_t descr int64_t rows int64_t cols musparseDirection_t ell_block_dir int64_t ell_block_dim int64_t ell_cols void ell_col_ind* void ell_val* musparseIndexType_t idx_type musparseIndexBase_t idx_base musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCooSetPointers

MUSPARSE_EXPORT musparseStatus_t musparseCooSetPointers(musparseSpMatDescr_t descr, void `coo_row_ind, void `coo_col_ind, void *coo_val)

Parameters:

  • musparseSpMatDescr_t descr void coo_row_ind void coo_col_ind void coo_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCooAosSetPointers

MUSPARSE_EXPORT musparseStatus_t musparseCooAosSetPointers(musparseSpMatDescr_t descr, void `coo_ind, void `coo_val)

Parameters:

  • musparseSpMatDescr_t descr void coo_ind void coo_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCsrSetPointers

MUSPARSE_EXPORT musparseStatus_t musparseCsrSetPointers(musparseSpMatDescr_t descr, void `csr_row_ptr, void `csr_col_ind, void *csr_val)

Parameters:

  • musparseSpMatDescr_t descr void csr_row_ptr void csr_col_ind void csr_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCscSetPointers

MUSPARSE_EXPORT musparseStatus_t musparseCscSetPointers(musparseSpMatDescr_t descr, void `csc_col_ptr, void `csc_row_ind, void *csc_val)

Parameters:

  • musparseSpMatDescr_t descr void csc_col_ptr void csc_row_ind void csc_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseEllSetPointers

MUSPARSE_EXPORT musparseStatus_t musparseEllSetPointers(musparseSpMatDescr_t descr, void `ell_col_ind, void `ell_val)

Parameters:

  • musparseSpMatDescr_t descr void ell_col_ind void ell_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatGetSize

MUSPARSE_EXPORT musparseStatus_t musparseSpMatGetSize(musparseConstSpMatDescr_t descr, int64_t `rows, int64_t `cols, int64_t *nnz)

Parameters:

  • musparseConstSpMatDescr_t descr int64_t rows int64_t cols int64_t nnz

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatGetFormat

MUSPARSE_EXPORT musparseStatus_t musparseSpMatGetFormat(const musparseSpMatDescr_t descr, musparseFormat_t *format)

Parameters:

  • const musparseSpMatDescr_t descr musparseFormat_t format

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatGetIndexBase

MUSPARSE_EXPORT musparseStatus_t musparseSpMatGetIndexBase(const musparseConstSpMatDescr_t descr, musparseIndexBase_t *idx_base)

Parameters:

  • const musparseConstSpMatDescr_t descr musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatGetValues

MUSPARSE_EXPORT musparseStatus_t musparseSpMatGetValues(musparseSpMatDescr_t descr, void ``values)

Parameters:

  • musparseSpMatDescr_t descr void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatSetValues

MUSPARSE_EXPORT musparseStatus_t musparseSpMatSetValues(musparseSpMatDescr_t descr, void *values)

Parameters:

  • musparseSpMatDescr_t descr void values

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatGetAttribute

MUSPARSE_EXPORT musparseStatus_t musparseSpMatGetAttribute(musparseSpMatDescr_t descr, musparseSpMatAttribute_t attribute, void *data, size_t data_size)

Parameters:

  • musparseSpMatDescr_t descr
  • musparseSpMatAttribute_t attribute void data
  • size_t data_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatSetAttribute

MUSPARSE_EXPORT musparseStatus_t musparseSpMatSetAttribute(musparseSpMatDescr_t descr, musparseSpMatAttribute_t attribute, const void *data, size_t data_size)

Parameters:

  • musparseSpMatDescr_t descr
  • musparseSpMatAttribute_t attribute const void data
  • size_t data_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyDnVec

MUSPARSE_EXPORT musparseStatus_t musparseDestroyDnVec(musparseDnVecDescr_t descr)

Destroy a dense vector descriptor.

musparseDestroyDnVec destroys a dense vector descriptor and releases all resources used by the descriptor.

Parameters:

  • descr: the matrix descriptor.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: descr is invalid.

Parameters:

  • musparseDnVecDescr_t descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnVecGet

MUSPARSE_EXPORT musparseStatus_t musparseDnVecGet(const musparseDnVecDescr_t descr, int64_t `size, void ``values, musparseDataType_t `data_type)

Parameters:

  • const musparseDnVecDescr_t descr int64_t size void values* musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnVecGetValues

MUSPARSE_EXPORT musparseStatus_t musparseDnVecGetValues(const musparseDnVecDescr_t descr, void ``values)

Parameters:

  • const musparseDnVecDescr_t descr void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnVecSetValues

MUSPARSE_EXPORT musparseStatus_t musparseDnVecSetValues(musparseDnVecDescr_t descr, void *values)

Parameters:

  • musparseDnVecDescr_t descr void values

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateDnMat

MUSPARSE_EXPORT musparseStatus_t musparseCreateDnMat(musparseDnMatDescr_t `descr, int64_t rows, int64_t cols, int64_t ld, void `values, musparseDataType_t data_type, musparseOrder_t order)

Parameters:

musparseDnMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • int64_t ld void values
  • musparseDataType_t data_type
  • musparseOrder_t order

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyDnMat

MUSPARSE_EXPORT musparseStatus_t musparseDestroyDnMat(musparseDnMatDescr_t descr)

Parameters:

  • musparseDnMatDescr_t descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnMatGet

MUSPARSE_EXPORT musparseStatus_t musparseDnMatGet(const musparseDnMatDescr_t descr, int64_t `rows, int64_t `cols, int64_t `ld, void ``values, musparseDataType_t `data_type, musparseOrder_t *order)

Parameters:

  • const musparseDnMatDescr_t descr int64_t rows int64_t cols int64_t ld void values* musparseDataType_t data_type musparseOrder_t order

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnMatGetValues

MUSPARSE_EXPORT musparseStatus_t musparseDnMatGetValues(const musparseDnMatDescr_t descr, void ``values)

Parameters:

  • const musparseDnMatDescr_t descr void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnMatSetValues

MUSPARSE_EXPORT musparseStatus_t musparseDnMatSetValues(musparseDnMatDescr_t descr, void *values)

Parameters:

  • musparseDnMatDescr_t descr void values

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnMatGetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseDnMatGetStridedBatch(musparseConstDnMatDescr_t descr, int `batch_count, int64_t `batch_stride)

Get the batch count and batch stride from the dense matrix descriptor.

Parameters:

  • descr: the pointer to the dense matrix descriptor.
  • batch_count: the batch count in the dense matrix.
  • batch_stride: the batch stride in the dense matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if batch_count or batch_stride is invalid.

Parameters:

  • musparseConstDnMatDescr_t descr int batch_count int64_t batch_stride

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnMatSetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseDnMatSetStridedBatch(musparseDnMatDescr_t descr, int batch_count, int64_t batch_stride)

Set the batch count and batch stride in the dense matrix descriptor.

Parameters:

  • descr: the pointer to the dense matrix descriptor.
  • batch_count: the batch count in the dense matrix.
  • batch_stride: the batch stride in the dense matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if batch_count or batch_stride is invalid.

Parameters:

  • musparseDnMatDescr_t descr
  • int batch_count
  • int64_t batch_stride

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatGetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseSpMatGetStridedBatch(musparseConstSpMatDescr_t descr, int *batch_count)

Parameters:

  • musparseConstSpMatDescr_t descr int batch_count

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMatSetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseSpMatSetStridedBatch(musparseSpMatDescr_t descr, int batch_count)

Set the strided batch count in the sparse matrix descriptor.

Parameters:

  • descr: the pointer to the sparse matrix descriptor.
  • batch_count: batch_count of the sparse matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if batch_count is invalid.

Parameters:

  • musparseSpMatDescr_t descr
  • int batch_count

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCooSetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseCooSetStridedBatch(musparseSpMatDescr_t descr, int batch_count, int64_t batch_stride)

Set the batch count and batch stride in the sparse COO matrix descriptor.

Parameters:

  • descr: the pointer to the sparse COO matrix descriptor.
  • batch_count: batch_count of the sparse COO matrix.
  • batch_stride: batch stride of the sparse COO matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if batch_count or batch_stride is invalid.

Parameters:

  • musparseSpMatDescr_t descr
  • int batch_count
  • int64_t batch_stride

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCsrSetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseCsrSetStridedBatch(musparseSpMatDescr_t descr, int batch_count, int64_t offsets_batch_stride, int64_t columns_values_batch_stride)

Set the batch count, row offset batch stride and the column indices batch stride in the sparse CSR matrix descriptor.

Parameters:

  • descr: the pointer to the sparse CSR matrix descriptor.
  • batch_count: batch_count of the sparse CSR matrix.
  • offsets_batch_stride: row offset batch stride of the sparse CSR matrix.
  • columns_values_batch_stride: column indices batch stride of the sparse CSR matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if batch_count or offsets_batch_stride or columns_values_batch_stride is invalid.

Parameters:

  • musparseSpMatDescr_t descr
  • int batch_count
  • int64_t offsets_batch_stride
  • int64_t columns_values_batch_stride

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCscSetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseCscSetStridedBatch(musparseSpMatDescr_t descr, int batch_count, int64_t offsets_batch_stride, int64_t rows_values_batch_stride)

Set the batch count, column offset batch stride and the row indices batch stride in the sparse CSC matrix descriptor.

Parameters:

  • descr: the pointer to the sparse CSC matrix descriptor.
  • batch_count: batch_count of the sparse CSC matrix.
  • offsets_batch_stride: column offset batch stride of the sparse CSC matrix.
  • rows_values_batch_stride: row indices batch stride of the sparse CSC matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_POINTER: if descr is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: if batch_count or offsets_batch_stride or rows_values_batch_stride is invalid.

Parameters:

  • musparseSpMatDescr_t descr
  • int batch_count
  • int64_t offsets_batch_stride
  • int64_t rows_values_batch_stride

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGetErrorName

MUSPARSE_EXPORT const char * musparseGetErrorName(musparseStatus_t status)

Get the number of rows, columns and non-zeros from the sparse matrix descriptor.

Parameters:

  • descr: the pointer to the sparse matrix descriptor.
  • rows: number of rows in the sparse matrix.
  • cols: number of columns in the sparse matrix.
  • nnz: number of non-zeros in sparse matrix.

Return values:

  • musparse_status_success: the operation completed successfully.
  • musparse_status_invalid_pointer: if descr is invalid.
  • musparse_status_invalid_size: if rows or cols or nnz is invalid.

Parameters:

  • musparseStatus_t status

Return type: MUSPARSE_EXPORT const char *

Function musparseGetErrorString

MUSPARSE_EXPORT const char * musparseGetErrorString(musparseStatus_t status)

Parameters:

  • musparseStatus_t status

Return type: MUSPARSE_EXPORT const char *

Function musparseGetProperty

MUSPARSE_EXPORT musparseStatus_t musparseGetProperty(libraryPropertyType type, int *value)

Parameters:

  • libraryPropertyType type int value

Return type: MUSPARSE_EXPORT musparseStatus_t


File musparse-compatible.h

Location: musparse-compatible.h

Macros

Typedefs

Typedef musparseLoggerCallback_t

Definition: musparse-compatible.h (line 3109)

typedef void(` musparseLoggerCallback_t) (int logLevel, const char `functionName, const char *message)

Return type: void(*

Functions

Function musparseCreateCsric02Info

MUSPARSE_EXPORT musparseStatus_t musparseCreateCsric02Info(csric02Info_t *info)

Parameters:

csric02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyCsric02Info

MUSPARSE_EXPORT musparseStatus_t musparseDestroyCsric02Info(csric02Info_t info)

Parameters:

  • csric02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateBsric02Info

MUSPARSE_EXPORT musparseStatus_t musparseCreateBsric02Info(bsric02Info_t *info)

Parameters:

bsric02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyBsric02Info

MUSPARSE_EXPORT musparseStatus_t musparseDestroyBsric02Info(bsric02Info_t info)

Parameters:

  • bsric02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateCsrilu02Info

MUSPARSE_EXPORT musparseStatus_t musparseCreateCsrilu02Info(csrilu02Info_t *info)

Parameters:

csrilu02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyCsrilu02Info

MUSPARSE_EXPORT musparseStatus_t musparseDestroyCsrilu02Info(csrilu02Info_t info)

Parameters:

  • csrilu02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateBsrilu02Info

MUSPARSE_EXPORT musparseStatus_t musparseCreateBsrilu02Info(bsrilu02Info_t *info)

Parameters:

bsrilu02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyBsrilu02Info

MUSPARSE_EXPORT musparseStatus_t musparseDestroyBsrilu02Info(bsrilu02Info_t info)

Parameters:

  • bsrilu02Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateBsrsv2Info

MUSPARSE_EXPORT musparseStatus_t musparseCreateBsrsv2Info(bsrsv2Info_t *info)

Parameters:

bsrsv2Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyBsrsv2Info

MUSPARSE_EXPORT musparseStatus_t musparseDestroyBsrsv2Info(bsrsv2Info_t info)

Parameters:

  • bsrsv2Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateBsrsm2Info

MUSPARSE_EXPORT musparseStatus_t musparseCreateBsrsm2Info(bsrsm2Info_t *info)

Parameters:

bsrsm2Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyBsrsm2Info

MUSPARSE_EXPORT musparseStatus_t musparseDestroyBsrsm2Info(bsrsm2Info_t info)

Parameters:

  • bsrsm2Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateCsru2csrInfo

MUSPARSE_EXPORT musparseStatus_t musparseCreateCsru2csrInfo(csru2csrInfo_t *info)

Parameters:

csru2csrInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyCsru2csrInfo

MUSPARSE_EXPORT musparseStatus_t musparseDestroyCsru2csrInfo(csru2csrInfo_t info)

Parameters:

  • csru2csrInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreatePruneInfo

MUSPARSE_EXPORT musparseStatus_t musparseCreatePruneInfo(pruneInfo_t *info)

Parameters:

pruneInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyPruneInfo

MUSPARSE_EXPORT musparseStatus_t musparseDestroyPruneInfo(pruneInfo_t info)

Parameters:

  • pruneInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu02_numericBoost(musparseHandle_t handle, csrilu02Info_t info, muInt enable_boost, double `tol, float `boost_val)

Parameters:

  • musparseHandle_t handle
  • csrilu02Info_t info
  • muInt enable_boost double tol float boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu02_numericBoost(musparseHandle_t handle, csrilu02Info_t info, muInt enable_boost, double `tol, double `boost_val)

Parameters:

  • musparseHandle_t handle
  • csrilu02Info_t info
  • muInt enable_boost double tol double boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu02_numericBoost(musparseHandle_t handle, csrilu02Info_t info, muInt enable_boost, double `tol, muComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • csrilu02Info_t info
  • muInt enable_boost double tol muComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu02_numericBoost(musparseHandle_t handle, csrilu02Info_t info, muInt enable_boost, double `tol, muDoubleComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • csrilu02Info_t info
  • muInt enable_boost double tol muDoubleComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrilu02_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXcsrilu02_zeroPivot(musparseHandle_t handle, csrilu02Info_t info, muInt *position)

Parameters:

  • musparseHandle_t handle
  • csrilu02Info_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu02_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, float `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, muInt `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA float csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info muInt pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu02_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, double `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, muInt `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA double csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info muInt pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu02_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, muComplex `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, muInt `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA muComplex csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info muInt pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu02_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, muDoubleComplex `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, muInt `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA muDoubleComplex csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info muInt pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu02_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, const float `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA const float csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu02_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, const double `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA const double csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu02_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, const muComplex `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA const muComplex csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu02_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, const muDoubleComplex `csrSortedValA, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA const muDoubleComplex csrSortedValA const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu02(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, float `csrSortedValA_valM, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA float csrSortedValA_valM const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu02(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, double `csrSortedValA_valM, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA double csrSortedValA_valM const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu02(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, muComplex `csrSortedValA_valM, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA muComplex csrSortedValA_valM const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu02(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descrA, muDoubleComplex `csrSortedValA_valM, const muInt `csrSortedRowPtrA, const muInt `csrSortedColIndA, csrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descrA muDoubleComplex csrSortedValA_valM const muInt csrSortedRowPtrA const muInt csrSortedColIndA
  • csrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrilu02_clear

MUSPARSE_EXPORT musparseStatus_t musparseXcsrilu02_clear(musparseHandle_t handle, musparseMatInfo_t info)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSV_createDescr

MUSPARSE_EXPORT musparseStatus_t musparseSpSV_createDescr(musparseSpSVDescr_t *spsvDescr)

Parameters:

musparseSpSVDescr_t spsvDescr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSV_destroyDescr

MUSPARSE_EXPORT musparseStatus_t musparseSpSV_destroyDescr(musparseSpSVDescr_t spsvDescr)

Parameters:

  • musparseSpSVDescr_t spsvDescr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSV_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpSV_bufferSize(musparseHandle_t handle, musparseOperation_t trans, const void `alpha, musparseSpMatDescr_t mat, musparseDnVecDescr_t x, musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpSVAlg_t alg, musparseSpSVDescr_t spsvDescr, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const void alpha
  • musparseSpMatDescr_t mat
  • musparseDnVecDescr_t x
  • musparseDnVecDescr_t y
  • musparseDataType_t compute_type
  • musparseSpSVAlg_t alg
  • musparseSpSVDescr_t spsvDescr size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSV_analysis

MUSPARSE_EXPORT musparseStatus_t musparseSpSV_analysis(musparseHandle_t handle, musparseOperation_t trans, const void `alpha, musparseSpMatDescr_t mat, musparseDnVecDescr_t x, musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpSVAlg_t alg, musparseSpSVDescr_t spsvDescr, void `buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const void alpha
  • musparseSpMatDescr_t mat
  • musparseDnVecDescr_t x
  • musparseDnVecDescr_t y
  • musparseDataType_t compute_type
  • musparseSpSVAlg_t alg
  • musparseSpSVDescr_t spsvDescr void buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSV_solve

MUSPARSE_EXPORT musparseStatus_t musparseSpSV_solve(musparseHandle_t handle, musparseOperation_t trans, const void *alpha, musparseSpMatDescr_t mat, musparseDnVecDescr_t x, musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpSVAlg_t alg, musparseSpSVDescr_t spsvDescr)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const void alpha
  • musparseSpMatDescr_t mat
  • musparseDnVecDescr_t x
  • musparseDnVecDescr_t y
  • musparseDataType_t compute_type
  • musparseSpSVAlg_t alg
  • musparseSpSVDescr_t spsvDescr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseSbsrilu02_numericBoost(musparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double `tol, float `boost_val)

Parameters:

  • musparseHandle_t handle
  • bsrilu02Info_t info
  • int enable_boost double tol float boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDbsrilu02_numericBoost(musparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double `tol, double `boost_val)

Parameters:

  • musparseHandle_t handle
  • bsrilu02Info_t info
  • int enable_boost double tol double boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseCbsrilu02_numericBoost(musparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double `tol, muComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • bsrilu02Info_t info
  • int enable_boost double tol muComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu02_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseZbsrilu02_numericBoost(musparseHandle_t handle, bsrilu02Info_t info, int enable_boost, double `tol, muDoubleComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • bsrilu02Info_t info
  • int enable_boost double tol muDoubleComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsrilu02_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXbsrilu02_zeroPivot(musparseHandle_t handle, bsrilu02Info_t info, int *position)

Parameters:

  • musparseHandle_t handle
  • bsrilu02Info_t info int position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSbsrilu02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDbsrilu02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCbsrilu02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZbsrilu02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSbsrilu02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrilu02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrilu02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDbsrilu02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrilu02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrilu02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCbsrilu02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrilu02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrilu02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZbsrilu02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrilu02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrilu02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseSbsrilu02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDbsrilu02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCbsrilu02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZbsrilu02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseSbsrilu02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseDbsrilu02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseCbsrilu02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu02

MUSPARSE_EXPORT musparseStatus_t musparseZbsrilu02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsrilu02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsrilu02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsric02_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXcsric02_zeroPivot(musparseHandle_t handle, csric02Info_t info, int *position)

Parameters:

  • musparseHandle_t handle
  • csric02Info_t info int position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsric02_bufferSize(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsric02_bufferSize(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsric02_bufferSize(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, muComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA muComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsric02_bufferSize(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, muDoubleComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA muDoubleComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseScsric02_bufferSizeExt(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, float `csrSortedVal, const int `csrSortedRowPtr, const int `csrSortedColInd, csric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA float csrSortedVal const int csrSortedRowPtr const int csrSortedColInd
  • csric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDcsric02_bufferSizeExt(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, double `csrSortedVal, const int `csrSortedRowPtr, const int `csrSortedColInd, csric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA double csrSortedVal const int csrSortedRowPtr const int csrSortedColInd
  • csric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCcsric02_bufferSizeExt(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, muComplex `csrSortedVal, const int `csrSortedRowPtr, const int `csrSortedColInd, csric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA muComplex csrSortedVal const int csrSortedRowPtr const int csrSortedColInd
  • csric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZcsric02_bufferSizeExt(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, muDoubleComplex `csrSortedVal, const int `csrSortedRowPtr, const int `csrSortedColInd, csric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA muDoubleComplex csrSortedVal const int csrSortedRowPtr const int csrSortedColInd
  • csric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseScsric02_analysis(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, const float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA const float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDcsric02_analysis(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, const double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA const double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCcsric02_analysis(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, const muComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA const muComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZcsric02_analysis(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, const muDoubleComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA const muDoubleComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsric02

MUSPARSE_EXPORT musparseStatus_t musparseScsric02(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, float `csrSortedValA_valM, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA float csrSortedValA_valM const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsric02

MUSPARSE_EXPORT musparseStatus_t musparseDcsric02(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, double `csrSortedValA_valM, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA double csrSortedValA_valM const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsric02

MUSPARSE_EXPORT musparseStatus_t musparseCcsric02(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, muComplex `csrSortedValA_valM, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA muComplex csrSortedValA_valM const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsric02

MUSPARSE_EXPORT musparseStatus_t musparseZcsric02(musparseHandle_t handle, int m, int nnz, const musparseMatDescr_t descrA, muDoubleComplex `csrSortedValA_valM, const int `csrSortedRowPtrA, const int `csrSortedColIndA, csric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int nnz
  • const musparseMatDescr_t descrA muDoubleComplex csrSortedValA_valM const int csrSortedRowPtrA const int csrSortedColIndA
  • csric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsric02_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXbsric02_zeroPivot(musparseHandle_t handle, bsric02Info_t info, int *position)

Parameters:

  • musparseHandle_t handle
  • bsric02Info_t info int position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSbsric02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDbsric02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCbsric02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsric02_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZbsric02_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSbsric02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDbsric02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCbsric02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsric02_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZbsric02_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsric02Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsric02Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseSbsric02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, const float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pInputBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pInputBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDbsric02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, const double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pInputBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pInputBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCbsric02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, const muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pInputBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pInputBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsric02_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZbsric02_analysis(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, const muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pInputBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pInputBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsric02

MUSPARSE_EXPORT musparseStatus_t musparseSbsric02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsric02

MUSPARSE_EXPORT musparseStatus_t musparseDbsric02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsric02

MUSPARSE_EXPORT musparseStatus_t musparseCbsric02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsric02

MUSPARSE_EXPORT musparseStatus_t musparseZbsric02(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockDim, bsric02Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockDim
  • bsric02Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsrsm2_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXbsrsm2_zeroPivot(musparseHandle_t handle, bsrsm2Info_t info, int *position)

Parameters:

  • musparseHandle_t handle
  • bsrsm2Info_t info int position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsm2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsm2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsm2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsm2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsm2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsm2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsm2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsm2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsm2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsm2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transB, int mb, int n, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transB
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsm2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsm2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transB, int mb, int n, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transB
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsm2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsm2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transB, int mb, int n, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transB
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsm2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsm2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transB, int mb, int n, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transB
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsm2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsm2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, const float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA const float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsm2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsm2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, const double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA const double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsm2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsm2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, const muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA const muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsm2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsm2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const musparseMatDescr_t descrA, const muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb
  • const musparseMatDescr_t descrA const muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsm2_solve

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsm2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const float `alpha, const musparseMatDescr_t descrA, const float `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, const float `B, int ldb, float `X, int ldx, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb const float alpha
  • const musparseMatDescr_t descrA const float bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info const float B
  • int ldb float X
  • int ldx
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsm2_solve

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsm2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const double `alpha, const musparseMatDescr_t descrA, const double `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, const double `B, int ldb, double `X, int ldx, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb const double alpha
  • const musparseMatDescr_t descrA const double bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info const double B
  • int ldb double X
  • int ldx
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsm2_solve

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsm2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const muComplex `alpha, const musparseMatDescr_t descrA, const muComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, const muComplex `B, int ldb, muComplex `X, int ldx, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb const muComplex alpha
  • const musparseMatDescr_t descrA const muComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info const muComplex B
  • int ldb muComplex X
  • int ldx
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsm2_solve

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsm2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, musparseOperation_t transXY, int mb, int n, int nnzb, const muDoubleComplex `alpha, const musparseMatDescr_t descrA, const muDoubleComplex `bsrSortedVal, const int `bsrSortedRowPtr, const int `bsrSortedColInd, int blockSize, bsrsm2Info_t info, const muDoubleComplex `B, int ldb, muDoubleComplex `X, int ldx, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • musparseOperation_t transXY
  • int mb
  • int n
  • int nnzb const muDoubleComplex alpha
  • const musparseMatDescr_t descrA const muDoubleComplex bsrSortedVal const int bsrSortedRowPtr const int bsrSortedColInd
  • int blockSize
  • bsrsm2Info_t info const muDoubleComplex B
  • int ldb muDoubleComplex X
  • int ldx
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsrsv2_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXbsrsv2_zeroPivot(musparseHandle_t handle, bsrsv2Info_t info, int *position)

Parameters:

  • musparseHandle_t handle
  • bsrsv2Info_t info int position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsv2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsv2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsv2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsv2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsv2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsv2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsv2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsv2_bufferSize(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, int `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info int pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsv2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, float `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockSize, bsrsv2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA float bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockSize
  • bsrsv2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsv2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, double `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockSize, bsrsv2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA double bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockSize
  • bsrsv2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsv2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, muComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockSize, bsrsv2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockSize
  • bsrsv2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsv2_bufferSizeExt(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, muDoubleComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockSize, bsrsv2Info_t info, size_t `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA muDoubleComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockSize
  • bsrsv2Info_t info size_t pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsv2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsv2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, const float `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const float bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsv2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsv2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, const double `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const double bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsv2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsv2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, const muComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const muComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsv2_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsv2_analysis(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const musparseMatDescr_t descrA, const muDoubleComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, musparseSolvePolicy_t policy, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb
  • const musparseMatDescr_t descrA const muDoubleComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsv2_solve

MUSPARSE_EXPORT musparseStatus_t musparseSbsrsv2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const float `alpha, const musparseMatDescr_t descrA, const float `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, const float `f, float `x, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb const float alpha
  • const musparseMatDescr_t descrA const float bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info const float f float x
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsv2_solve

MUSPARSE_EXPORT musparseStatus_t musparseDbsrsv2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const double `alpha, const musparseMatDescr_t descrA, const double `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, const double `f, double `x, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb const double alpha
  • const musparseMatDescr_t descrA const double bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info const double f double x
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsv2_solve

MUSPARSE_EXPORT musparseStatus_t musparseCbsrsv2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const muComplex `alpha, const musparseMatDescr_t descrA, const muComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, const muComplex `f, muComplex `x, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb const muComplex alpha
  • const musparseMatDescr_t descrA const muComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info const muComplex f muComplex x
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsv2_solve

MUSPARSE_EXPORT musparseStatus_t musparseZbsrsv2_solve(musparseHandle_t handle, musparseDirection_t dirA, musparseOperation_t transA, int mb, int nnzb, const muDoubleComplex `alpha, const musparseMatDescr_t descrA, const muDoubleComplex `bsrSortedValA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int blockDim, bsrsv2Info_t info, const muDoubleComplex `f, muDoubleComplex `x, musparseSolvePolicy_t policy, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • musparseOperation_t transA
  • int mb
  • int nnzb const muDoubleComplex alpha
  • const musparseMatDescr_t descrA const muDoubleComplex bsrSortedValA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int blockDim
  • bsrsv2Info_t info const muDoubleComplex f muDoubleComplex x
  • musparseSolvePolicy_t policy void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, muInt `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim muInt p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, muInt `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim muInt p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, muInt `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim muInt p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, muInt `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim muInt p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrmm2

MUSPARSE_EXPORT musparseStatus_t musparseScsrmm2(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const float `B, muInt ldb, const float `beta, float *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind const float B
  • muInt ldb const float beta float C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrmm2

MUSPARSE_EXPORT musparseStatus_t musparseDcsrmm2(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const double `B, muInt ldb, const double `beta, double *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind const double B
  • muInt ldb const double beta double C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrmm2

MUSPARSE_EXPORT musparseStatus_t musparseCcsrmm2(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muComplex `B, muInt ldb, const muComplex `beta, muComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muComplex B
  • muInt ldb const muComplex beta muComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrmm2

MUSPARSE_EXPORT musparseStatus_t musparseZcsrmm2(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muDoubleComplex `B, muInt ldb, const muDoubleComplex `beta, muDoubleComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muDoubleComplex B
  • muInt ldb const muDoubleComplex beta muDoubleComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrgeam2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseScsrgeam2_bufferSizeExt(musparseHandle_t handle, int m, int n, const float `alpha, const musparseMatDescr_t descrA, int nnzA, const float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const float `beta, const musparseMatDescr_t descrB, int nnzB, const float `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, const float `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const float alpha
  • const musparseMatDescr_t descrA
  • int nnzA const float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const float beta
  • const musparseMatDescr_t descrB
  • int nnzB const float csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC const float csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrgeam2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDcsrgeam2_bufferSizeExt(musparseHandle_t handle, int m, int n, const double `alpha, const musparseMatDescr_t descrA, int nnzA, const double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const double `beta, const musparseMatDescr_t descrB, int nnzB, const double `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, const double `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const double alpha
  • const musparseMatDescr_t descrA
  • int nnzA const double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const double beta
  • const musparseMatDescr_t descrB
  • int nnzB const double csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC const double csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrgeam2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCcsrgeam2_bufferSizeExt(musparseHandle_t handle, int m, int n, const muComplex `alpha, const musparseMatDescr_t descrA, int nnzA, const muComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const muComplex `beta, const musparseMatDescr_t descrB, int nnzB, const muComplex `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, const muComplex `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const muComplex alpha
  • const musparseMatDescr_t descrA
  • int nnzA const muComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const muComplex beta
  • const musparseMatDescr_t descrB
  • int nnzB const muComplex csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC const muComplex csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrgeam2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZcsrgeam2_bufferSizeExt(musparseHandle_t handle, int m, int n, const muDoubleComplex `alpha, const musparseMatDescr_t descrA, int nnzA, const muDoubleComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const muDoubleComplex `beta, const musparseMatDescr_t descrB, int nnzB, const muDoubleComplex `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, const muDoubleComplex `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const muDoubleComplex alpha
  • const musparseMatDescr_t descrA
  • int nnzA const muDoubleComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const muDoubleComplex beta
  • const musparseMatDescr_t descrB
  • int nnzB const muDoubleComplex csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC const muDoubleComplex csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrgeam2Nnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsrgeam2Nnz(musparseHandle_t handle, int m, int n, const musparseMatDescr_t descrA, int nnzA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const musparseMatDescr_t descrB, int nnzB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, void *workspace)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • const musparseMatDescr_t descrA
  • int nnzA const int csrSortedRowPtrA const int csrSortedColIndA
  • const musparseMatDescr_t descrB
  • int nnzB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr void workspace

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrgeam2

MUSPARSE_EXPORT musparseStatus_t musparseScsrgeam2(musparseHandle_t handle, int m, int n, const float `alpha, const musparseMatDescr_t descrA, int nnzA, const float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const float `beta, const musparseMatDescr_t descrB, int nnzB, const float `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, float `csrSortedValC, int `csrSortedRowPtrC, int `csrSortedColIndC, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const float alpha
  • const musparseMatDescr_t descrA
  • int nnzA const float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const float beta
  • const musparseMatDescr_t descrB
  • int nnzB const float csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC float csrSortedValC int csrSortedRowPtrC int csrSortedColIndC void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrgeam2

MUSPARSE_EXPORT musparseStatus_t musparseDcsrgeam2(musparseHandle_t handle, int m, int n, const double `alpha, const musparseMatDescr_t descrA, int nnzA, const double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const double `beta, const musparseMatDescr_t descrB, int nnzB, const double `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, double `csrSortedValC, int `csrSortedRowPtrC, int `csrSortedColIndC, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const double alpha
  • const musparseMatDescr_t descrA
  • int nnzA const double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const double beta
  • const musparseMatDescr_t descrB
  • int nnzB const double csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC double csrSortedValC int csrSortedRowPtrC int csrSortedColIndC void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrgeam2

MUSPARSE_EXPORT musparseStatus_t musparseCcsrgeam2(musparseHandle_t handle, int m, int n, const muComplex `alpha, const musparseMatDescr_t descrA, int nnzA, const muComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const muComplex `beta, const musparseMatDescr_t descrB, int nnzB, const muComplex `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, muComplex `csrSortedValC, int `csrSortedRowPtrC, int `csrSortedColIndC, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const muComplex alpha
  • const musparseMatDescr_t descrA
  • int nnzA const muComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const muComplex beta
  • const musparseMatDescr_t descrB
  • int nnzB const muComplex csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC muComplex csrSortedValC int csrSortedRowPtrC int csrSortedColIndC void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrgeam2

MUSPARSE_EXPORT musparseStatus_t musparseZcsrgeam2(musparseHandle_t handle, int m, int n, const muDoubleComplex `alpha, const musparseMatDescr_t descrA, int nnzA, const muDoubleComplex `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const muDoubleComplex `beta, const musparseMatDescr_t descrB, int nnzB, const muDoubleComplex `csrSortedValB, const int `csrSortedRowPtrB, const int `csrSortedColIndB, const musparseMatDescr_t descrC, muDoubleComplex `csrSortedValC, int `csrSortedRowPtrC, int `csrSortedColIndC, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const muDoubleComplex alpha
  • const musparseMatDescr_t descrA
  • int nnzA const muDoubleComplex csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const muDoubleComplex beta
  • const musparseMatDescr_t descrB
  • int nnzB const muDoubleComplex csrSortedValB const int csrSortedRowPtrB const int csrSortedColIndB
  • const musparseMatDescr_t descrC muDoubleComplex csrSortedValC int csrSortedRowPtrC int csrSortedColIndC void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const __half `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const __half `threshold, const musparseMatDescr_t descrC, const __half `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const __half csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const __half threshold
  • const musparseMatDescr_t descrC const __half csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const float `threshold, const musparseMatDescr_t descrC, const float `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const float threshold
  • const musparseMatDescr_t descrC const float csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const double `threshold, const musparseMatDescr_t descrC, const double `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const double threshold
  • const musparseMatDescr_t descrC const double csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csrNnz

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csrNnz(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const __half `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const __half `threshold, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const __half csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const __half threshold
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csrNnz

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csrNnz(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const float `threshold, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const float threshold
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csrNnz

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csrNnz(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const double `threshold, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const double threshold
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csr(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const __half `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const __half `threshold, const musparseMatDescr_t descrC, __half `csrSortedValC, const int `csrSortedRowPtrC, int `csrSortedColIndC, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const __half csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA const __half threshold
  • const musparseMatDescr_t descrC __half csrSortedValC const int csrSortedRowPtrC int csrSortedColIndC void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csrNnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csrNnzByPercentage(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const __half `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, float percentage, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, pruneInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const __half csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • float percentage
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr
  • pruneInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csrNnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csrNnzByPercentage(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, float percentage, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, pruneInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • float percentage
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr
  • pruneInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csrNnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csrNnzByPercentage(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, float percentage, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, pruneInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • float percentage
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr
  • pruneInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csrByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csrByPercentage(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const __half `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, float percentage, const musparseMatDescr_t descrC, __half `csrSortedValC, const int `csrSortedRowPtrC, int `csrSortedColIndC, pruneInfo_t info, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const __half csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • float percentage
  • const musparseMatDescr_t descrC __half csrSortedValC const int csrSortedRowPtrC int csrSortedColIndC
  • pruneInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csrByPercentage_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csrByPercentage_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const __half `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, float percentage, const musparseMatDescr_t descrC, const __half `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, pruneInfo_t info, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const __half csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • float percentage
  • const musparseMatDescr_t descrC const __half csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC
  • pruneInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csrByPercentage_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csrByPercentage_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const float `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, float percentage, const musparseMatDescr_t descrC, const float `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, pruneInfo_t info, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const float csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • float percentage
  • const musparseMatDescr_t descrC const float csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC
  • pruneInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csrByPercentage_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csrByPercentage_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnzA, const musparseMatDescr_t descrA, const double `csrSortedValA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, float percentage, const musparseMatDescr_t descrC, const double `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, pruneInfo_t info, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnzA
  • const musparseMatDescr_t descrA const double csrSortedValA const int csrSortedRowPtrA const int csrSortedColIndA
  • float percentage
  • const musparseMatDescr_t descrC const double csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC
  • pruneInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, const __half `A, int lda, const __half `threshold, const musparseMatDescr_t descrC, const __half `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const __half A
  • int lda const __half threshold
  • const musparseMatDescr_t descrC const __half csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, const float `A, int lda, const float `threshold, const musparseMatDescr_t descrC, const float `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const float A
  • int lda const float threshold
  • const musparseMatDescr_t descrC const float csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, const double `A, int lda, const double `threshold, const musparseMatDescr_t descrC, const double `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const double A
  • int lda const double threshold
  • const musparseMatDescr_t descrC const double csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csrNnz

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csrNnz(musparseHandle_t handle, int m, int n, const __half `A, int lda, const __half `threshold, const musparseMatDescr_t descrC, int `csrRowPtrC, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const __half A
  • int lda const __half threshold
  • const musparseMatDescr_t descrC int csrRowPtrC int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csrNnz

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csrNnz(musparseHandle_t handle, int m, int n, const float `A, int lda, const float `threshold, const musparseMatDescr_t descrC, int `csrRowPtrC, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const float A
  • int lda const float threshold
  • const musparseMatDescr_t descrC int csrRowPtrC int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csrNnz

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csrNnz(musparseHandle_t handle, int m, int n, const double `A, int lda, const double `threshold, const musparseMatDescr_t descrC, int `csrSortedRowPtrC, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const double A
  • int lda const double threshold
  • const musparseMatDescr_t descrC int csrSortedRowPtrC int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csr

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csr(musparseHandle_t handle, int m, int n, const __half `A, int lda, const __half `threshold, const musparseMatDescr_t descrC, __half `csrSortedValC, const int `csrSortedRowPtrC, int `csrSortedColIndC, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const __half A
  • int lda const __half threshold
  • const musparseMatDescr_t descrC __half csrSortedValC const int csrSortedRowPtrC int csrSortedColIndC void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csrByPercentage_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csrByPercentage_bufferSizeExt(musparseHandle_t handle, int m, int n, const __half `A, int lda, float percentage, const musparseMatDescr_t descrC, const __half `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, pruneInfo_t info, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const __half A
  • int lda
  • float percentage
  • const musparseMatDescr_t descrC const __half csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC
  • pruneInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csrByPercentage_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csrByPercentage_bufferSizeExt(musparseHandle_t handle, int m, int n, const float `A, int lda, float percentage, const musparseMatDescr_t descrC, const float `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, pruneInfo_t info, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const float A
  • int lda
  • float percentage
  • const musparseMatDescr_t descrC const float csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC
  • pruneInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csrByPercentage_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csrByPercentage_bufferSizeExt(musparseHandle_t handle, int m, int n, const double `A, int lda, float percentage, const musparseMatDescr_t descrC, const double `csrSortedValC, const int `csrSortedRowPtrC, const int `csrSortedColIndC, pruneInfo_t info, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const double A
  • int lda
  • float percentage
  • const musparseMatDescr_t descrC const double csrSortedValC const int csrSortedRowPtrC const int csrSortedColIndC
  • pruneInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csrNnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csrNnzByPercentage(musparseHandle_t handle, int m, int n, const __half `A, int lda, float percentage, const musparseMatDescr_t descrC, int `csrRowPtrC, int `nnzTotalDevHostPtr, pruneInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const __half A
  • int lda
  • float percentage
  • const musparseMatDescr_t descrC int csrRowPtrC int nnzTotalDevHostPtr
  • pruneInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csrNnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csrNnzByPercentage(musparseHandle_t handle, int m, int n, const float `A, int lda, float percentage, const musparseMatDescr_t descrC, int `csrRowPtrC, int `nnzTotalDevHostPtr, pruneInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const float A
  • int lda
  • float percentage
  • const musparseMatDescr_t descrC int csrRowPtrC int nnzTotalDevHostPtr
  • pruneInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csrNnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csrNnzByPercentage(musparseHandle_t handle, int m, int n, const double `A, int lda, float percentage, const musparseMatDescr_t descrC, int `csrRowPtrC, int `nnzTotalDevHostPtr, pruneInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n const double A
  • int lda
  • float percentage
  • const musparseMatDescr_t descrC int csrRowPtrC int nnzTotalDevHostPtr
  • pruneInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcoosort_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseXcoosort_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnz, const int `cooRowsA, const int `cooColsA, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz const int cooRowsA const int cooColsA size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcscsort_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseXcscsort_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnz, const int `cscColPtrA, const int `cscRowIndA, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz const int cscColPtrA const int cscRowIndA size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2bsrNnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2bsrNnz(musparseHandle_t handle, musparseDirection_t dirA, int m, int n, const musparseMatDescr_t descrA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, int blockDim, const musparseMatDescr_t descrC, int `bsrSortedRowPtrC, int `nnzTotalDevHostPtr)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int m
  • int n
  • const musparseMatDescr_t descrA const int csrSortedRowPtrA const int csrSortedColIndA
  • int blockDim
  • const musparseMatDescr_t descrC int bsrSortedRowPtrC int nnzTotalDevHostPtr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsru2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseScsru2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnz, float `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz float csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsru2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDcsru2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnz, double `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz double csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsru2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCcsru2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnz, muComplex `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz muComplex csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsru2csr_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZcsru2csr_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnz, muDoubleComplex `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, size_t `pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz muDoubleComplex csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsru2csr

MUSPARSE_EXPORT musparseStatus_t musparseScsru2csr(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, float `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA float csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsru2csr

MUSPARSE_EXPORT musparseStatus_t musparseDcsru2csr(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, double `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA double csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsru2csr

MUSPARSE_EXPORT musparseStatus_t musparseCcsru2csr(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, muComplex `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA muComplex csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsru2csr

MUSPARSE_EXPORT musparseStatus_t musparseZcsru2csr(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, muDoubleComplex `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA muDoubleComplex csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2csru

MUSPARSE_EXPORT musparseStatus_t musparseScsr2csru(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, float `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA float csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2csru

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2csru(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, double `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA double csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2csru

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2csru(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, muComplex `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA muComplex csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2csru

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2csru(musparseHandle_t handle, int m, int n, int nnz, const musparseMatDescr_t descrA, muDoubleComplex `csrVal, const int `csrRowPtr, int `csrColInd, csru2csrInfo_t info, void `pBuffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz
  • const musparseMatDescr_t descrA muDoubleComplex csrVal const int csrRowPtr int csrColInd
  • csru2csrInfo_t info void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrsort_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseXcsrsort_bufferSizeExt(musparseHandle_t handle, int m, int n, int nnz, const int `csrRowPtrA, const int `csrColIndA, size_t *pBufferSizeInBytes)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz const int csrRowPtrA const int csrColIndA size_t pBufferSizeInBytes

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSV_updateMatrix

MUSPARSE_EXPORT musparseStatus_t musparseSpSV_updateMatrix(musparseHandle_t handle, musparseSpSVDescr_t spsvDescr, void *newValues, musparseSpSVUpdate_t updatePart)

Parameters:

  • musparseHandle_t handle
  • musparseSpSVDescr_t spsvDescr void newValues
  • musparseSpSVUpdate_t updatePart

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstSpVecGet

MUSPARSE_EXPORT musparseStatus_t musparseConstSpVecGet(musparseConstSpVecDescr_t spVecDescr, int64_t `size, int64_t `nnz, const void `indices, const void `values, musparseIndexType_t `idxType, musparseIndexBase_t `idxBase, musaDataType *valueType)

Parameters:

  • musparseConstSpVecDescr_t spVecDescr int64_t size int64_t nnz const void indices* const void values* musparseIndexType_t idxType musparseIndexBase_t idxBase musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstSpVecGetValues

MUSPARSE_EXPORT musparseStatus_t musparseConstSpVecGetValues(musparseConstSpVecDescr_t spVecDescr, const void ``values)

Parameters:

  • musparseConstSpVecDescr_t spVecDescr const void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXgebsr2gebsrNnz

MUSPARSE_EXPORT musparseStatus_t musparseXgebsr2gebsrNnz(musparseHandle_t handle, musparseDirection_t dirA, int mb, int nb, int nnzb, const musparseMatDescr_t descrA, const int `bsrSortedRowPtrA, const int `bsrSortedColIndA, int rowBlockDimA, int colBlockDimA, const musparseMatDescr_t descrC, int `bsrSortedRowPtrC, int rowBlockDimC, int colBlockDimC, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int mb
  • int nb
  • int nnzb
  • const musparseMatDescr_t descrA const int bsrSortedRowPtrA const int bsrSortedColIndA
  • int rowBlockDimA
  • int colBlockDimA
  • const musparseMatDescr_t descrC int bsrSortedRowPtrC
  • int rowBlockDimC
  • int colBlockDimC int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateSlicedEll

MUSPARSE_EXPORT musparseStatus_t musparseCreateSlicedEll(musparseSpMatDescr_t `spMatDescr, int64_t rows, int64_t cols, int64_t nnz, int64_t sellValuesSize, int64_t sliceSize, void `sellSliceOffsets, void `sellColInd, void `sellValues, musparseIndexType_t sellSliceOffsetsType, musparseIndexType_t sellColIndType, musparseIndexBase_t idxBase, musaDataType valueType)

Parameters:

musparseSpMatDescr_t spMatDescr

  • int64_t rows
  • int64_t cols
  • int64_t nnz
  • int64_t sellValuesSize
  • int64_t sliceSize void sellSliceOffsets void sellColInd void sellValues
  • musparseIndexType_t sellSliceOffsetsType
  • musparseIndexType_t sellColIndType
  • musparseIndexBase_t idxBase
  • musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstSlicedEll

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstSlicedEll(musparseConstSpMatDescr_t `spMatDescr, int64_t rows, int64_t cols, int64_t nnz, int64_t sellValuesSize, int64_t sliceSize, const void `sellSliceOffsets, const void `sellColInd, const void `sellValues, musparseIndexType_t sellSliceOffsetsType, musparseIndexType_t sellColIndType, musparseIndexBase_t idxBase, musaDataType valueType)

Parameters:

musparseConstSpMatDescr_t spMatDescr

  • int64_t rows
  • int64_t cols
  • int64_t nnz
  • int64_t sellValuesSize
  • int64_t sliceSize const void sellSliceOffsets const void sellColInd const void sellValues
  • musparseIndexType_t sellSliceOffsetsType
  • musparseIndexType_t sellColIndType
  • musparseIndexBase_t idxBase
  • musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateBlockedEll

MUSPARSE_EXPORT musparseStatus_t musparseCreateBlockedEll(musparseSpMatDescr_t `spMatDescr, int64_t rows, int64_t cols, int64_t ellBlockSize, int64_t ellCols, void `ellColInd, void *ellValue, musparseIndexType_t ellIdxType, musparseIndexBase_t idxBase, musaDataType valueType)

Parameters:

musparseSpMatDescr_t spMatDescr

  • int64_t rows
  • int64_t cols
  • int64_t ellBlockSize
  • int64_t ellCols void ellColInd void ellValue
  • musparseIndexType_t ellIdxType
  • musparseIndexBase_t idxBase
  • musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstBlockedEll

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstBlockedEll(musparseConstSpMatDescr_t `spMatDescr, int64_t rows, int64_t cols, int64_t ellBlockSize, int64_t ellCols, const void `ellColInd, const void *ellValue, musparseIndexType_t ellIdxType, musparseIndexBase_t idxBase, musaDataType valueType)

Parameters:

musparseConstSpMatDescr_t spMatDescr

  • int64_t rows
  • int64_t cols
  • int64_t ellBlockSize
  • int64_t ellCols const void ellColInd const void ellValue
  • musparseIndexType_t ellIdxType
  • musparseIndexBase_t idxBase
  • musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseBlockedEllGet

MUSPARSE_EXPORT musparseStatus_t musparseBlockedEllGet(musparseSpMatDescr_t spMatDescr, int64_t `rows, int64_t `cols, int64_t `ellBlockSize, int64_t `ellCols, void `ellColInd, void `ellValue, musparseIndexType_t `ellIdxType, musparseIndexBase_t `idxBase, musaDataType *valueType)

Parameters:

  • musparseSpMatDescr_t spMatDescr int64_t rows int64_t cols int64_t ellBlockSize int64_t ellCols void ellColInd* void ellValue* musparseIndexType_t ellIdxType musparseIndexBase_t idxBase musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstBlockedEllGet

MUSPARSE_EXPORT musparseStatus_t musparseConstBlockedEllGet(musparseConstSpMatDescr_t spMatDescr, int64_t `rows, int64_t `cols, int64_t `ellBlockSize, int64_t `ellCols, const void `ellColInd, const void `ellValue, musparseIndexType_t `ellIdxType, musparseIndexBase_t `idxBase, musaDataType *valueType)

Parameters:

  • musparseConstSpMatDescr_t spMatDescr int64_t rows int64_t cols int64_t ellBlockSize int64_t ellCols const void ellColInd* const void ellValue* musparseIndexType_t ellIdxType musparseIndexBase_t idxBase musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateBsr

MUSPARSE_EXPORT musparseStatus_t musparseCreateBsr(musparseSpMatDescr_t `spMatDescr, int64_t brows, int64_t bcols, int64_t bnnz, int64_t rowBlockSize, int64_t colBlockSize, void `bsrRowOffsets, void `bsrColInd, void `bsrValues, musparseIndexType_t bsrRowOffsetsType, musparseIndexType_t bsrColIndType, musparseIndexBase_t idxBase, musaDataType valueType, musparseOrder_t order)

Parameters:

musparseSpMatDescr_t spMatDescr

  • int64_t brows
  • int64_t bcols
  • int64_t bnnz
  • int64_t rowBlockSize
  • int64_t colBlockSize void bsrRowOffsets void bsrColInd void bsrValues
  • musparseIndexType_t bsrRowOffsetsType
  • musparseIndexType_t bsrColIndType
  • musparseIndexBase_t idxBase
  • musaDataType valueType
  • musparseOrder_t order

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCscGet

MUSPARSE_EXPORT musparseStatus_t musparseCscGet(musparseSpMatDescr_t spMatDescr, int64_t `rows, int64_t `cols, int64_t `nnz, void `cscColOffsets, void `cscRowInd, void ``cscValues, musparseIndexType_t `cscColOffsetsType, musparseIndexType_t `cscRowIndType, musparseIndexBase_t `idxBase, musaDataType *valueType)

Parameters:

  • musparseSpMatDescr_t spMatDescr int64_t rows int64_t cols int64_t nnz void cscColOffsets* void cscRowInd* void cscValues* musparseIndexType_t cscColOffsetsType musparseIndexType_t cscRowIndType musparseIndexBase_t idxBase musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseBsrSetStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseBsrSetStridedBatch(musparseSpMatDescr_t spMatDescr, int batchCount, int64_t offsetsBatchStride, int64_t columnsBatchStride, int64_t ValuesBatchStride)

Parameters:

  • musparseSpMatDescr_t spMatDescr
  • int batchCount
  • int64_t offsetsBatchStride
  • int64_t columnsBatchStride
  • int64_t ValuesBatchStride

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpVV_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpVV_bufferSize(musparseHandle_t handle, musparseOperation_t opX, musparseConstSpVecDescr_t vecX, musparseConstDnVecDescr_t vecY, const void `result, musaDataType computeType, size_t `bufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opX
  • musparseConstSpVecDescr_t vecX
  • musparseConstDnVecDescr_t vecY const void result
  • musaDataType computeType size_t bufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpVV

MUSPARSE_EXPORT musparseStatus_t musparseSpVV(musparseHandle_t handle, musparseOperation_t opX, musparseConstSpVecDescr_t vecX, musparseConstDnVecDescr_t vecY, void `result, musaDataType computeType, void `externalBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opX
  • musparseConstSpVecDescr_t vecX
  • musparseConstDnVecDescr_t vecY void result
  • musaDataType computeType void externalBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSparseToDense_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSparseToDense_bufferSize(musparseHandle_t handle, musparseConstSpMatDescr_t matA, musparseDnMatDescr_t matB, musparseSparseToDenseAlg_t alg, size_t *bufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseConstSpMatDescr_t matA
  • musparseDnMatDescr_t matB
  • musparseSparseToDenseAlg_t alg size_t bufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSparseToDense

MUSPARSE_EXPORT musparseStatus_t musparseSparseToDense(musparseHandle_t handle, musparseConstSpMatDescr_t matA, musparseDnMatDescr_t matB, musparseSparseToDenseAlg_t alg, void *externalBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseConstSpMatDescr_t matA
  • musparseDnMatDescr_t matB
  • musparseSparseToDenseAlg_t alg void externalBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2gebsrNnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2gebsrNnz(musparseHandle_t handle, musparseDirection_t dirA, int m, int n, const musparseMatDescr_t descrA, const int `csrSortedRowPtrA, const int `csrSortedColIndA, const musparseMatDescr_t descrC, int `bsrSortedRowPtrC, int rowBlockDim, int colBlockDim, int `nnzTotalDevHostPtr, void *pBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dirA
  • int m
  • int n
  • const musparseMatDescr_t descrA const int csrSortedRowPtrA const int csrSortedColIndA
  • const musparseMatDescr_t descrC int bsrSortedRowPtrC
  • int rowBlockDim
  • int colBlockDim int nnzTotalDevHostPtr void pBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsr2gebsc_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCgebsr2gebsc_bufferSize(musparseHandle_t handle, int mb, int nb, int nnzb, const muComplex `bsrVal, const int `bsrRowPtr, const int `bsrColInd, int rowBlockDim, int colBlockDim, int `pBufferSize)

Parameters:

  • musparseHandle_t handle
  • int mb
  • int nb
  • int nnzb const muComplex bsrVal const int bsrRowPtr const int bsrColInd
  • int rowBlockDim
  • int colBlockDim int pBufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv2

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv2(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, muComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du muComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv2StridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv2StridedBatch(musparseHandle_t handle, muInt m, const muComplex `dl, const muComplex `d, const muComplex `du, muComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m const muComplex dl const muComplex d const muComplex du muComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv2StridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv2StridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m const muComplex dl const muComplex d const muComplex du const muComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv2_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du const muComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv2_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv2_nopivot(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, muComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du muComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv2_nopivot_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv2_nopivot_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du const muComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseCgtsvInterleavedBatch(musparseHandle_t handle, int alg, muInt m, muComplex `dl, muComplex `d, muComplex `du, muComplex `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m muComplex dl muComplex d muComplex du muComplex x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCgtsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, int alg, muInt m, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m const muComplex dl const muComplex d const muComplex du const muComplex x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCgebsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const muComplex `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, int `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const muComplex bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C int buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgemvi_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCgemvi_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgpsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseCgpsvInterleavedBatch(musparseHandle_t handle, int alg, muInt m, muComplex `ds, muComplex `dl, muComplex `d, muComplex `du, muComplex `dw, muComplex `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m muComplex ds muComplex dl muComplex d muComplex du muComplex dw muComplex x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgpsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCgpsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, int alg, muInt m, const muComplex `ds, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `dw, const muComplex `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m const muComplex ds const muComplex dl const muComplex d const muComplex du const muComplex dw const muComplex x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsr2gebsc_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDgebsr2gebsc_bufferSize(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const double `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, int `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const double bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim int p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDgebsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const double `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, int `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const double bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C int buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgemvi_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDgemvi_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgpsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseDgpsvInterleavedBatch(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, double `ds, double `dl, double `d, double `du, double `dw, double `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m double ds double dl double d double du double dw double x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgpsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDgpsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, int alg, muInt m, const double `ds, const double `dl, const double `d, const double `du, const double `dw, const double `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m const double ds const double dl const double d const double du const double dw const double x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv2

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv2(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, double `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du double B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv2StridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv2StridedBatch(musparseHandle_t handle, muInt m, const double `dl, const double `d, const double `du, double `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m const double dl const double d const double du double x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv2StridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv2StridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const double `dl, const double `d, const double `du, const double `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m const double dl const double d const double du const double x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv2_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, const double `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du const double B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv2_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv2_nopivot(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, double `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du double B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv2_nopivot_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv2_nopivot_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, const double `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du const double B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseDgtsvInterleavedBatch(musparseHandle_t handle, int alg, muInt m, double `dl, double `d, double `du, double `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m double dl double d double du double x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDgtsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, int alg, muInt m, const double `dl, const double `d, const double `du, const double `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m const double dl const double d const double du const double x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsr2gebsc_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSgebsr2gebsc_bufferSize(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const float `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, int `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const float bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim int p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSgebsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const float `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, int `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const float bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C int buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgemvi_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSgemvi_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, int *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz int buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgpsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseSgpsvInterleavedBatch(musparseHandle_t handle, int alg, muInt m, float `ds, float `dl, float `d, float `du, float `dw, float `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m float ds float dl float d float du float dw float x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgpsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSgpsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, int alg, muInt m, const float `ds, const float `dl, const float `d, const float `du, const float `dw, const float `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m const float ds const float dl const float d const float du const float dw const float x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv2

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv2(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, float `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du float B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv2StridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv2StridedBatch(musparseHandle_t handle, muInt m, const float `dl, const float `d, const float `du, float `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m const float dl const float d const float du float x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv2StridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv2StridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const float `dl, const float `d, const float `du, const float `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m const float dl const float d const float du const float x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv2_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, const float `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du const float B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv2_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv2_nopivot(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, float `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du float B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv2_nopivot_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv2_nopivot_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, const float `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du const float B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseSgtsvInterleavedBatch(musparseHandle_t handle, int alg, muInt m, float `dl, float `d, float `du, float `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m float dl float d float du float x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSgtsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, int alg, muInt m, const float `dl, const float `d, const float `du, const float `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m const float dl const float d const float du const float x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsr2gebsc_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZgebsr2gebsc_bufferSize(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const muDoubleComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, int `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const muDoubleComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim int p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsr2gebsr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZgebsr2gebsr_bufferSize(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const muDoubleComplex `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, int `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const muDoubleComplex bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C int buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgemvi_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZgemvi_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, int *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz int buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgpsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseZgpsvInterleavedBatch(musparseHandle_t handle, int alg, muInt m, muDoubleComplex `ds, muDoubleComplex `dl, muDoubleComplex `d, muDoubleComplex `du, muDoubleComplex `dw, muDoubleComplex `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m muDoubleComplex ds muDoubleComplex dl muDoubleComplex d muDoubleComplex du muDoubleComplex dw muDoubleComplex x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgpsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZgpsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, int alg, muInt m, const muDoubleComplex `ds, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `dw, const muDoubleComplex `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • int alg
  • muInt m const muDoubleComplex ds const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex dw const muDoubleComplex x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv2

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv2(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, muDoubleComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du muDoubleComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv2StridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv2StridedBatch(musparseHandle_t handle, muInt m, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, muDoubleComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv2StridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv2StridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv2_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv2_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv2_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv2_nopivot(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, muDoubleComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du muDoubleComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv2_nopivot_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv2_nopivot_bufferSizeExt(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsvInterleavedBatch

MUSPARSE_EXPORT musparseStatus_t musparseZgtsvInterleavedBatch(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, muDoubleComplex `dl, muDoubleComplex `d, muDoubleComplex `du, muDoubleComplex `x, muInt batch_count, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m muDoubleComplex dl muDoubleComplex d muDoubleComplex du muDoubleComplex x
  • muInt batch_count void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsvInterleavedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZgtsvInterleavedBatch_bufferSizeExt(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `x, muInt batch_count, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex x
  • muInt batch_count size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstCooGet

MUSPARSE_EXPORT musparseStatus_t musparseConstCooGet(musparseSpMatDescr_t descr, int64_t `rows, int64_t `cols, int64_t `nnz, void `coo_row_ind, void `coo_col_ind, void ``coo_val, musparseIndexType_t `idx_type, musparseIndexBase_t `idx_base, musparseDataType_t `data_type)

Parameters:

  • musparseSpMatDescr_t descr int64_t rows int64_t cols int64_t nnz void coo_row_ind* void coo_col_ind* void coo_val* musparseIndexType_t idx_type musparseIndexBase_t idx_base musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstCscGet

MUSPARSE_EXPORT musparseStatus_t musparseConstCscGet(musparseSpMatDescr_t spMatDescr, int64_t `rows, int64_t `cols, int64_t `nnz, void `cscColOffsets, void `cscRowInd, void ``cscValues, musparseIndexType_t `cscColOffsetsType, musparseIndexType_t `cscRowIndType, musparseIndexBase_t `idxBase, musaDataType *valueType)

Parameters:

  • musparseSpMatDescr_t spMatDescr int64_t rows int64_t cols int64_t nnz void cscColOffsets* void cscRowInd* void cscValues* musparseIndexType_t cscColOffsetsType musparseIndexType_t cscRowIndType musparseIndexBase_t idxBase musaDataType valueType

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstCsrGet

MUSPARSE_EXPORT musparseStatus_t musparseConstCsrGet(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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstDnMatGet

MUSPARSE_EXPORT musparseStatus_t musparseConstDnMatGet(musparseDnMatDescr_t descr, int64_t `rows, int64_t `cols, int64_t `ld, void ``values, musparseDataType_t `data_type, musparseOrder_t *order)

Parameters:

  • musparseDnMatDescr_t descr int64_t rows int64_t cols int64_t ld void values* musparseDataType_t data_type musparseOrder_t order

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstDnMatGetValues

MUSPARSE_EXPORT musparseStatus_t musparseConstDnMatGetValues(musparseDnMatDescr_t descr, void ``values)

Parameters:

  • musparseDnMatDescr_t descr void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstDnVecGet

MUSPARSE_EXPORT musparseStatus_t musparseConstDnVecGet(musparseDnVecDescr_t descr, int64_t `size, void ``values, musparseDataType_t `data_type)

Parameters:

  • musparseDnVecDescr_t descr int64_t size void values* musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstDnVecGetValues

MUSPARSE_EXPORT musparseStatus_t musparseConstDnVecGetValues(musparseDnVecDescr_t descr, void ``values)

Parameters:

  • musparseDnVecDescr_t descr void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseConstSpMatGetValues

MUSPARSE_EXPORT musparseStatus_t musparseConstSpMatGetValues(musparseSpMatDescr_t descr, void ``values)

Parameters:

  • musparseSpMatDescr_t descr void values*

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstBsr

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstBsr(musparseConstSpMatDescr_t `spMatDescr, int64_t brows, int64_t bcols, int64_t bnnz, int64_t rowBlockSize, int64_t colBlockSize, const void `bsrRowOffsets, const void `bsrColInd, const void `bsrValues, musparseIndexType_t bsrRowOffsetsType, musparseIndexType_t bsrColIndType, musparseIndexBase_t idxBase, musaDataType valueType, musparseOrder_t order)

Parameters:

musparseConstSpMatDescr_t spMatDescr

  • int64_t brows
  • int64_t bcols
  • int64_t bnnz
  • int64_t rowBlockSize
  • int64_t colBlockSize const void bsrRowOffsets const void bsrColInd const void bsrValues
  • musparseIndexType_t bsrRowOffsetsType
  • musparseIndexType_t bsrColIndType
  • musparseIndexBase_t idxBase
  • musaDataType valueType
  • musparseOrder_t order

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstCoo

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstCoo(musparseConstSpMatDescr_t `descr, int64_t rows, int64_t cols, int64_t nnz, const void `coo_row_ind, const void `coo_col_ind, const void `coo_val, musparseIndexType_t idx_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseConstSpMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • int64_t nnz const void coo_row_ind const void coo_col_ind const void coo_val
  • musparseIndexType_t idx_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstCsc

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstCsc(musparseConstSpMatDescr_t `descr, int64_t rows, int64_t cols, int64_t nnz, const void `csc_col_ptr, const void `csc_row_ind, const void `csc_val, musparseIndexType_t col_ptr_type, musparseIndexType_t row_ind_type, musparseIndexBase_t idx_base, musparseDataType_t data_type)

Parameters:

musparseConstSpMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • int64_t nnz const void csc_col_ptr const void csc_row_ind const void csc_val
  • musparseIndexType_t col_ptr_type
  • musparseIndexType_t row_ind_type
  • musparseIndexBase_t idx_base
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstDnMat

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstDnMat(musparseConstDnMatDescr_t `descr, int64_t rows, int64_t cols, int64_t ld, const void `values, musparseDataType_t data_type, musparseOrder_t order)

Parameters:

musparseConstDnMatDescr_t descr

  • int64_t rows
  • int64_t cols
  • int64_t ld const void values
  • musparseDataType_t data_type
  • musparseOrder_t order

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateConstDnVec

MUSPARSE_EXPORT musparseStatus_t musparseCreateConstDnVec(musparseConstDnVecDescr_t `descr, int64_t size, const void `values, musparseDataType_t data_type)

Parameters:

musparseConstDnVecDescr_t descr

  • int64_t size const void values
  • musparseDataType_t data_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseLoggerSetCallback

MUSPARSE_EXPORT musparseStatus_t musparseLoggerSetCallback(musparseLoggerCallback_t callback)

Parameters:

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseLoggerSetFile

MUSPARSE_EXPORT musparseStatus_t musparseLoggerSetFile(FILE *file)

Parameters:

FILE file

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseLoggerOpenFile

MUSPARSE_EXPORT musparseStatus_t musparseLoggerOpenFile(const char *logFile)

Parameters:

const char logFile

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseLoggerSetLevel

MUSPARSE_EXPORT musparseStatus_t musparseLoggerSetLevel(int level)

Parameters:

  • int level

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseLoggerSetMask

MUSPARSE_EXPORT musparseStatus_t musparseLoggerSetMask(int mask)

Parameters:

  • int mask

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseLoggerForceDisable

MUSPARSE_EXPORT musparseStatus_t musparseLoggerForceDisable()

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateCsrgemm2Info

MUSPARSE_EXPORT musparseStatus_t musparseCreateCsrgemm2Info(musparseHandle_t handle, csrgemm2Info_t *info)

Parameters:

  • musparseHandle_t handle csrgemm2Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDestroyCsrgemm2Info

MUSPARSE_EXPORT musparseStatus_t musparseDestroyCsrgemm2Info(musparseHandle_t handle, csrgemm2Info_t info)

Parameters:

  • musparseHandle_t handle
  • csrgemm2Info_t info

Return type: MUSPARSE_EXPORT musparseStatus_t


File musparse-functions.h

Location: musparse-functions.h

musparse-functions.h provides Sparse Linear Algebra Subprograms of Level 1, 2 and 3, using MUSA optimized for MT GPU hardware.

Includes

  • musparse-export.h
  • musparse-types.h

Enumeration type musparseCsr2CscAlg_t

Definition: musparse-functions.h (line 10647)

enum musparseCsr2CscAlg_t \{
MUSPARSE_CSR2CSC_ALG_DEFAULT = 1,
MUSPARSE_CSR2CSC_ALG1 = 1
\}

Enumerator MUSPARSE_CSR2CSC_ALG_DEFAULT

Enumerator MUSPARSE_CSR2CSC_ALG1

Function musparseScsr2csc

MUSPARSE_EXPORT musparseStatus_t musparseScsr2csc(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, float `csc_val, muInt `csc_row_ind, muInt `csc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Convert a sparse CSR matrix into a sparse CSC matrix.

musparseXcsr2csc converts a CSR matrix into a CSC matrix. musparseXcsr2csc can also be used to convert a CSC matrix into a CSR matrix. copy_values decides whether csc_val is being filled during conversion (MUSPARSE_ACTION_NUMERIC) or not (MUSPARSE_ACTION_SYMBOLIC).

musparseXcsr2csc requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by musparseXcsr2csc_bufferSize().

注意:The resulting matrix can also be seen as the transpose of the input matrix.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • csc_val: array of nnz elements of the sparse CSC matrix.
  • csc_row_ind: array of nnz elements containing the row indices of the sparse CSC matrix.
  • csc_col_ptr: array of n+1 elements that point to the start of every column of the sparse CSC matrix.
  • copy_values: MUSPARSE_ACTION_SYMBOLIC or MUSPARSE_ACTION_NUMERIC.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseXcsr2csc_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p csr_val, csr_row_ptr, csr_col_ind, csc_val, csc_row_ind, csc_col_ptr or temp_buffer pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Example:

This example computes the transpose of a CSR matrix.

// 1 2 0 3 0
// A = 0 4 5 0 0
// 6 0 0 7 8

muInt m_A = 3;
muInt n_A = 5;
muInt nnz_A = 8;

csr_row_ptr_A[m+1] = \{0, 3, 5, 8\}; // device memory
csr_col_ind_A[nnz] = \{0, 1, 3, 1, 2, 0, 3, 4\}; // device memory
csr_val_A[nnz] = \{1, 2, 3, 4, 5, 6, 7, 8\}; // device memory

// Allocate memory for transposed CSR matrix
muInt m_T = n_A;
muInt n_T = m_A;
muInt nnz_T = nnz_A;

muInt* csr_row_ptr_T;
muInt* csr_col_ind_T;
float* csr_val_T;

musaMalloc((void``)&csr_row_ptr_T, sizeof(muInt) * (m_T + 1));
musaMalloc((void``)&csr_col_ind_T, sizeof(muInt) * nnz_T);
musaMalloc((void``)&csr_val_T, sizeof(float) * nnz_T);

// Obtain the temporary buffer size
size_t buffer_size;
musparseXcsr2csc_bufferSize(handle,
m_A,
n_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
MUSPARSE_ACTION_NUMERIC,
&buffer_size);

// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);

musparseScsr2csc(handle,
m_A,
n_A,
nnz_A,
csr_val_A,
csr_row_ptr_A,
csr_col_ind_A,
csr_val_T,
csr_col_ind_T,
csr_row_ptr_T,
MUSPARSE_ACTION_NUMERIC,
MUSPARSE_INDEX_BASE_ZERO,
temp_buffer);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const float csr_val const muInt csr_row_ptr const muInt csr_col_ind float csc_val muInt csc_row_ind muInt csc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2csc

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2csc(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, double `csc_val, muInt `csc_row_ind, muInt `csc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const double csr_val const muInt csr_row_ptr const muInt csr_col_ind double csc_val muInt csc_row_ind muInt csc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2csc

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2csc(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muComplex `csc_val, muInt `csc_row_ind, muInt `csc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind muComplex csc_val muInt csc_row_ind muInt csc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2csc

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2csc(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muDoubleComplex `csc_val, muInt `csc_row_ind, muInt `csc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind muDoubleComplex csc_val muInt csc_row_ind muInt csc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCsr2cscEx2

MUSPARSE_EXPORT musparseStatus_t musparseCsr2cscEx2(musparseHandle_t handle, int m, int n, int nnz, const void `csrVal, const int `csrRowPtr, const int `csrColInd, void `cscVal, int `cscColPtr, int `cscRowInd, musaDataType valType, musparseAction_t copyValues, musparseIndexBase_t idxBase, musparseCsr2CscAlg_t alg, void *buffer)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz const void csrVal const int csrRowPtr const int csrColInd void cscVal int cscColPtr int cscRowInd
  • musaDataType valType
  • musparseAction_t copyValues
  • musparseIndexBase_t idxBase
  • musparseCsr2CscAlg_t alg void buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCsr2cscEx2_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCsr2cscEx2_bufferSize(musparseHandle_t handle, int m, int n, int nnz, const void `csrVal, const int `csrRowPtr, const int `csrColInd, void `cscVal, int `cscColPtr, int `cscRowInd, musaDataType valType, musparseAction_t copyValues, musparseIndexBase_t idxBase, musparseCsr2CscAlg_t alg, size_t *bufferSize)

Parameters:

  • musparseHandle_t handle
  • int m
  • int n
  • int nnz const void csrVal const int csrRowPtr const int csrColInd void cscVal int cscColPtr int cscRowInd
  • musaDataType valType
  • musparseAction_t copyValues
  • musparseIndexBase_t idxBase
  • musparseCsr2CscAlg_t alg size_t bufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSaxpyi

MUSPARSE_EXPORT musparseStatus_t musparseSaxpyi(musparseHandle_t handle, muInt nnz, const float `alpha, const float `x_val, const muInt `x_ind, float `y, musparseIndexBase_t idx_base)

Scale a sparse vector and add it to a dense vector.

musparseXaxpyi multiplies the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} with scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}, such that

formula \{"type":"element","name":"formula","attributes":\{"id":"3"\},"children":[\{"type":"text","text":"\\[\n y := y + \\alpha \\cdot x\n \\]"\}]\}

for(i = 0; i < nnz; ++i)
\{
y[x_ind[i]] = y[x_ind[i]] + alpha * x_val[i];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • nnz: number of non-zero entries of vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • x_val: array of nnz elements containing the values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_ind: array of nnz elements containing the indices of the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: array of values in dense format.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_VALUE: idx_base is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, x_val, x_ind or y pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt nnz const float alpha const float x_val const muInt x_ind float y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDaxpyi

MUSPARSE_EXPORT musparseStatus_t musparseDaxpyi(musparseHandle_t handle, muInt nnz, const double `alpha, const double `x_val, const muInt `x_ind, double `y, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const double alpha const double x_val const muInt x_ind double y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCaxpyi

MUSPARSE_EXPORT musparseStatus_t musparseCaxpyi(musparseHandle_t handle, muInt nnz, const muComplex `alpha, const muComplex `x_val, const muInt `x_ind, muComplex `y, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muComplex alpha const muComplex x_val const muInt x_ind muComplex y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZaxpyi

MUSPARSE_EXPORT musparseStatus_t musparseZaxpyi(musparseHandle_t handle, muInt nnz, const muDoubleComplex `alpha, const muDoubleComplex `x_val, const muInt `x_ind, muDoubleComplex `y, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muDoubleComplex alpha const muDoubleComplex x_val const muInt x_ind muDoubleComplex y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSdoti

MUSPARSE_EXPORT musparseStatus_t musparseSdoti(musparseHandle_t handle, muInt nnz, const float `x_val, const muInt `x_ind, const float `y, float `result, musparseIndexBase_t idx_base)

Compute the dot product of a sparse vector with a dense vector.

musparseXdoti computes the dot product of the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} with the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"4"\},"children":[\{"type":"text","text":"\\[ \\text\{result\} := y^T x \\]"\}]\}

for(i = 0; i < nnz; ++i)
\{
result += x_val[i] * y[x_ind[i]];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • nnz: number of non-zero entries of vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_val: array of nnz values.
  • x_ind: array of nnz elements containing the indices of the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: array of values in dense format.
  • result: pointer to the result, can be host or device memory
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_VALUE: idx_base is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: x_val, x_ind, y or result pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer for the dot product reduction could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt nnz const float x_val const muInt x_ind const float y float result
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDdoti

MUSPARSE_EXPORT musparseStatus_t musparseDdoti(musparseHandle_t handle, muInt nnz, const double `x_val, const muInt `x_ind, const double `y, double `result, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const double x_val const muInt x_ind const double y double result
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCdoti

MUSPARSE_EXPORT musparseStatus_t musparseCdoti(musparseHandle_t handle, muInt nnz, const muComplex `x_val, const muInt `x_ind, const muComplex `y, muComplex `result, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muComplex x_val const muInt x_ind const muComplex y muComplex result
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZdoti

MUSPARSE_EXPORT musparseStatus_t musparseZdoti(musparseHandle_t handle, muInt nnz, const muDoubleComplex `x_val, const muInt `x_ind, const muDoubleComplex `y, muDoubleComplex `result, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muDoubleComplex x_val const muInt x_ind const muDoubleComplex y muDoubleComplex result
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCdotci

MUSPARSE_EXPORT musparseStatus_t musparseCdotci(musparseHandle_t handle, muInt nnz, const muComplex `x_val, const muInt `x_ind, const muComplex `y, muComplex `result, musparseIndexBase_t idx_base)

Compute the dot product of a complex conjugate sparse vector with a dense vector.

musparseXdotci computes the dot product of the complex conjugate sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} with the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"5"\},"children":[\{"type":"text","text":"\\[ \\text\{result\} :=\n\\bar\{x\}^H y \\]"\}]\}

for(i = 0; i < nnz; ++i)
\{
result += conj(x_val[i]) * y[x_ind[i]];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • nnz: number of non-zero entries of vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_val: array of nnz values.
  • x_ind: array of nnz elements containing the indices of the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: array of values in dense format.
  • result: pointer to the result, can be host or device memory
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_VALUE: idx_base is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: x_val, x_ind, y or result pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer for the dot product reduction could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muComplex x_val const muInt x_ind const muComplex y muComplex result
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZdotci

MUSPARSE_EXPORT musparseStatus_t musparseZdotci(musparseHandle_t handle, muInt nnz, const muDoubleComplex `x_val, const muInt `x_ind, const muDoubleComplex `y, muDoubleComplex `result, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muDoubleComplex x_val const muInt x_ind const muDoubleComplex y muDoubleComplex result
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgthr

MUSPARSE_EXPORT musparseStatus_t musparseSgthr(musparseHandle_t handle, muInt nnz, const float `y, float `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Gather elements from a dense vector and store them into a sparse vector.

musparseXgthr gathers the elements that are listed in x_ind from the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} and stores them in the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.

for(i = 0; i < nnz; ++i)
\{
x_val[i] = y[x_ind[i]];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • nnz: number of non-zero entries of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: array of values in dense format.
  • x_val: array of nnz elements containing the values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_ind: array of nnz elements containing the indices of the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_VALUE: idx_base is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: y, x_val or x_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt nnz const float y float x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgthr

MUSPARSE_EXPORT musparseStatus_t musparseDgthr(musparseHandle_t handle, muInt nnz, const double `y, double `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const double y double x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgthr

MUSPARSE_EXPORT musparseStatus_t musparseCgthr(musparseHandle_t handle, muInt nnz, const muComplex `y, muComplex `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muComplex y muComplex x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgthr

MUSPARSE_EXPORT musparseStatus_t musparseZgthr(musparseHandle_t handle, muInt nnz, const muDoubleComplex `y, muDoubleComplex `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muDoubleComplex y muDoubleComplex x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgthrz

MUSPARSE_EXPORT musparseStatus_t musparseSgthrz(musparseHandle_t handle, muInt nnz, float `y, float `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Gather and zero out elements from a dense vector and store them into a sparse vector.

musparseXgthrz gathers the elements that are listed in x_ind from the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} and stores them in the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}. The gathered elements in formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} are replaced by zero.

for(i = 0; i < nnz; ++i)
\{
x_val[i] = y[x_ind[i]];
y[x_ind[i]] = 0;
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • nnz: number of non-zero entries of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: array of values in dense format.
  • x_val: array of nnz elements containing the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_ind: array of nnz elements containing the indices of the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_VALUE: idx_base is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: y, x_val or x_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt nnz float y float x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgthrz

MUSPARSE_EXPORT musparseStatus_t musparseDgthrz(musparseHandle_t handle, muInt nnz, double `y, double `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz double y double x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgthrz

MUSPARSE_EXPORT musparseStatus_t musparseCgthrz(musparseHandle_t handle, muInt nnz, muComplex `y, muComplex `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz muComplex y muComplex x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgthrz

MUSPARSE_EXPORT musparseStatus_t musparseZgthrz(musparseHandle_t handle, muInt nnz, muDoubleComplex `y, muDoubleComplex `x_val, const muInt *x_ind, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz muDoubleComplex y muDoubleComplex x_val const muInt x_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSroti

MUSPARSE_EXPORT musparseStatus_t musparseSroti(musparseHandle_t handle, muInt nnz, float `x_val, const muInt `x_ind, float `y, const float `c, const float *s, musparseIndexBase_t idx_base)

Apply Givens rotation to a dense and a sparse vector.

musparseXroti applies the Givens rotation matrix formula \{"type":"element","name":"formula","attributes":\{"id":"6"\},"children":[\{"type":"text","text":"$G$"\}]\} to the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}, where formula \{"type":"element","name":"formula","attributes":\{"id":"7"\},"children":[\{"type":"text","text":"\\[ G = \\begin\{pmatrix\} c\n& s \\\\ -s & c \\end\{pmatrix\} \\]"\}]\}

for(i = 0; i < nnz; ++i)
\{
x_tmp = x_val[i];
y_tmp = y[x_ind[i]];

x_val[i] = c ` x_tmp + s ` y_tmp;
y[x_ind[i]] = c ` y_tmp - s ` x_tmp;
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • nnz: number of non-zero entries of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_val: array of nnz elements containing the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_ind: array of nnz elements containing the indices of the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: array of values in dense format.
  • c: pointer to the cosine element of formula \{"type":"element","name":"formula","attributes":\{"id":"6"\},"children":[\{"type":"text","text":"$G$"\}]\}, can be on host or device.
  • s: pointer to the sine element of formula \{"type":"element","name":"formula","attributes":\{"id":"6"\},"children":[\{"type":"text","text":"$G$"\}]\}, can be on host or device.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_VALUE: idx_base is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: c, s, x_val, x_ind or y pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt nnz float x_val const muInt x_ind float y const float c const float s
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDroti

MUSPARSE_EXPORT musparseStatus_t musparseDroti(musparseHandle_t handle, muInt nnz, double `x_val, const muInt `x_ind, double `y, const double `c, const double *s, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz double x_val const muInt x_ind double y const double c const double s
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSsctr

MUSPARSE_EXPORT musparseStatus_t musparseSsctr(musparseHandle_t handle, muInt nnz, const float `x_val, const muInt `x_ind, float *y, musparseIndexBase_t idx_base)

Scatter elements from a dense vector across a sparse vector.

musparseXsctr scatters the elements that are listed in x_ind from the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} into the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}. Indices of formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that are not listed in x_ind remain unchanged.

for(i = 0; i < nnz; ++i)
\{
y[x_ind[i]] = x_val[i];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • nnz: number of non-zero entries of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_val: array of nnz elements containing the non-zero values of formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • x_ind: array of nnz elements containing the indices of the non-zero values of x.
  • y: array of values in dense format.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_VALUE: idx_base is invalid.
  • MUSPARSE_STATUS_INVALID_SIZE: nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: x_val, x_ind or y pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt nnz const float x_val const muInt x_ind float y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDsctr

MUSPARSE_EXPORT musparseStatus_t musparseDsctr(musparseHandle_t handle, muInt nnz, const double `x_val, const muInt `x_ind, double *y, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const double x_val const muInt x_ind double y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCsctr

MUSPARSE_EXPORT musparseStatus_t musparseCsctr(musparseHandle_t handle, muInt nnz, const muComplex `x_val, const muInt `x_ind, muComplex *y, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muComplex x_val const muInt x_ind muComplex y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZsctr

MUSPARSE_EXPORT musparseStatus_t musparseZsctr(musparseHandle_t handle, muInt nnz, const muDoubleComplex `x_val, const muInt `x_ind, muDoubleComplex *y, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muDoubleComplex x_val const muInt x_ind muDoubleComplex y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseIsctr

MUSPARSE_EXPORT musparseStatus_t musparseIsctr(musparseHandle_t handle, muInt nnz, const muInt `x_val, const muInt `x_ind, muInt *y, musparseIndexBase_t idx_base)

Parameters:

  • musparseHandle_t handle
  • muInt nnz const muInt x_val const muInt x_ind muInt y
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrmv

MUSPARSE_EXPORT musparseStatus_t musparseSbsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, 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, const float `x, const float `beta, float *y)

Sparse matrix vector multiplication using BSR storage format.

musparseXbsrmv multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"8"\},"children":[\{"type":"text","text":"$(mb \\cdot \\text\{block_dim\}) \\times (nb \\cdot \\text\{block_dim\})$"\}]\} matrix, defined in BSR storage format, and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"10"\},"children":[\{"type":"text","text":"\\[ y := \\alpha \\cdot op(A) \\cdot x + \\beta \\cdot y,\n \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意: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 is supported.

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.
  • nb: number of block columns of the sparse BSR matrix.
  • nnzb: number of non-zero blocks of the sparse BSR matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb blocks of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse BSR matrix.
  • block_dim: block dimension of the sparse BSR matrix.
  • x: array of nb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or mb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of mb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or nb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nb, nnzb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, bsr_val, bsr_row_ind, bsr_col_ind, x, beta or y pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • 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 const float x const float beta float y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrmv

MUSPARSE_EXPORT musparseStatus_t musparseDbsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, 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, const double `x, const double `beta, double *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • 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 const double x const double beta double y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrmv

MUSPARSE_EXPORT musparseStatus_t musparseCbsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, 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, const muComplex `x, const muComplex `beta, muComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • 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 const muComplex x const muComplex beta muComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrmv

MUSPARSE_EXPORT musparseStatus_t musparseZbsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, 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, const muDoubleComplex `x, const muDoubleComplex `beta, muDoubleComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • 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 const muDoubleComplex x const muDoubleComplex beta muDoubleComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrxmv

MUSPARSE_EXPORT musparseStatus_t musparseSbsrxmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt size_of_mask, muInt mb, muInt nb, muInt nnzb, const float `alpha, const musparseMatDescr_t descr, const float `bsr_val, const muInt `bsr_mask_ptr, const muInt `bsr_row_ptr, const muInt `bsr_end_ptr, const muInt `bsr_col_ind, muInt block_dim, const float `x, const float `beta, float *y)

Sparse matrix vector multiplication with mask operation using BSR storage format.

musparseXbsrxmv multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"8"\},"children":[\{"type":"text","text":"$(mb \\cdot \\text\{block_dim\}) \\times (nb \\cdot \\text\{block_dim\})$"\}]\} modified matrix, defined in BSR storage format, and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"15"\},"children":[\{"type":"text","text":"\\[ y := \\left( \\alpha \\cdot op(A) \\cdot x +\n\\beta \\cdot y \\right)\\left( \\text\{mask\} \\right), \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"16"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

The formula \{"type":"element","name":"formula","attributes":\{"id":"17"\},"children":[\{"type":"text","text":"$\\text\{mask\}$"\}]\} is defined as an array of block row indices. The input sparse matrix is defined with a modified BSR storage format where the beginning and the end of each row is defined with two arrays, bsr_row_ptr and bsr_end_ptr (both of size mb), rather the usual bsr_row_ptr of size mb + 1.

注意: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 is supported. Currently, block_dim == 1 is not supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: matrix storage of BSR blocks.
  • trans: matrix operation type.
  • size_of_mask: number of updated block rows of the array y.
  • mb: number of block rows of the sparse BSR matrix.
  • nb: number of block columns of the sparse BSR matrix.
  • nnzb: number of non-zero blocks of the sparse BSR matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb blocks of the sparse BSR matrix.
  • bsr_mask_ptr: array of size_of_mask elements that give the indices of the updated block rows.
  • bsr_row_ptr: array of mb elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_end_ptr: array of mb elements that point to the end of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse BSR matrix.
  • block_dim: block dimension of the sparse BSR matrix.
  • x: array of nb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or mb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of mb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or nb*block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nb, nnzb, block_dim or size_of_mask is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: size_of_mask is greater than mb.`
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, bsr_val, bsr_row_ind, bsr_col_ind, x, beta or y pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED block_dim == 1, trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt size_of_mask
  • muInt mb
  • muInt nb
  • muInt nnzb const float alpha
  • const musparseMatDescr_t descr const float bsr_val const muInt bsr_mask_ptr const muInt bsr_row_ptr const muInt bsr_end_ptr const muInt bsr_col_ind
  • muInt block_dim const float x const float beta float y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrxmv

MUSPARSE_EXPORT musparseStatus_t musparseDbsrxmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt size_of_mask, muInt mb, muInt nb, muInt nnzb, const double `alpha, const musparseMatDescr_t descr, const double `bsr_val, const muInt `bsr_mask_ptr, const muInt `bsr_row_ptr, const muInt `bsr_end_ptr, const muInt `bsr_col_ind, muInt block_dim, const double `x, const double `beta, double *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt size_of_mask
  • muInt mb
  • muInt nb
  • muInt nnzb const double alpha
  • const musparseMatDescr_t descr const double bsr_val const muInt bsr_mask_ptr const muInt bsr_row_ptr const muInt bsr_end_ptr const muInt bsr_col_ind
  • muInt block_dim const double x const double beta double y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrxmv

MUSPARSE_EXPORT musparseStatus_t musparseCbsrxmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt size_of_mask, muInt mb, muInt nb, muInt nnzb, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `bsr_val, const muInt `bsr_mask_ptr, const muInt `bsr_row_ptr, const muInt `bsr_end_ptr, const muInt `bsr_col_ind, muInt block_dim, const muComplex `x, const muComplex `beta, muComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt size_of_mask
  • muInt mb
  • muInt nb
  • muInt nnzb const muComplex alpha
  • const musparseMatDescr_t descr const muComplex bsr_val const muInt bsr_mask_ptr const muInt bsr_row_ptr const muInt bsr_end_ptr const muInt bsr_col_ind
  • muInt block_dim const muComplex x const muComplex beta muComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrxmv

MUSPARSE_EXPORT musparseStatus_t musparseZbsrxmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt size_of_mask, muInt mb, muInt nb, muInt nnzb, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `bsr_val, const muInt `bsr_mask_ptr, const muInt `bsr_row_ptr, const muInt `bsr_end_ptr, const muInt `bsr_col_ind, muInt block_dim, const muDoubleComplex `x, const muDoubleComplex `beta, muDoubleComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt size_of_mask
  • muInt mb
  • muInt nb
  • muInt nnzb const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex bsr_val const muInt bsr_mask_ptr const muInt bsr_row_ptr const muInt bsr_end_ptr const muInt bsr_col_ind
  • muInt block_dim const muDoubleComplex x const muDoubleComplex beta muDoubleComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsv_bufferSize

MUSPARSE_EXPORT 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)

Sparse triangular solve using BSR storage format.

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.

Parameters:

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr, bsr_col_ind, info or buffer_size pointer 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.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsv_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsv_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsv_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsv_analysis

MUSPARSE_EXPORT 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)

Sparse triangular solve using BSR storage format.

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.

注意: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.

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 nnzb blocks of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnz containing 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_row_ptr, bsr_col_ind, info or temp_buffer pointer 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.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsv_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsv_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsv_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsv_solve

MUSPARSE_EXPORT 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)

Sparse triangular solve using BSR storage format.

musparseXbsrsv_solve solves a sparse triangular linear system of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix, defined in BSR storage format, a dense solution vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} and the right-hand side formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"21"\},"children":[\{"type":"text","text":"\\[ op(A) \\cdot y = \\alpha \\cdot x, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

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 formula \{"type":"element","name":"formula","attributes":\{"id":"22"\},"children":[\{"type":"text","text":"$A_\{j,j\} = 0$"\}]\} for some formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}.

注意: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 and trans == MUSPARSE_OPERATION_TRANSPOSE is supported.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse BSR matrix.
  • bsr_val: array of nnzb blocks of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnz containing 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 m elements, holding the right-hand side.
  • y: array of m elements, holding the solution.
  • policy: MUSPARSE_SOLVE_POLICY_USE_LEVEL.
  • temp_buffer: temporary storage buffer allocated by the user.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, bsr_val, bsr_row_ptr, bsr_col_ind, x or y pointer 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.

Example:

Consider the lower triangular formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"23"\},"children":[\{"type":"text","text":"$L$"\}]\}, stored in BSR storage format with unit diagonal. The following example solves formula \{"type":"element","name":"formula","attributes":\{"id":"24"\},"children":[\{"type":"text","text":"$L \\cdot y\n= x$"\}]\}.

// 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);

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsv_solve

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsv_solve

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsv_solve

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScoomv

MUSPARSE_EXPORT musparseStatus_t musparseScoomv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, const float `x, const float `beta, float *y)

Sparse matrix vector multiplication using COO storage format.

musparseXcoomv multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"25"\},"children":[\{"type":"text","text":"$m\n\\times n$"\}]\} matrix, defined in COO storage format, and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"26"\},"children":[\{"type":"text","text":"\\[ y := \\alpha \\cdot op(A) \\cdot x + \\beta\n\\cdot y, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"27"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

The COO matrix has to be sorted by row indices. This can be achieved by using musparseXcoosortByRow().

for(i = 0; i < m; ++i)
\{
y[i] = beta * y[i];
\}

for(i = 0; i < nnz; ++i)
\{
y[coo_row_ind[i]] += alpha ` coo_val[i] ` x[coo_col_ind[i]];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the sparse COO matrix.
  • n: number of columns of the sparse COO matrix.
  • nnz: number of non-zero entries of the sparse COO matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse COO matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • coo_val: array of nnz elements of the sparse COO matrix.
  • coo_row_ind: array of nnz elements containing the row indices of the sparse COO matrix.
  • coo_col_ind: array of nnz elements containing the column indices of the sparse COO matrix.
  • x: array of n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, alpha, coo_val, coo_row_ind, coo_col_ind, x, beta or y pointer is invalid.

Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float coo_val const muInt coo_row_ind const muInt coo_col_ind const float x const float beta float y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcoomv

MUSPARSE_EXPORT musparseStatus_t musparseDcoomv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, const double `x, const double `beta, double *y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double coo_val const muInt coo_row_ind const muInt coo_col_ind const double x const double beta double y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcoomv

MUSPARSE_EXPORT musparseStatus_t musparseCcoomv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, const muComplex `x, const muComplex `beta, muComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex coo_val const muInt coo_row_ind const muInt coo_col_ind const muComplex x const muComplex beta muComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcoomv

MUSPARSE_EXPORT musparseStatus_t musparseZcoomv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, const muDoubleComplex `x, const muDoubleComplex `beta, muDoubleComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex coo_val const muInt coo_row_ind const muInt coo_col_ind const muDoubleComplex x const muDoubleComplex beta muDoubleComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrmv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseScsrmv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseMatInfo_t info)

Sparse matrix vector multiplication using CSR storage format.

musparseXcsrmv_analysis performs the analysis step for musparseScsrmv(), musparseDcsrmv(), musparseCcsrmv() and musparseZcsrmv(). It is expected that this function will be executed only once for a given matrix and particular operation type. The gathered analysis meta data can be cleared by musparseXcsrmv_clear().

注意: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.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr, csr_col_ind or info pointer is invalid. * Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer for the gathered information could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED if musparseMatrixType_t is not one of MUSPARSE_MATRIX_TYPE_GENERAL, MUSPARSE_MATRIX_TYPE_SYMMETRIC, or MUSPARSE_MATRIX_TYPE_TRIANGULAR.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrmv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDcsrmv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseMatInfo_t info)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrmv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCcsrmv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseMatInfo_t info)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrmv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZcsrmv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseMatInfo_t info)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrmv

MUSPARSE_EXPORT musparseStatus_t musparseScsrmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const float `x, const float `beta, float *y)

Sparse matrix vector multiplication using CSR storage format.

musparseXcsrmv multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"25"\},"children":[\{"type":"text","text":"$m\n\\times n$"\}]\} matrix, defined in CSR storage format, and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"26"\},"children":[\{"type":"text","text":"\\[ y := \\alpha \\cdot op(A) \\cdot x + \\beta\n\\cdot y, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"27"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

The info parameter is optional and contains information collected by musparseScsrmv_analysis(), musparseDcsrmv_analysis(), musparseCcsrmv_analysis() or musparseZcsrmv_analysis(). If present, the information will be used to speed up the csrmv computation. If info == NULL, general csrmv routine will be used instead.

for(i = 0; i < m; ++i)
\{
y[i] = beta * y[i];

for(j = csr_row_ptr[i]; j < csr_row_ptr[i + 1]; ++j)
\{
y[i] = y[i] + alpha ` csr_val[j] ` x[csr_col_ind[j]];
\}
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • info: information collected by musparseScsrmv_analysis(), musparseDcsrmv_analysis(), musparseCcsrmv_analysis() or musparseDcsrmv_analysis(), can be NULL if no information is available.
  • x: array of n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, alpha, csr_val, csr_row_ptr, csr_col_ind, x, beta or y pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example performs a sparse matrix vector multiplication in CSR format using additional meta data to improve performance.

// Create matrix info structure
musparseMatInfo_t info;
musparseCreateMatInfo(&info);

// Perform analysis step to obtain meta data
musparseScsrmv_analysis(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
nnz,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info);

// Compute y = Ax
musparseScsrmv(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
nnz,
&alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
x,
&beta,
y);

// Do more work
// ...

// Clean up
musparseDestroyMatInfo(info);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const float x const float beta float y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrmv

MUSPARSE_EXPORT musparseStatus_t musparseDcsrmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const double `x, const double `beta, double *y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const double x const double beta double y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrmv

MUSPARSE_EXPORT musparseStatus_t musparseCcsrmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const muComplex `x, const muComplex `beta, muComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const muComplex x const muComplex beta muComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrmv

MUSPARSE_EXPORT musparseStatus_t musparseZcsrmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const muDoubleComplex `x, const muDoubleComplex `beta, muDoubleComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const muDoubleComplex x const muDoubleComplex beta muDoubleComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsrsv_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Sparse triangular solve using CSR storage format.

musparseXcsrsv_bufferSize returns the size of the temporary storage buffer that is required by musparseScsrsv_analysis(), musparseDcsrsv_analysis(), musparseCcsrsv_analysis(), musparseZcsrsv_analysis(), musparseScsrsv_solve(), musparseDcsrsv_solve(), musparseCcsrsv_solve() and musparseZcsrsv_solve(). The temporary storage buffer must be allocated by the user. The size of the temporary storage buffer is identical to the size returned by musparseScsrilu0_bufferSize(), musparseDcsrilu0_bufferSize(), musparseCcsrilu0_bufferSize() and musparseZcsrilu0_bufferSize() if the matrix sparsity pattern is identical. The user allocated buffer can thus be shared between subsequent calls to those functions.

Parameters:

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr, csr_col_ind, info or buffer_size pointer is invalid.

Return values:

  • 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.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsrsv_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsrsv_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsrsv_bufferSize(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrsv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseScsrsv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Sparse triangular solve using CSR storage format.

musparseXcsrsv_analysis performs the analysis step for musparseScsrsv_solve(), musparseDcsrsv_solve(), musparseCcsrsv_solve() and musparseZcsrsv_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 musparseXcsrsv_clear().

musparseXcsrsv_analysis can share its meta data with musparseScsrsm_analysis(), musparseDcsrsm_analysis(), musparseCcsrsm_analysis(), musparseZcsrsm_analysis(), musparseScsrilu0_analysis(), musparseDcsrilu0_analysis(), musparseCcsrilu0_analysis(), musparseZcsrilu0_analysis(), musparseScsric0_analysis(), musparseDcsric0_analysis(), musparseCcsric0_analysis() and musparseZcsric0_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.

注意: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.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_row_ptr, csr_col_ind, info or temp_buffer pointer is invalid.

Return values:

  • 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.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrsv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDcsrsv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrsv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCcsrsv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrsv_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZcsrsv_analysis(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrsv_solve

MUSPARSE_EXPORT musparseStatus_t musparseScsrsv_solve(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const float `x, float `y, musparseSolvePolicy_t policy, void *temp_buffer)

Sparse triangular solve using CSR storage format.

musparseXcsrsv_solve solves a sparse triangular linear system of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix, defined in CSR storage format, a dense solution vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} and the right-hand side formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"21"\},"children":[\{"type":"text","text":"\\[ op(A) \\cdot y = \\alpha \\cdot x, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

musparseXcsrsv_solve requires a user allocated temporary buffer. Its size is returned by musparseScsrsv_bufferSize(), musparseDcsrsv_bufferSize(), musparseCcsrsv_bufferSize() or musparseZcsrsv_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseScsrsv_analysis(), musparseDcsrsv_analysis(), musparseCcsrsv_analysis() or musparseZcsrsv_analysis(). musparseXcsrsv_solve reports the first zero pivot (either numerical or structural zero). The zero pivot status can be checked calling musparseXcsrmv_zeroPivot(). If musparseDiagType_t == MUSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if formula \{"type":"element","name":"formula","attributes":\{"id":"22"\},"children":[\{"type":"text","text":"$A_\{j,j\} = 0$"\}]\} for some formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}.

注意:The sparse CSR matrix has to be sorted. This can be achieved by calling musparseXcsrsort().

注意: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 and trans == MUSPARSE_OPERATION_TRANSPOSE is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • info: structure that holds the information collected during the analysis step.
  • x: array of m elements, holding the right-hand side.
  • y: array of m elements, holding the solution.
  • policy: MUSPARSE_SOLVE_POLICY_USE_LEVEL.
  • temp_buffer: temporary storage buffer allocated by the user.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, alpha, csr_val, csr_row_ptr, csr_col_ind, x or y pointer is invalid. Return values:

  • 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 trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

Consider the lower triangular formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"23"\},"children":[\{"type":"text","text":"$L$"\}]\}, stored in CSR storage format with unit diagonal. The following example solves formula \{"type":"element","name":"formula","attributes":\{"id":"24"\},"children":[\{"type":"text","text":"$L \\cdot y\n= x$"\}]\}.

// 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;
musparseDcsrsv_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
&buffer_size);

// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);

// Perform analysis step
musparseDcsrsv_analysis(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);

// Solve Ly = x
musparseDcsrsv_solve(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
&alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
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);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const float x float y
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrsv_solve

MUSPARSE_EXPORT musparseStatus_t musparseDcsrsv_solve(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const double `x, double `y, musparseSolvePolicy_t policy, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const double x double y
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrsv_solve

MUSPARSE_EXPORT musparseStatus_t musparseCcsrsv_solve(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const muComplex `x, muComplex `y, musparseSolvePolicy_t policy, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const muComplex x muComplex y
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrsv_solve

MUSPARSE_EXPORT musparseStatus_t musparseZcsrsv_solve(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, const muDoubleComplex `x, muDoubleComplex `y, musparseSolvePolicy_t policy, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info const muDoubleComplex x muDoubleComplex y
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSellmv

MUSPARSE_EXPORT musparseStatus_t musparseSellmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const float `alpha, const musparseMatDescr_t descr, const float `ell_val, const muInt `ell_col_ind, muInt ell_width, const float `x, const float `beta, float `y)

Sparse matrix vector multiplication using ELL storage format.

musparseXellmv multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"25"\},"children":[\{"type":"text","text":"$m\n\\times n$"\}]\} matrix, defined in ELL storage format, and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"26"\},"children":[\{"type":"text","text":"\\[ y := \\alpha \\cdot op(A) \\cdot x + \\beta\n\\cdot y, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"27"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

for(i = 0; i < m; ++i)
\{
y[i] = beta * y[i];

for(p = 0; p < ell_width; ++p)
\{
idx = p * m + i;

if((ell_col_ind[idx] >= 0) && (ell_col_ind[idx] < n))
\{
y[i] = y[i] + alpha ` ell_val[idx] ` x[ell_col_ind[idx]];
\}
\}
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the sparse ELL matrix.
  • n: number of columns of the sparse ELL matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse ELL matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • ell_val: array that contains the elements of the sparse ELL matrix. Padded elements should be zero.
  • ell_col_ind: array that contains the column indices of the sparse ELL matrix. Padded column indices should be -1.
  • ell_width: number of non-zero elements per row of the sparse ELL matrix.
  • x: array of n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or ell_width is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, ell_val, ell_col_ind, x, beta or y pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const float alpha
  • const musparseMatDescr_t descr const float ell_val const muInt ell_col_ind
  • muInt ell_width const float x const float beta float y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDellmv

MUSPARSE_EXPORT musparseStatus_t musparseDellmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const double `alpha, const musparseMatDescr_t descr, const double `ell_val, const muInt `ell_col_ind, muInt ell_width, const double `x, const double `beta, double `y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const double alpha
  • const musparseMatDescr_t descr const double ell_val const muInt ell_col_ind
  • muInt ell_width const double x const double beta double y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCellmv

MUSPARSE_EXPORT musparseStatus_t musparseCellmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `ell_val, const muInt `ell_col_ind, muInt ell_width, const muComplex `x, const muComplex `beta, muComplex `y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const muComplex alpha
  • const musparseMatDescr_t descr const muComplex ell_val const muInt ell_col_ind
  • muInt ell_width const muComplex x const muComplex beta muComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZellmv

MUSPARSE_EXPORT musparseStatus_t musparseZellmv(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `ell_val, const muInt `ell_col_ind, muInt ell_width, const muDoubleComplex `x, const muDoubleComplex `beta, muDoubleComplex `y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex ell_val const muInt ell_col_ind
  • muInt ell_width const muDoubleComplex x const muDoubleComplex beta muDoubleComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseShybmv

MUSPARSE_EXPORT musparseStatus_t musparseShybmv(musparseHandle_t handle, musparseOperation_t trans, const float `alpha, const musparseMatDescr_t descr, const musparseHybMat_t hyb, const float `x, const float `beta, float `y)

Sparse matrix vector multiplication using HYB storage format.

musparseXhybmv multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"31"\},"children":[\{"type":"text","text":"$m\n \\times n$"\}]\} matrix, defined in HYB storage format, and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"32"\},"children":[\{"type":"text","text":"\\[ y := \\alpha \\cdot op(A) \\cdot x + \\beta\n \\cdot y, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"33"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse HYB matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • hyb: matrix in HYB storage format.
  • x: array of n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: hyb structure was not initialized with valid matrix sizes.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, hyb, x, beta or y pointer is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE:

p hyb structure was not initialized with a valid partitioning type. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const float alpha
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb const float x const float beta float y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDhybmv

MUSPARSE_EXPORT musparseStatus_t musparseDhybmv(musparseHandle_t handle, musparseOperation_t trans, const double `alpha, const musparseMatDescr_t descr, const musparseHybMat_t hyb, const double `x, const double `beta, double `y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const double alpha
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb const double x const double beta double y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseChybmv

MUSPARSE_EXPORT musparseStatus_t musparseChybmv(musparseHandle_t handle, musparseOperation_t trans, const muComplex `alpha, const musparseMatDescr_t descr, const musparseHybMat_t hyb, const muComplex `x, const muComplex `beta, muComplex `y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const muComplex alpha
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb const muComplex x const muComplex beta muComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZhybmv

MUSPARSE_EXPORT musparseStatus_t musparseZhybmv(musparseHandle_t handle, musparseOperation_t trans, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const musparseHybMat_t hyb, const muDoubleComplex `x, const muDoubleComplex `beta, muDoubleComplex `y)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const muDoubleComplex alpha
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb const muDoubleComplex x const muDoubleComplex beta muDoubleComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsrmv

MUSPARSE_EXPORT musparseStatus_t musparseSgebsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, muInt nnzb, const float `alpha, const musparseMatDescr_t descr, const float `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const float `x, const float `beta, float *y)

Sparse matrix vector multiplication using GEBSR storage format.

musparseXgebsrmv multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"34"\},"children":[\{"type":"text","text":"$(mb \\cdot \\text\{row_block_dim\}) \\times (nb \\cdot \\text\{col_block_dim\})$"\}]\} matrix, defined in GEBSR storage format, and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"10"\},"children":[\{"type":"text","text":"\\[ y := \\alpha \\cdot op(A) \\cdot x + \\beta \\cdot y,\n \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意: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 is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: matrix storage of GEBSR blocks.
  • trans: matrix operation type.
  • mb: number of block rows of the sparse GEBSR matrix.
  • nb: number of block columns of the sparse GEBSR matrix.
  • nnzb: number of non-zero blocks of the sparse GEBSR matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse GEBSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb blocks of the sparse GEBSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse GEBSR matrix.
  • bsr_col_ind: array of nnz containing the block column indices of the sparse GEBSR matrix.
  • row_block_dim: row block dimension of the sparse GEBSR matrix.
  • col_block_dim: column block dimension of the sparse GEBSR matrix.
  • x: array of nb*col_block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or mb*row_block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of mb*row_block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"12"\},"children":[\{"type":"text","text":"$op(A) = A$"\}]\}) or nb*col_block_dim elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"13"\},"children":[\{"type":"text","text":"$op(A) = A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"14"\},"children":[\{"type":"text","text":"$op(A) = A^H$"\}]\}).

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nb, nnzb, row_block_dim or col_block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, bsr_val, bsr_row_ind, bsr_col_ind, x, beta or y pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • muInt nnzb const float alpha
  • const musparseMatDescr_t descr const float bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const float x const float beta float y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsrmv

MUSPARSE_EXPORT musparseStatus_t musparseDgebsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, muInt nnzb, const double `alpha, const musparseMatDescr_t descr, const double `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const double `x, const double `beta, double *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • muInt nnzb const double alpha
  • const musparseMatDescr_t descr const double bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const double x const double beta double y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsrmv

MUSPARSE_EXPORT musparseStatus_t musparseCgebsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, muInt nnzb, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const muComplex `x, const muComplex `beta, muComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • muInt nnzb const muComplex alpha
  • const musparseMatDescr_t descr const muComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const muComplex x const muComplex beta muComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsrmv

MUSPARSE_EXPORT musparseStatus_t musparseZgebsrmv(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans, muInt mb, muInt nb, muInt nnzb, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const muDoubleComplex `x, const muDoubleComplex `beta, muDoubleComplex *y)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans
  • muInt mb
  • muInt nb
  • muInt nnzb const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const muDoubleComplex x const muDoubleComplex beta muDoubleComplex y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgemvi_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSgemvi_bufferSize_legacy(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, size_t *buffer_size)

Dense matrix sparse vector multiplication.

musparseXgemvi_bufferSize returns the size of the temporary storage buffer required by musparseSgemvi(), musparseDgemvi(), musparseCgemvi() or musparseZgemvi(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the dense matrix.
  • n: number of columns of the dense matrix.
  • nnz: number of non-zero entries in the sparse vector.
  • buffer_size: temporary storage buffer size.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgemvi_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseDgemvi_bufferSize_legacy(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgemvi_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseCgemvi_bufferSize_legacy(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgemvi_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseZgemvi_bufferSize_legacy(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, muInt nnz, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n
  • muInt nnz size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgemvi

MUSPARSE_EXPORT musparseStatus_t musparseSgemvi(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const float `alpha, const float `A, muInt lda, muInt nnz, const float `x_val, const muInt `x_ind, const float `beta, float `y, musparseIndexBase_t idx_base, void *temp_buffer)

Dense matrix sparse vector multiplication.

musparseXgemvi multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a dense formula \{"type":"element","name":"formula","attributes":\{"id":"25"\},"children":[\{"type":"text","text":"$m\n\\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} and the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"36"\},"children":[\{"type":"text","text":"\\[ y := \\alpha \\cdot op(A) \\cdot x + \\beta \\cdot y, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

musparseXgemvi requires a user allocated temporary buffer. Its size is returned by musparseSgemvi_bufferSize(), musparseDgemvi_bufferSize(), musparseCgemvi_bufferSize() or musparseZgemvi_bufferSize().

注意: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 is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • m: number of rows of the dense matrix.
  • n: number of columns of the dense matrix.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • A: pointer to the dense matrix.
  • lda: leading dimension of the dense matrix
  • nnz: number of non-zero entries in the sparse vector
  • x_val: array of nnz elements containing the values of the sparse vector
  • x_ind: array of nnz elements containing the indices of the sparse vector
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: array of m elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or n elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.
  • temp_buffer: temporary storage buffer

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, lda or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, A, x_val, x_ind, beta, y or temp_buffer pointer is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDtrans` != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const float alpha const float A
  • muInt lda
  • muInt nnz const float x_val const muInt x_ind const float beta float y
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgemvi

MUSPARSE_EXPORT musparseStatus_t musparseDgemvi(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const double `alpha, const double `A, muInt lda, muInt nnz, const double `x_val, const muInt `x_ind, const double `beta, double `y, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const double alpha const double A
  • muInt lda
  • muInt nnz const double x_val const muInt x_ind const double beta double y
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgemvi

MUSPARSE_EXPORT musparseStatus_t musparseCgemvi(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const muComplex `alpha, const muComplex `A, muInt lda, muInt nnz, const muComplex `x_val, const muInt `x_ind, const muComplex `beta, muComplex `y, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const muComplex alpha const muComplex A
  • muInt lda
  • muInt nnz const muComplex x_val const muInt x_ind const muComplex beta muComplex y
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgemvi

MUSPARSE_EXPORT musparseStatus_t musparseZgemvi(musparseHandle_t handle, musparseOperation_t trans, muInt m, muInt n, const muDoubleComplex `alpha, const muDoubleComplex `A, muInt lda, muInt nnz, const muDoubleComplex `x_val, const muInt `x_ind, const muDoubleComplex `beta, muDoubleComplex `y, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans
  • muInt m
  • muInt n const muDoubleComplex alpha const muDoubleComplex A
  • muInt lda
  • muInt nnz const muDoubleComplex x_val const muInt x_ind const muDoubleComplex beta muDoubleComplex y
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrmm

MUSPARSE_EXPORT musparseStatus_t musparseSbsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, 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, const float `B, muInt ldb, const float `beta, float *C, muInt ldc)

Sparse matrix dense matrix multiplication using BSR storage format.

musparseXbsrmm multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"37"\},"children":[\{"type":"text","text":"$mb\n\\times kb$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in BSR storage format, and the dense formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} (where formula \{"type":"element","name":"formula","attributes":\{"id":"40"\},"children":[\{"type":"text","text":"$k = block\\_dim \\times kb$"\}]\}) and adds the result to the dense formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} (where formula \{"type":"element","name":"formula","attributes":\{"id":"43"\},"children":[\{"type":"text","text":"$m =\nblock\\_dim \\times mb$"\}]\}) that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"44"\},"children":[\{"type":"text","text":"\\[ C := \\alpha \\cdot op(A) \\cdot op(B) + \\beta \\cdot C, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"45"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"46"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意: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_NON_TRANSPOSE is supported.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type. Currently, only MUSPARSE_OPERATION_NON_TRANSPOSE is supported.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type. Currently, only MUSPARSE_OPERATION_NON_TRANSPOSE and MUSPARSE_OPERATION_TRANSPOSE are supported.
  • mb: number of block rows of the sparse BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • n: number of columns of the dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • kb: number of block columns of the sparse BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • nnzb: number of non-zero blocks of the sparse BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb*block_dim*block_dim elements of the sparse BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • block_dim: size of the blocks in the sparse BSR matrix.
  • B: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"48"\},"children":[\{"type":"text","text":"$ldb \\times n$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}), formula \{"type":"element","name":"formula","attributes":\{"id":"50"\},"children":[\{"type":"text","text":"$ldb \\times k$"\}]\} otherwise.
  • ldb: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"51"\},"children":[\{"type":"text","text":"$\\max\{(1,\nk)\}$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"52"\},"children":[\{"type":"text","text":"$ op(B) == B$"\}]\}) where formula \{"type":"element","name":"formula","attributes":\{"id":"40"\},"children":[\{"type":"text","text":"$k = block\\_dim \\times kb$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"53"\},"children":[\{"type":"text","text":"$\\max\{(1,\nn)\}$"\}]\} otherwise.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • C: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"54"\},"children":[\{"type":"text","text":"$ldc \\times n$"\}]\}.
  • ldc: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"55"\},"children":[\{"type":"text","text":"$\\max\{(1,\nm)\}$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"56"\},"children":[\{"type":"text","text":"$ op(A) == A$"\}]\}) where formula \{"type":"element","name":"formula","attributes":\{"id":"57"\},"children":[\{"type":"text","text":"$m = block\\_dim \\times mb$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"51"\},"children":[\{"type":"text","text":"$\\max\{(1,\nk)\}$"\}]\} where formula \{"type":"element","name":"formula","attributes":\{"id":"40"\},"children":[\{"type":"text","text":"$k = block\\_dim \\times kb$"\}]\} otherwise.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, n, kb, nnzb, ldb or ldc is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, bsr_val, bsr_row_ptr, bsr_col_ind, B, beta or C pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans_A != MUSPARSE_OPERATION_NON_TRANSPOSE or trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example multiplies a BSR matrix with a dense matrix.

// 1 2 0 3 0 0
// A = 0 4 5 0 0 0
// 0 0 0 7 8 0
// 0 0 1 2 4 1

muInt block_dim = 2;
muInt mb = 2;
muInt kb = 3;
muInt nnzb = 4;
musparseDirection_t dir = MUSPARSE_DIRECTION_ROW;

bsr_row_ptr[mb+1] = \{0, 2, 4\}; // device memory
bsr_col_ind[nnzb] = \{0, 1, 1, 2\}; // device memory
bsr_val[nnzb`block_dim`block_dim] = \{1, 2, 0, 4, 0, 3, 5, 0, 0, 7, 1, 2,
8, 0, 4, 1\}; // device memory

// Set dimension n of B
muInt n = 64;
muInt m = mb * block_dim;
muInt k = kb * block_dim;

// Allocate and generate dense matrix B
std::vector<float> hB(k * n);
for(muInt i = 0; i < k * n; ++i)
\{
hB[i] = static_cast<float>(rand()) / RAND_MAX;
\}

// Copy B to the device
float* B;
musaMalloc((void``)&B, sizeof(float) ` k ` n);
musaMemcpy(B, hB.data(), sizeof(float) ` k ` n, musaMemcpyHostToDevice);

// alpha and beta
float alpha = 1.0f;
float beta = 0.0f;

// Allocate memory for the resulting matrix C
float* C;
musaMalloc((void``)&C, sizeof(float) ` m ` n);

// Perform the matrix multiplication
musparseSbsrmm(handle,
dir,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
n,
kb,
nnzb,
&alpha,
descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
B,
k,
&beta,
C,
m);

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • 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 const float B
  • muInt ldb const float beta float C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrmm

MUSPARSE_EXPORT musparseStatus_t musparseDbsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, 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, const double `B, muInt ldb, const double `beta, double *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • 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 const double B
  • muInt ldb const double beta double C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrmm

MUSPARSE_EXPORT musparseStatus_t musparseCbsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, 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, const muComplex `B, muInt ldb, const muComplex `beta, muComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • 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 const muComplex B
  • muInt ldb const muComplex beta muComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrmm

MUSPARSE_EXPORT musparseStatus_t musparseZbsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, 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, const muDoubleComplex `B, muInt ldb, const muDoubleComplex `beta, muDoubleComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • 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 const muDoubleComplex B
  • muInt ldb const muDoubleComplex beta muDoubleComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsrmm

MUSPARSE_EXPORT musparseStatus_t musparseSgebsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, muInt nnzb, const float `alpha, const musparseMatDescr_t descr, const float `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const float `B, muInt ldb, const float `beta, float *C, muInt ldc)

Sparse matrix dense matrix multiplication using GEneral BSR storage format.

musparseXgebsrmm multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"37"\},"children":[\{"type":"text","text":"$mb\n\\times kb$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in GEneral BSR storage format, and the dense formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} (where formula \{"type":"element","name":"formula","attributes":\{"id":"58"\},"children":[\{"type":"text","text":"$k = col_block\\_dim \\times\nkb$"\}]\}) and adds the result to the dense formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} (where formula \{"type":"element","name":"formula","attributes":\{"id":"59"\},"children":[\{"type":"text","text":"$m = row_block\\_dim \\times mb$"\}]\}) that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"60"\},"children":[\{"type":"text","text":"\\[ C := \\alpha \\cdot op(A) \\cdot op(B) + \\beta \\cdot\nC, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"61"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"46"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意: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_NON_TRANSPOSE is supported.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type. Currently, only MUSPARSE_OPERATION_NON_TRANSPOSE is supported.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type. Currently, only MUSPARSE_OPERATION_NON_TRANSPOSE and MUSPARSE_OPERATION_TRANSPOSE are supported.
  • mb: number of block rows of the sparse GEneral BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • n: number of columns of the dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • kb: number of block columns of the sparse GEneral BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • nnzb: number of non-zero blocks of the sparse GEneral BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse GEneral BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb*row_block_dim*col_block_dim elements of the sparse GEneral BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse GEneral BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse GEneral BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • row_block_dim: row size of the blocks in the sparse GEneral BSR matrix.
  • col_block_dim: column size of the blocks in the sparse GEneral BSR matrix.
  • B: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"48"\},"children":[\{"type":"text","text":"$ldb \\times n$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}), formula \{"type":"element","name":"formula","attributes":\{"id":"50"\},"children":[\{"type":"text","text":"$ldb \\times k$"\}]\} otherwise.
  • ldb: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"51"\},"children":[\{"type":"text","text":"$\\max\{(1,\nk)\}$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"52"\},"children":[\{"type":"text","text":"$ op(B) == B$"\}]\}) where formula \{"type":"element","name":"formula","attributes":\{"id":"62"\},"children":[\{"type":"text","text":"$k = col\\_block\\_dim \\times kb$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"63"\},"children":[\{"type":"text","text":"$\\max\{(1, n)\}$"\}]\} otherwise.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • C: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"54"\},"children":[\{"type":"text","text":"$ldc \\times n$"\}]\}.
  • ldc: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"55"\},"children":[\{"type":"text","text":"$\\max\{(1,\nm)\}$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"56"\},"children":[\{"type":"text","text":"$ op(A) == A$"\}]\}) where formula \{"type":"element","name":"formula","attributes":\{"id":"64"\},"children":[\{"type":"text","text":"$m = row\\_block\\_dim \\times mb$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"65"\},"children":[\{"type":"text","text":"$\\max\{(1, k)\}$"\}]\} where formula \{"type":"element","name":"formula","attributes":\{"id":"62"\},"children":[\{"type":"text","text":"$k = col\\_block\\_dim \\times kb$"\}]\} otherwise.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, n, kb, nnzb, ldb, ldc, row_block_dim or col_block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, bsr_val, bsr_row_ptr, bsr_col_ind, B, beta or C pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans_A != MUSPARSE_OPERATION_NON_TRANSPOSE or trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example multiplies a GEneral BSR matrix with a dense matrix.

// 1 2 0 3 0 0
// A = 0 4 5 0 0 0
// 0 0 0 7 8 0
// 0 0 1 2 4 1

muInt row_block_dim = 2;
muInt col_block_dim = 3;
muInt mb = 2;
muInt kb = 2;
muInt nnzb = 4;
musparseDirection_t dir = MUSPARSE_DIRECTION_ROW;

bsr_row_ptr[mb+1] = \{0, 2, 4\}; // device memory
bsr_col_ind[nnzb] = \{0, 1, 0, 1\}; // device memory
bsr_val[nnzb`row_block_dim`col_block_dim] = \{1, 2, 0, 0, 4, 5, 3, 0, 0,
0, 0, 0, 0, 0, 0, 0, 0, 1, 7, 8, 0, 2, 4, 1\}; // device memory

// Set dimension n of B
muInt n = 64;
muInt m = mb * row_block_dim;
muInt k = kb * col_block_dim;

// Allocate and generate dense matrix B
std::vector<float> hB(k * n);
for(muInt i = 0; i < k * n; ++i)
\{
hB[i] = static_cast<float>(rand()) / RAND_MAX;
\}

// Copy B to the device
float* B;
musaMalloc((void``)&B, sizeof(float) ` k ` n);
musaMemcpy(B, hB.data(), sizeof(float) ` k ` n, musaMemcpyHostToDevice);

// alpha and beta
float alpha = 1.0f;
float beta = 0.0f;

// Allocate memory for the resulting matrix C
float* C;
musaMalloc((void``)&C, sizeof(float) ` m ` n);

// Perform the matrix multiplication
musparseSgebsrmm(handle,
dir,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
mb,
n,
kb,
nnzb,
&alpha,
descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
row_block_dim,
col_block_dim,
B,
k,
&beta,
C,
m);

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • muInt nnzb const float alpha
  • const musparseMatDescr_t descr const float bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const float B
  • muInt ldb const float beta float C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsrmm

MUSPARSE_EXPORT musparseStatus_t musparseDgebsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, muInt nnzb, const double `alpha, const musparseMatDescr_t descr, const double `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const double `B, muInt ldb, const double `beta, double *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • muInt nnzb const double alpha
  • const musparseMatDescr_t descr const double bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const double B
  • muInt ldb const double beta double C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsrmm

MUSPARSE_EXPORT musparseStatus_t musparseCgebsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, muInt nnzb, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const muComplex `B, muInt ldb, const muComplex `beta, muComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • muInt nnzb const muComplex alpha
  • const musparseMatDescr_t descr const muComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const muComplex B
  • muInt ldb const muComplex beta muComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsrmm

MUSPARSE_EXPORT musparseStatus_t musparseZgebsrmm(musparseHandle_t handle, musparseDirection_t dir, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt mb, muInt n, muInt kb, muInt nnzb, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const muDoubleComplex `B, muInt ldb, const muDoubleComplex `beta, muDoubleComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt mb
  • muInt n
  • muInt kb
  • muInt nnzb const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim const muDoubleComplex B
  • muInt ldb const muDoubleComplex beta muDoubleComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrmm

MUSPARSE_EXPORT musparseStatus_t musparseScsrmm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const float `B, muInt ldb, const float `beta, float *C, muInt ldc)

Sparse matrix dense matrix multiplication using CSR storage format.

musparseXcsrmm multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"66"\},"children":[\{"type":"text","text":"$m\n\\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in CSR storage format, and the dense formula \{"type":"element","name":"formula","attributes":\{"id":"67"\},"children":[\{"type":"text","text":"$k\n\\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} and adds the result to the dense formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"68"\},"children":[\{"type":"text","text":"\\[ C\n:= \\alpha \\cdot op(A) \\cdot op(B) + \\beta \\cdot C, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"69"\},"children":[\{"type":"text","text":"\\[ op(A) =\n\\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

for(i = 0; i < ldc; ++i)
\{
for(j = 0; j < n; ++j)
\{
C[i][j] = beta * C[i][j];

for(k = csr_row_ptr[i]; k < csr_row_ptr[i + 1]; ++k)
\{
C[i][j] += alpha ` csr_val[k] ` B[csr_col_ind[k]][j];
\}
\}
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • m: number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • n: number of columns of the dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • k: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • nnz: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnz elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • B: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"48"\},"children":[\{"type":"text","text":"$ldb \\times n$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}), formula \{"type":"element","name":"formula","attributes":\{"id":"50"\},"children":[\{"type":"text","text":"$ldb \\times k$"\}]\} otherwise.
  • ldb: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"51"\},"children":[\{"type":"text","text":"$\\max\{(1,\nk)\}$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}), formula \{"type":"element","name":"formula","attributes":\{"id":"63"\},"children":[\{"type":"text","text":"$\\max\{(1, n)\}$"\}]\} otherwise.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • C: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"54"\},"children":[\{"type":"text","text":"$ldc \\times n$"\}]\}.
  • ldc: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"55"\},"children":[\{"type":"text","text":"$\\max\{(1,\nm)\}$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}), formula \{"type":"element","name":"formula","attributes":\{"id":"65"\},"children":[\{"type":"text","text":"$\\max\{(1, k)\}$"\}]\} otherwise.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, k, nnz, ldb or ldc is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, alpha, csr_val, csr_row_ptr, csr_col_ind, B, beta or C pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example multiplies a CSR matrix with a dense matrix.

// 1 2 0 3 0
// A = 0 4 5 0 0
// 6 0 0 7 8

muInt m = 3;
muInt k = 5;
muInt nnz = 8;

csr_row_ptr[m+1] = \{0, 3, 5, 8\}; // device memory
csr_col_ind[nnz] = \{0, 1, 3, 1, 2, 0, 3, 4\}; // device memory
csr_val[nnz] = \{1, 2, 3, 4, 5, 6, 7, 8\}; // device memory

// Set dimension n of B
muInt n = 64;

// Allocate and generate dense matrix B
std::vector<float> hB(k * n);
for(muInt i = 0; i < k * n; ++i)
\{
hB[i] = static_cast<float>(rand()) / RAND_MAX;
\}

// Copy B to the device
float* B;
musaMalloc((void``)&B, sizeof(float) ` k ` n);
musaMemcpy(B, hB.data(), sizeof(float) ` k ` n, musaMemcpyHostToDevice);

// alpha and beta
float alpha = 1.0f;
float beta = 0.0f;

// Allocate memory for the resulting matrix C
float* C;
musaMalloc((void``)&C, sizeof(float) ` m ` n);

// Perform the matrix multiplication
musparseScsrmm(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
nnz,
&alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
B,
k,
&beta,
C,
m);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind const float B
  • muInt ldb const float beta float C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrmm

MUSPARSE_EXPORT musparseStatus_t musparseDcsrmm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const double `B, muInt ldb, const double `beta, double *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind const double B
  • muInt ldb const double beta double C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrmm

MUSPARSE_EXPORT musparseStatus_t musparseCcsrmm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muComplex `B, muInt ldb, const muComplex `beta, muComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muComplex B
  • muInt ldb const muComplex beta muComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrmm

MUSPARSE_EXPORT musparseStatus_t musparseZcsrmm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muDoubleComplex `B, muInt ldb, const muDoubleComplex `beta, muDoubleComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muDoubleComplex B
  • muInt ldb const muDoubleComplex beta muDoubleComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrsm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsrsm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const float `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, size_t `buffer_size)

Sparse triangular system solve using CSR storage format.

musparseXcsrsm_bufferSize returns the size of the temporary storage buffer that is required by musparseScsrsm_analysis(), musparseDcsrsm_analysis(), musparseCcsrsm_analysis(), musparseZcsrsm_analysis(), musparseScsrsm_solve(), musparseDcsrsm_solve(), musparseCcsrsm_solve() and musparseZcsrsm_solve(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix A operation type.
  • trans_B: matrix B operation type.
  • m: number of rows of the sparse CSR matrix A.
  • nrhs: number of columns of the dense matrix op(B).
  • nnz: number of non-zero entries of the sparse CSR matrix A.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse CSR matrix A.
  • csr_val: array of nnz elements of the sparse CSR matrix A.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix A.
  • B: array of m formula \{"type":"element","name":"formula","attributes":\{"id":"71"\},"children":[\{"type":"text","text":"$\\times$"\}]\} nrhs elements of the rhs matrix B.
  • ldb: leading dimension of rhs matrix B.
  • info: structure that holds the information collected during the analysis step.
  • policy: MUSPARSE_SOLVE_POLICY_USE_LEVEL.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseScsrsm_analysis(), musparseDcsrsm_analysis(), musparseCcsrsm_analysis(), musparseZcsrsm_analysis(), musparseScsrsm_solve(), musparseDcsrsm_solve(), musparseCcsrsm_solve() and musparseZcsrsm_solve().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, nrhs or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, descr, csr_val, csr_row_ptr, csr_col_ind, B, info or buffer_size pointer 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_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind const float B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrsm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsrsm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const double `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind const double B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrsm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsrsm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muComplex `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muComplex B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrsm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsrsm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muDoubleComplex `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muDoubleComplex B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrsm_analysis

MUSPARSE_EXPORT musparseStatus_t musparseScsrsm_analysis(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const float `B, muInt ldb, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Sparse triangular system solve using CSR storage format.

musparseXcsrsm_analysis performs the analysis step for musparseScsrsm_solve(), musparseDcsrsm_solve(), musparseCcsrsm_solve() and musparseZcsrsm_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 musparseXcsrsm_clear().

musparseXcsrsm_analysis can share its meta data with musparseScsrilu0_analysis(), musparseDcsrilu0_analysis(), musparseCcsrilu0_analysis(), musparseZcsrilu0_analysis(), musparseScsric0_analysis(), musparseDcsric0_analysis(), musparseCcsric0_analysis(), musparseZcsric0_analysis(), musparseScsrsv_analysis(), musparseDcsrsv_analysis(), musparseCcsrsv_analysis() and musparseZcsrsv_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.

注意: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.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix A operation type.
  • trans_B: matrix B operation type.
  • m: number of rows of the sparse CSR matrix A.
  • nrhs: number of columns of the dense matrix op(B).
  • nnz: number of non-zero entries of the sparse CSR matrix A.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse CSR matrix A.
  • csr_val: array of nnz elements of the sparse CSR matrix A.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix A.
  • B: array of m formula \{"type":"element","name":"formula","attributes":\{"id":"71"\},"children":[\{"type":"text","text":"$\\times$"\}]\} nrhs elements of the rhs matrix B.
  • ldb: leading dimension of rhs matrix B.
  • 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, nrhs or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, descr, csr_val, csr_row_ptr, csr_col_ind, B, info or temp_buffer pointer 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_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind const float B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrsm_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDcsrsm_analysis(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const double `B, muInt ldb, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind const double B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrsm_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCcsrsm_analysis(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muComplex `B, muInt ldb, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muComplex B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrsm_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZcsrsm_analysis(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muDoubleComplex `B, muInt ldb, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muDoubleComplex B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrsm_solve

MUSPARSE_EXPORT musparseStatus_t musparseScsrsm_solve(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const float `alpha, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, float `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Sparse triangular system solve using CSR storage format.

musparseXcsrsm_solve solves a sparse triangular linear system of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix, defined in CSR storage format, a dense solution matrix formula \{"type":"element","name":"formula","attributes":\{"id":"72"\},"children":[\{"type":"text","text":"$X$"\}]\} and the right-hand side matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"73"\},"children":[\{"type":"text","text":"\\[ op(A) \\cdot op(X) = \\alpha \\cdot\nop(B), \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"74"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} , formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"75"\},"children":[\{"type":"text","text":"\\[\n op(X) = \\left\\\{\n \\begin\{array\}\{ll\}\n X, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n X^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n X^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

musparseXcsrsm_solve requires a user allocated temporary buffer. Its size is returned by musparseScsrsm_bufferSize(), musparseDcsrsm_bufferSize(), musparseCcsrsm_bufferSize() or musparseZcsrsm_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseScsrsm_analysis(), musparseDcsrsm_analysis(), musparseCcsrsm_analysis() or musparseZcsrsm_analysis(). musparseXcsrsm_solve reports the first zero pivot (either numerical or structural zero). The zero pivot status can be checked calling musparseXcsrsm_zeroPivot(). If musparseDiagType_t == MUSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if formula \{"type":"element","name":"formula","attributes":\{"id":"22"\},"children":[\{"type":"text","text":"$A_\{j,j\} = 0$"\}]\} for some formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}.

注意:The sparse CSR matrix has to be sorted. This can be achieved by calling musparseXcsrsort().

注意: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 and trans_B != MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix A operation type.
  • trans_B: matrix B operation type.
  • m: number of rows of the sparse CSR matrix A.
  • nrhs: number of columns of the dense matrix op(B).
  • nnz: number of non-zero entries of the sparse CSR matrix A.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse CSR matrix A.
  • csr_val: array of nnz elements of the sparse CSR matrix A.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix A.
  • B: array of m formula \{"type":"element","name":"formula","attributes":\{"id":"71"\},"children":[\{"type":"text","text":"$\\times$"\}]\} nrhs elements of the rhs matrix B.
  • ldb: leading dimension of rhs matrix B.
  • 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, nrhs or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, descr, csr_val, csr_row_ptr, csr_col_ind, B, info or temp_buffer pointer 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_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

Consider the lower triangular formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"23"\},"children":[\{"type":"text","text":"$L$"\}]\}, stored in CSR storage format with unit diagonal. The following example solves formula \{"type":"element","name":"formula","attributes":\{"id":"76"\},"children":[\{"type":"text","text":"$L \\cdot X\n= B$"\}]\}.

// 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;
musparseDcsrsm_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nrhs,
nnz,
&alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
B,
ldb,
info,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
&buffer_size);

// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);

// Perform analysis step
musparseDcsrsm_analysis(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nrhs,
nnz,
&alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
B,
ldb,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);

// Solve LX = B
musparseDcsrsm_solve(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nrhs,
nnz,
&alpha,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
B,
ldb,
info,
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);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const float alpha
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind float B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrsm_solve

MUSPARSE_EXPORT musparseStatus_t musparseDcsrsm_solve(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const double `alpha, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, double `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const double alpha
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind double B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrsm_solve

MUSPARSE_EXPORT musparseStatus_t musparseCcsrsm_solve(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const muComplex `alpha, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muComplex `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const muComplex alpha
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind muComplex B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrsm_solve

MUSPARSE_EXPORT musparseStatus_t musparseZcsrsm_solve(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt nrhs, muInt nnz, const muDoubleComplex `alpha, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muDoubleComplex `B, muInt ldb, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt nrhs
  • muInt nnz const muDoubleComplex alpha
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind muDoubleComplex B
  • muInt ldb
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsm_bufferSize

MUSPARSE_EXPORT 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)

Sparse triangular system solve using BSR storage format.

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.

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 nnzb blocks of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb containing 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().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nrhs, nnzb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr, bsr_col_ind, info or buffer_size pointer 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.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsm_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsm_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsm_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsm_analysis

MUSPARSE_EXPORT 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)

Sparse triangular system solve using BSR storage format.

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.

注意: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.

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 nnzb blocks of the sparse BSR matrix A.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix A.
  • bsr_col_ind: array of nnzb containing 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nrhs, nnzb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr, bsr_col_ind, info or temp_buffer pointer 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.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsm_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsm_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsm_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrsm_solve

MUSPARSE_EXPORT 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)

Sparse triangular system solve using BSR storage format.

musparseXbsrsm_solve solves a sparse triangular linear system of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix, defined in BSR storage format, a dense solution matrix formula \{"type":"element","name":"formula","attributes":\{"id":"72"\},"children":[\{"type":"text","text":"$X$"\}]\} and the right-hand side matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"73"\},"children":[\{"type":"text","text":"\\[ op(A) \\cdot op(X) = \\alpha \\cdot\nop(B), \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"74"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} , formula \{"type":"element","name":"formula","attributes":\{"id":"77"\},"children":[\{"type":"text","text":"\\[\n op(X) = \\left\\\{\n \\begin\{array\}\{ll\}\n X, & \\text\{if trans_X == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n X^T, & \\text\{if trans_X == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n X^H, & \\text\{if trans_X == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

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 formula \{"type":"element","name":"formula","attributes":\{"id":"22"\},"children":[\{"type":"text","text":"$A_\{j,j\} = 0$"\}]\} for some formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}.

注意:The sparse BSR matrix has to be sorted.

注意:Operation type of B and X must match, if formula \{"type":"element","name":"formula","attributes":\{"id":"78"\},"children":[\{"type":"text","text":"$op(B)=B, op(X)=X$"\}]\}.

注意: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 and trans_X != MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE is supported.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr: descriptor of the sparse BSR matrix A.
  • bsr_val: array of nnzb blocks of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb containing 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nrhs, nnzb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, descr, bsr_val, bsr_row_ptr, bsr_col_ind, B, X info or temp_buffer pointer 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.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrsm_solve

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrsm_solve

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrsm_solve

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgemmi

MUSPARSE_EXPORT musparseStatus_t musparseSgemmi(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const float `alpha, const float `A, muInt lda, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const float `beta, float *C, muInt ldc)

Dense matrix sparse matrix multiplication using CSR storage format.

musparseXgemmi multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a dense formula \{"type":"element","name":"formula","attributes":\{"id":"66"\},"children":[\{"type":"text","text":"$m\n\\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} and the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, defined in CSR storage format and adds the result to the dense formula \{"type":"element","name":"formula","attributes":\{"id":"79"\},"children":[\{"type":"text","text":"$m \\times\nn$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"80"\},"children":[\{"type":"text","text":"\\[\n C := \\alpha \\cdot op(A) \\cdot op(B) + \\beta \\cdot C\n \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"81"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • m: number of rows of the dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • k: number of columns of the dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • nnz: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • A: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"82"\},"children":[\{"type":"text","text":"$lda \\times k$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or formula \{"type":"element","name":"formula","attributes":\{"id":"83"\},"children":[\{"type":"text","text":"$lda \\times m$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).
  • lda: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"84"\},"children":[\{"type":"text","text":"$m$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}) or formula \{"type":"element","name":"formula","attributes":\{"id":"85"\},"children":[\{"type":"text","text":"$k$"\}]\} ( formula \{"type":"element","name":"formula","attributes":\{"id":"29"\},"children":[\{"type":"text","text":"$op(A) == A^T$"\}]\} or formula \{"type":"element","name":"formula","attributes":\{"id":"30"\},"children":[\{"type":"text","text":"$op(A) == A^H$"\}]\}).
  • descr: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnz elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • C: array of dimension formula \{"type":"element","name":"formula","attributes":\{"id":"54"\},"children":[\{"type":"text","text":"$ldc \\times n$"\}]\} that holds the values of formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • ldc: leading dimension of formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, must be at least formula \{"type":"element","name":"formula","attributes":\{"id":"84"\},"children":[\{"type":"text","text":"$m$"\}]\}.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, k, nnz, lda or ldc is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, A, csr_val, csr_row_ptr, csr_col_ind, beta or C pointer is invalid.

Example:

This example multiplies a dense matrix with a CSC matrix.

muInt m = 2;
muInt n = 5;
muInt k = 3;
muInt nnz = 8;
muInt lda = m;
muInt ldc = m;

// Matrix A (m x k)
// ( 9.0 10.0 11.0 )
// ( 12.0 13.0 14.0 )

// Matrix B (k x n)
// ( 1.0 2.0 0.0 3.0 0.0 )
// ( 0.0 4.0 5.0 0.0 0.0 )
// ( 6.0 0.0 0.0 7.0 8.0 )

// Matrix C (m x n)
// ( 15.0 16.0 17.0 18.0 19.0 )
// ( 20.0 21.0 22.0 23.0 24.0 )

A[lda * k] = \{9.0, 12.0, 10.0, 13.0, 11.0, 14.0\}; //
device memory csc_col_ptr_B[n + 1] = \{0, 2, 4, 5, 7, 8\}; // device memory
csc_row_ind_B[nnz] = \{0, 0, 1, 1, 2, 3, 3, 4\}; //
device memory csc_val_B[nnz] =
\{1.0, 6.0, 2.0, 4.0, 5.0, 3.0, 7.0, 8.0\}; // device memory C[ldc * n] =
\{15.0, 20.0, 16.0, 21.0, 17.0, 22.0, // device memory
18.0, 23.0, 19.0, 24.0\};

// alpha and beta
float alpha = 1.0f;
float beta = 0.0f;

// Perform the matrix multiplication
musparseSgemmi(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_TRANSPOSE,
m,
n,
k,
nnz,
&alpha,
A,
lda,
descr_B,
csc_val_B,
csc_col_ptr_B,
csc_row_ind_B,
&beta,
C,
ldc);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const float alpha const float A
  • muInt lda
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind const float beta float C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgemmi

MUSPARSE_EXPORT musparseStatus_t musparseDgemmi(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const double `alpha, const double `A, muInt lda, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const double `beta, double *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const double alpha const double A
  • muInt lda
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind const double beta double C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgemmi

MUSPARSE_EXPORT musparseStatus_t musparseCgemmi(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const muComplex `alpha, const muComplex `A, muInt lda, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muComplex `beta, muComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const muComplex alpha const muComplex A
  • muInt lda
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muComplex beta muComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgemmi

MUSPARSE_EXPORT musparseStatus_t musparseZgemmi(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, muInt nnz, const muDoubleComplex `alpha, const muDoubleComplex `A, muInt lda, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const muDoubleComplex `beta, muDoubleComplex *C, muInt ldc)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • muInt nnz const muDoubleComplex alpha const muDoubleComplex A
  • muInt lda
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const muDoubleComplex beta muDoubleComplex C
  • muInt ldc

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrgeam

MUSPARSE_EXPORT musparseStatus_t musparseScsrgeam(musparseHandle_t handle, muInt m, muInt n, const float `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const float `beta, const musparseMatDescr_t descr_B, muInt nnz_B, const float `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const musparseMatDescr_t descr_C, float `csr_val_C, const muInt `csr_row_ptr_C, muInt *csr_col_ind_C)

Sparse matrix sparse matrix addition using CSR storage format.

musparseXcsrgeam multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in CSR storage format, multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\} with the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, defined in CSR storage format, and adds both resulting matrices to obtain the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, defined in CSR storage format, such that formula \{"type":"element","name":"formula","attributes":\{"id":"86"\},"children":[\{"type":"text","text":"\\[ C := \\alpha \\cdot A + \\beta \\cdot B. \\]"\}]\}

It is assumed that csr_row_ptr_C has already been filled and that csr_val_C and csr_col_ind_C are allocated by the user. csr_row_ptr_C and allocation size of csr_col_ind_C and csr_val_C is defined by the number of non-zero elements of the sparse CSR matrix C. Both can be obtained by musparseXcsrgeam_nnz().

注意:Both scalars formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"87"\},"children":[\{"type":"text","text":"$beta$"\}]\} have to be valid.

注意:Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr_A: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_A: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_val_A: array of nnz_A elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • descr_B: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_B: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_val_B: array of nnz_B elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr_B: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_col_ind_B: array of nnz_B elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • descr_C: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_C: array of elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_col_ind_C: array of elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, nnz_A or nnz_B is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, descr_A, csr_val_A, csr_row_ptr_A, csr_col_ind_A, beta, descr_B, csr_val_B, csr_row_ptr_B, csr_col_ind_B, descr_C, csr_val_C, csr_row_ptr_C or csr_col_ind_C is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDmusparseMatrixType_t` != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example adds two CSR matrices.

// Initialize scalar multipliers
float alpha = 1.0f;
float beta = 1.0f;

// Create matrix descriptors
musparseMatDescr_t descr_A;
musparseMatDescr_t descr_B;
musparseMatDescr_t descr_C;

musparseCreateMatDescr(&descr_A);
musparseCreateMatDescr(&descr_B);
musparseCreateMatDescr(&descr_C);

// Set pointer mode
musparseSetPointerMode(handle, MUSPARSE_POINTER_MODE_HOST);

// Obtain number of total non-zero entries in C and row pointers of C
muInt nnz_C;
musaMalloc((void``)&csr_row_ptr_C, sizeof(muInt) * (m + 1));

musparseXcsrgeam_nnz(handle,
m,
n,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
descr_C,
csr_row_ptr_C,
&nnz_C);

// Compute column indices and values of C
musaMalloc((void``)&csr_col_ind_C, sizeof(muInt) * nnz_C);
musaMalloc((void``)&csr_val_C, sizeof(float) * nnz_C);

musparseScsrgeam(handle,
m,
n,
&alpha,
descr_A,
nnz_A,
csr_val_A,
csr_row_ptr_A,
csr_col_ind_A,
&beta,
descr_B,
nnz_B,
csr_val_B,
csr_row_ptr_B,
csr_col_ind_B,
descr_C,
csr_val_C,
csr_row_ptr_C,
csr_col_ind_C);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const float beta
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const float csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B
  • const musparseMatDescr_t descr_C float csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrgeam

MUSPARSE_EXPORT musparseStatus_t musparseDcsrgeam(musparseHandle_t handle, muInt m, muInt n, const double `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const double `beta, const musparseMatDescr_t descr_B, muInt nnz_B, const double `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const musparseMatDescr_t descr_C, double `csr_val_C, const muInt `csr_row_ptr_C, muInt *csr_col_ind_C)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const double beta
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const double csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B
  • const musparseMatDescr_t descr_C double csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrgeam

MUSPARSE_EXPORT musparseStatus_t musparseCcsrgeam(musparseHandle_t handle, muInt m, muInt n, const muComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const muComplex `beta, const musparseMatDescr_t descr_B, muInt nnz_B, const muComplex `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const musparseMatDescr_t descr_C, muComplex `csr_val_C, const muInt `csr_row_ptr_C, muInt *csr_col_ind_C)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const muComplex beta
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muComplex csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B
  • const musparseMatDescr_t descr_C muComplex csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrgeam

MUSPARSE_EXPORT musparseStatus_t musparseZcsrgeam(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muDoubleComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const muDoubleComplex `beta, const musparseMatDescr_t descr_B, muInt nnz_B, const muDoubleComplex `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const musparseMatDescr_t descr_C, muDoubleComplex `csr_val_C, const muInt `csr_row_ptr_C, muInt *csr_col_ind_C)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muDoubleComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const muDoubleComplex beta
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muDoubleComplex csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B
  • const musparseMatDescr_t descr_C muDoubleComplex csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrgemm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsrgemm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const float `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const float `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, musparseMatInfo_t info_C, size_t *buffer_size)

Sparse matrix sparse matrix multiplication using CSR storage format.

musparseXcsrgemm_bufferSize returns the size of the temporary storage buffer that is required by musparseXcsrgemm_nnz(), musparseScsrgemm(), musparseDcsrgemm(), musparseCcsrgemm() and musparseZcsrgemm(). The temporary storage buffer must be allocated by the user.

注意:Please note, that for matrix products with more than 4096 non-zero entries per row, additional temporary storage buffer is allocated by the algorithm.

注意:Please note, that for matrix products with more than 8192 intermediate products per row, additional temporary storage buffer is allocated by the algorithm.

注意:Currently, only trans_A == trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • m: number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • k: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr_A: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_A: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr_A: array of m+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}, k+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\}.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • descr_B: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_B: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr_B: array of k+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}, m+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • csr_col_ind_B: array of nnz_B elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • descr_D: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_D: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_row_ptr_D: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_col_ind_D: array of nnz_D elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • info_C: structure that holds meta data for the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseXcsrgemm_nnz(), musparseScsrgemm(), musparseDcsrgemm(), musparseCcsrgemm() and musparseZcsrgemm().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, k, nnz_A, nnz_B or nnz_D is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha and beta are invalid, descr_A, csr_row_ptr_A, csr_col_ind_A, descr_B, csr_row_ptr_B or csr_col_ind_B are invalid if alpha is valid, descr_D, csr_row_ptr_D or csr_col_ind_D is invalid if beta is valid, info_C or buffer_size is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDtrans_A!= MUSPARSE_OPERATION_NON_TRANSPOSE,trans_B!= MUSPARSE_OPERATION_NON_TRANSPOSE, ormusparseMatrixType_t` != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const float alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const float beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • musparseMatInfo_t info_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrgemm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsrgemm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const double `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const double `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, musparseMatInfo_t info_C, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const double alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const double beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • musparseMatInfo_t info_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrgemm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsrgemm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const muComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const muComplex `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, musparseMatInfo_t info_C, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const muComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const muComplex beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • musparseMatInfo_t info_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrgemm_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsrgemm_bufferSize(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const muDoubleComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const muDoubleComplex `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, musparseMatInfo_t info_C, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const muDoubleComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const muDoubleComplex beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • musparseMatInfo_t info_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrgemm

MUSPARSE_EXPORT musparseStatus_t musparseScsrgemm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const float `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const float `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const float `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const float `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, float `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Sparse matrix sparse matrix multiplication using CSR storage format.

musparseXcsrgemm multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"90"\},"children":[\{"type":"text","text":"$m \\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in CSR storage format, and the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, defined in CSR storage format, and adds the result to the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}. The final result is stored in the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"31"\},"children":[\{"type":"text","text":"$m\n \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, defined in CSR storage format, such that formula \{"type":"element","name":"formula","attributes":\{"id":"91"\},"children":[\{"type":"text","text":"\\[ C :=\n \\alpha \\cdot op(A) \\cdot op(B) + \\beta \\cdot D, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"92"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"93"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

It is assumed that csr_row_ptr_C has already been filled and that csr_val_C and csr_col_ind_C are allocated by the user. csr_row_ptr_C and allocation size of csr_col_ind_C and csr_val_C is defined by the number of non-zero elements of the sparse CSR matrix C. Both can be obtained by musparseXcsrgemm_nnz(). The required buffer size for the computation can be obtained by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() and musparseZcsrgemm_bufferSize(), respectively.

注意:If formula \{"type":"element","name":"formula","attributes":\{"id":"94"\},"children":[\{"type":"text","text":"$\\alpha == 0$"\}]\}, then formula \{"type":"element","name":"formula","attributes":\{"id":"95"\},"children":[\{"type":"text","text":"$C = \\beta \\cdot D$"\}]\} will be computed.

注意:If formula \{"type":"element","name":"formula","attributes":\{"id":"96"\},"children":[\{"type":"text","text":"$\\beta == 0$"\}]\}, then formula \{"type":"element","name":"formula","attributes":\{"id":"97"\},"children":[\{"type":"text","text":"$C = \\alpha \\cdot op(A) \\cdot op(B)$"\}]\} will be computed.

注意:formula \{"type":"element","name":"formula","attributes":\{"id":"98"\},"children":[\{"type":"text","text":"$\\alpha == beta == 0$"\}]\} is invalid.

注意:Currently, only trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

注意:Please note, that for matrix products with more than 4096 non-zero entries per row, additional temporary storage buffer is allocated by the algorithm.

注意:This function supports unsorted CSR matrices as input, while output will be sorted. Please note that matrices B and D can only be unsorted up to 4096 non-zero entries per row. If this number is exceeded, MUSPARSE_EXPORT MUSPARSE_STATUS_REQUIRES_SORTED_STORAGE will be returned.

@param[in]
handle handle to the musparse library context queue.
@param[in]
trans_A matrix \f$A\f$ operation type.
@param[in]
trans_B matrix \f$B\f$ operation type.
@param[in]
m number of rows of the sparse CSR matrix \f$op(A)\f$ and

formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.

Parameters:

  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • k: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr_A: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_A: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_val_A: array of nnz_A elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr_A: array of m+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}, k+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\}.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • descr_B: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_B: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_val_B: array of nnz_B elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr_B: array of k+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}, m+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • csr_col_ind_B: array of nnz_B elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • descr_D: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_D: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_val_D: array of nnz_D elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_row_ptr_D: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_col_ind_D: array of nnz_D elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • descr_C: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_C: array of nnz_C elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_col_ind_C: array of nnz_C elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • info_C: structure that holds meta data for the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() or musparseZcsrgemm_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, k, nnz_A, nnz_B or nnz_D is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha and beta are invalid, descr_A, csr_val_A, csr_row_ptr_A, csr_col_ind_A, descr_B, csr_val_B, csr_row_ptr_B or csr_col_ind_B are invalid if alpha is valid, descr_D, csr_val_D, csr_row_ptr_D or csr_col_ind_D is invalid if beta is valid, csr_val_C, csr_row_ptr_C, csr_col_ind_C, info_C or temp_buffer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR additional buffer for long rows could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans_A != MUSPARSE_OPERATION_NON_TRANSPOSE, trans_B != MUSPARSE_OPERATION_NON_TRANSPOSE, or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example multiplies two CSR matrices with a scalar alpha and adds the result to another CSR matrix.

// Initialize scalar multipliers
float alpha = 2.0f;
float beta = 1.0f;

// Create matrix descriptors
musparseMatDescr_t descr_A;
musparseMatDescr_t descr_B;
musparseMatDescr_t descr_C;
musparseMatDescr_t descr_D;

musparseCreateMatDescr(&descr_A);
musparseCreateMatDescr(&descr_B);
musparseCreateMatDescr(&descr_C);
musparseCreateMatDescr(&descr_D);

// Create matrix info structure
musparseMatInfo_t info_C;
musparseCreateMatInfo(&info_C);

// Set pointer mode
musparseSetPointerMode(handle, MUSPARSE_POINTER_MODE_HOST);

// Query musparse for the required buffer size
size_t buffer_size;

musparseScsrgemm_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
&alpha,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
&beta,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
info_C,
&buffer_size);

// Allocate buffer
void* buffer;
musaMalloc(&buffer, buffer_size);

// Obtain number of total non-zero entries in C and row pointers of C
muInt nnz_C;
musaMalloc((void``)&csr_row_ptr_C, sizeof(muInt) * (m + 1));

musparseXcsrgemm_nnz(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
descr_C,
csr_row_ptr_C,
&nnz_C,
info_C,
buffer);

// Compute column indices and values of C
musaMalloc((void``)&csr_col_ind_C, sizeof(muInt) * nnz_C);
musaMalloc((void``)&csr_val_C, sizeof(float) * nnz_C);

musparseScsrgemm(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
&alpha,
descr_A,
nnz_A,
csr_val_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_val_B,
csr_row_ptr_B,
csr_col_ind_B,
&beta,
descr_D,
nnz_D,
csr_val_D,
csr_row_ptr_D,
csr_col_ind_D,
descr_C,
csr_val_C,
csr_row_ptr_C,
csr_col_ind_C,
info_C,
buffer);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const float alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const float csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const float beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const float csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C float csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrgemm

MUSPARSE_EXPORT musparseStatus_t musparseDcsrgemm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const double `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const double `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const double `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const double `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, double `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const double alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const double csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const double beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const double csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C double csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrgemm

MUSPARSE_EXPORT musparseStatus_t musparseCcsrgemm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const muComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muComplex `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const muComplex `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muComplex `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muComplex `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const muComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muComplex csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const muComplex beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muComplex csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C muComplex csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrgemm

MUSPARSE_EXPORT musparseStatus_t musparseZcsrgemm(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const muDoubleComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muDoubleComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muDoubleComplex `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const muDoubleComplex `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muDoubleComplex `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muDoubleComplex `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const muDoubleComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muDoubleComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muDoubleComplex csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const muDoubleComplex beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muDoubleComplex csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C muDoubleComplex csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrgemm_symbolic

MUSPARSE_EXPORT musparseStatus_t musparseXcsrgemm_symbolic(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const musparseMatDescr_t descr_A, muInt nnz_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const musparseMatDescr_t descr_D, muInt nnz_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muInt nnz_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Sparse matrix sparse matrix symbolic multiplication using CSR storage format.

musparseXcsrgemm_symbolic multiplies two sparsity patterns and add an extra one: formula \{"type":"element","name":"formula","attributes":\{"id":"99"\},"children":[\{"type":"text","text":"\\[ opA \\cdot op(B) + D \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"90"\},"children":[\{"type":"text","text":"$m \\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in CSR storage format, the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, defined in CSR storage format and the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}. The * final result is stored in the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, defined in CSR storage format, such that formula \{"type":"element","name":"formula","attributes":\{"id":"100"\},"children":[\{"type":"text","text":"\\[ C := op(A) \\cdot op(B) + D, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"81"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

It is assumed that csr_row_ptr_C has already been filled and that and csr_col_ind_C is allocated by the user. csr_row_ptr_C and allocation size of csr_col_ind_C is defined by the number of non-zero elements of the sparse CSR matrix C. Both can be obtained by musparseXcsrgemm_nnz(). The required buffer size for the computation can be obtained by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() and musparseZcsrgemm_bufferSize(), respectively.

注意:Currently, only trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

注意:Please note, that for matrix products with more than 4096 non-zero entries per row, additional temporary storage buffer is allocated by the algorithm.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • m: number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • k: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • descr_A: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_A: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr_A: array of m+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}, k+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\}.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • descr_B: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_B: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr_B: array of k+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}, m+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • csr_col_ind_B: array of nnz_B elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • descr_D: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_D: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_row_ptr_D: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_col_ind_D: array of nnz_D elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • descr_C: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_C: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_col_ind_C: array of nnz_C elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • info_C: structure that holds meta data for the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() or musparseZcsrgemm_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, k, nnz_A, nnz_B or nnz_D is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr_A, csr_row_ptr_A, csr_col_ind_A, descr_B, csr_row_ptr_B or csr_col_ind_B, descr_D, csr_row_ptr_D, csr_col_ind_D csr_row_ptr_C, csr_col_ind_C, info_C or temp_buffer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR additional buffer for long rows could not be allocated. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans_A != MUSPARSE_OPERATION_NON_TRANSPOSE, trans_B != MUSPARSE_OPERATION_NON_TRANSPOSE, or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example multiplies symbolically two CSR matrices and adds the result to another CSR matrix.

// Initialize scalar multipliers
float alpha = 2.0f;
float beta = 1.0f;

// Create matrix descriptors
musparseMatDescr_t descr_A;
musparseMatDescr_t descr_B;
musparseMatDescr_t descr_C;
musparseMatDescr_t descr_D;

musparseCreateMatDescr(&descr_A);
musparseCreateMatDescr(&descr_B);
musparseCreateMatDescr(&descr_C);
musparseCreateMatDescr(&descr_D);

// Create matrix info structure
musparseMatInfo_t info_C;
musparseCreateMatInfo(&info_C);

// Set pointer mode
musparseSetPointerMode(handle, MUSPARSE_POINTER_MODE_HOST);

// Query musparse for the required buffer size
size_t buffer_size;

musparseScsrgemm_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
&alpha,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
&beta,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
info_C,
&buffer_size);

// Allocate buffer
void* buffer;
musaMalloc(&buffer, buffer_size);

// Obtain number of total non-zero entries in C and row pointers of C
muInt nnz_C;
musaMalloc((void``)&csr_row_ptr_C, sizeof(muInt) * (m + 1));

musparseXcsrgemm_nnz(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
descr_C,
csr_row_ptr_C,
&nnz_C,
info_C,
buffer);

// Compute column indices of C
musaMalloc((void``)&csr_col_ind_C, sizeof(muInt) * nnz_C);

musparseXcsrgemm_symbolic(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
descr_C,
nnz_C,
csr_row_ptr_C,
csr_col_ind_C,
info_C,
buffer);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muInt csr_row_ptr_B const muInt csr_col_ind_B
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C
  • muInt nnz_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrgemm_numeric

MUSPARSE_EXPORT musparseStatus_t musparseScsrgemm_numeric(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const float `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const float `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const float `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const float `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muInt nnz_C, float `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Sparse matrix sparse matrix numeric multiplication using CSR storage format.

musparseXcsrgemm_numeric multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"90"\},"children":[\{"type":"text","text":"$m \\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in CSR storage format, and the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, defined in CSR storage format, and adds the result to the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}. The final result is stored in the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"25"\},"children":[\{"type":"text","text":"$m\n\\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, predefined in CSR storage format, such that formula \{"type":"element","name":"formula","attributes":\{"id":"101"\},"children":[\{"type":"text","text":"\\[\n C := \\alpha \\cdot op(A) \\cdot op(B) + \\beta \\cdot D,\n \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"81"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

The symbolic part of the csr matrix C can be obtained by musparseXcsrgemm_symbolic(). It is assumed that csr_row_ptr_C and csr_col_ind_C have already been filled and that csr_val_C is allocated by the user. csr_row_ptr_C and allocation size of csr_col_ind_C and csr_val_C is defined by the number of non-zero elements of the sparse CSR matrix C. Both can be obtained by musparseXcsrgemm_nnz(). The required buffer size for the computation can be obtained by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() and musparseZcsrgemm_bufferSize(), respectively.

注意:If formula \{"type":"element","name":"formula","attributes":\{"id":"94"\},"children":[\{"type":"text","text":"$\\alpha == 0$"\}]\}, then formula \{"type":"element","name":"formula","attributes":\{"id":"95"\},"children":[\{"type":"text","text":"$C = \\beta \\cdot D$"\}]\} will be computed.

注意:If formula \{"type":"element","name":"formula","attributes":\{"id":"96"\},"children":[\{"type":"text","text":"$\\beta == 0$"\}]\}, then formula \{"type":"element","name":"formula","attributes":\{"id":"97"\},"children":[\{"type":"text","text":"$C = \\alpha \\cdot op(A) \\cdot op(B)$"\}]\} will be computed.

注意:formula \{"type":"element","name":"formula","attributes":\{"id":"98"\},"children":[\{"type":"text","text":"$\\alpha == beta == 0$"\}]\} is invalid.

注意:Currently, only trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

注意:Please note, that for matrix products with more than 4096 non-zero entries per row, additional temporary storage buffer is allocated by the algorithm.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • m: number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • k: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • descr_A: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_A: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_val_A: array of nnz_A elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr_A: array of m+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}, k+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\}.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • descr_B: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_B: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_val_B: array of nnz_B elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr_B: array of k+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}, m+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • csr_col_ind_B: array of nnz_B elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • descr_D: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_D: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_val_D: array of nnz_D elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_row_ptr_D: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_col_ind_D: array of nnz_D elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • descr_C: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_C: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_val_C: array of nnz_C elements of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • csr_col_ind_C: array of nnz_C elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • info_C: structure that holds meta data for the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() or musparseZcsrgemm_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, k, nnz_A, nnz_B or nnz_D is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha and beta are invalid, descr_A, csr_val_A, csr_row_ptr_A, csr_col_ind_A, descr_B, csr_val_B, csr_row_ptr_B or csr_col_ind_B are invalid if alpha is valid, descr_D, csr_val_D, csr_row_ptr_D or csr_col_ind_D is invalid if beta is valid, csr_val_C, csr_row_ptr_C, csr_col_ind_C, info_C or temp_buffer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR additional buffer for long rows could not be allocated. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans_A != MUSPARSE_OPERATION_NON_TRANSPOSE, trans_B != MUSPARSE_OPERATION_NON_TRANSPOSE, or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example multiplies two CSR matrices with a scalar alpha and adds the result to another CSR matrix.

// Initialize scalar multipliers
float alpha = 2.0f;
float beta = 1.0f;

// Create matrix descriptors
musparseMatDescr_t descr_A;
musparseMatDescr_t descr_B;
musparseMatDescr_t descr_C;
musparseMatDescr_t descr_D;

musparseCreateMatDescr(&descr_A);
musparseCreateMatDescr(&descr_B);
musparseCreateMatDescr(&descr_C);
musparseCreateMatDescr(&descr_D);

// Create matrix info structure
musparseMatInfo_t info_C;
musparseCreateMatInfo(&info_C);

// Set pointer mode
musparseSetPointerMode(handle, MUSPARSE_POINTER_MODE_HOST);

// Query musparse for the required buffer size
size_t buffer_size;

musparseScsrgemm_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
&alpha,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
&beta,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
info_C,
&buffer_size);

// Allocate buffer
void* buffer;
musaMalloc(&buffer, buffer_size);

// Obtain number of total non-zero entries in C and row pointers of C
muInt nnz_C;
musaMalloc((void``)&csr_row_ptr_C, sizeof(muInt) * (m + 1));

musparseXcsrgemm_nnz(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
descr_C,
csr_row_ptr_C,
&nnz_C,
info_C,
buffer);

// Compute column indices and values of C
musaMalloc((void``)&csr_col_ind_C, sizeof(muInt) * nnz_C);
musparseXcsrgemm_symbolic(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
descr_A,
nnz_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_row_ptr_B,
csr_col_ind_B,
descr_D,
nnz_D,
csr_row_ptr_D,
csr_col_ind_D,
descr_C,
nnz_C,
csr_row_ptr_C,
csr_col_ind_C,
info_C,
buffer);
musaMalloc((void``)&csr_val_C, sizeof(float) * nnz_C);

musparseScsrgemm_numeric(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
n,
k,
&alpha,
descr_A,
nnz_A,
csr_val_A,
csr_row_ptr_A,
csr_col_ind_A,
descr_B,
nnz_B,
csr_val_B,
csr_row_ptr_B,
csr_col_ind_B,
&beta,
descr_D,
nnz_D,
csr_val_D,
csr_row_ptr_D,
csr_col_ind_D,
descr_C,
nnz_C,
csr_val_C,
csr_row_ptr_C,
csr_col_ind_C,
info_C,
buffer);

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const float alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const float csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const float beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const float csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C
  • muInt nnz_C float csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrgemm_numeric

MUSPARSE_EXPORT musparseStatus_t musparseDcsrgemm_numeric(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const double `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const double `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const double `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const double `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muInt nnz_C, double `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const double alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const double csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const double beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const double csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C
  • muInt nnz_C double csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrgemm_numeric

MUSPARSE_EXPORT musparseStatus_t musparseCcsrgemm_numeric(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const muComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muComplex `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const muComplex `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muComplex `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muInt nnz_C, muComplex `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const muComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muComplex csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const muComplex beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muComplex csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C
  • muInt nnz_C muComplex csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrgemm_numeric

MUSPARSE_EXPORT musparseStatus_t musparseZcsrgemm_numeric(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const muDoubleComplex `alpha, const musparseMatDescr_t descr_A, muInt nnz_A, const muDoubleComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muDoubleComplex `csr_val_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const muDoubleComplex `beta, const musparseMatDescr_t descr_D, muInt nnz_D, const muDoubleComplex `csr_val_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muInt nnz_C, muDoubleComplex `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, const musparseMatInfo_t info_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k const muDoubleComplex alpha
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muDoubleComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muDoubleComplex csr_val_B const muInt csr_row_ptr_B const muInt csr_col_ind_B const muDoubleComplex beta
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muDoubleComplex csr_val_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C
  • muInt nnz_C muDoubleComplex csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSbsric0_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)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format.

musparseXbsric0_bufferSize returns the size of the temporary storage buffer that is required by musparseSbsric0_analysis(), musparseDbsric0_analysis(), musparseCbsric0_analysis(), musparseZbsric0_analysis(), musparseSbsric0(), musparseDbsric0(), musparseSbsric0() and musparseDbsric0(). 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(), musparseSbsrilu0_bufferSize(), musparseDbsrilu0_bufferSize(), musparseCbsrilu0_bufferSize() and musparseZbsrilu0_bufferSize() if the matrix sparsity pattern is identical. The user allocated buffer can thus be shared between subsequent calls to those functions.

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_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements 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 musparseSbsric0_analysis(), musparseDbsric0_analysis(), musparseCbsric0_analysis(), musparseZbsric0_analysis(), musparseSbsric0(), musparseDbsric0(), musparseCbsric0() and musparseZbsric0().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb, or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr, bsr_col_ind, info or buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDbsric0_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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCbsric0_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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZbsric0_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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseSbsric0_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)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format.

musparseXbsric0_analysis performs the analysis step for musparseSbsric0() musparseDbsric0(), musparseCbsric0(), and musparseZbsric0(). 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 musparseXbsric0_clear().

musparseXbsric0_analysis can share its meta data with musparseSbsrilu0_analysis(), musparseDbsrilu0_analysis(), musparseCbsrilu0_analysis(), musparseZbsrilu0_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.

注意: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.

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_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb, or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr, bsr_col_ind, info or temp_buffer pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDbsric0_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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCbsric0_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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZbsric0_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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsric0

MUSPARSE_EXPORT musparseStatus_t musparseSbsric0(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)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format.

musparseXbsric0 computes the incomplete Cholesky factorization with 0 fill-ins and no pivoting of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"102"\},"children":[\{"type":"text","text":"$mb \\times mb$"\}]\} BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"103"\},"children":[\{"type":"text","text":"\\[ A \\approx LL^T \\]"\}]\}

musparseXbsric0 requires a user allocated temporary buffer. Its size is returned by musparseSbsric0_bufferSize(), musparseDbsric0_bufferSize(), musparseCbsric0_bufferSize() or musparseZbsric0_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseSbsric0_analysis(), musparseDbsric0_analysis(), musparseCbsric0_analysis() or musparseZbsric0_analysis(). musparseXbsric0 reports the first zero pivot (either numerical or structural zero). The zero pivot status can be obtained by calling musparseXbsric0_zeroPivot().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

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_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb, or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr or bsr_col_ind pointer 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.

Example:

Consider the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, stored in BSR storage format. The following example computes the incomplete Cholesky factorization formula \{"type":"element","name":"formula","attributes":\{"id":"104"\},"children":[\{"type":"text","text":"$M \\approx LL^T$"\}]\} and solves the preconditioned system formula \{"type":"element","name":"formula","attributes":\{"id":"105"\},"children":[\{"type":"text","text":"$My\n = x$"\}]\}.

// 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 L'
musparseMatDescr_t descr_Lt;
musparseCreateMatDescr(&descr_Lt);
musparseSetMatFillMode(descr_Lt, MUSPARSE_FILL_MODE_UPPER);
musparseSetMatDiagType(descr_Lt, 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_Lt;
musparseDbsric0_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_Lt,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
info,
&buffer_size_Lt);

size_t buffer_size = max(buffer_size_M, max(buffer_size_L,
buffer_size_Lt));

// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);

// Perform analysis steps, using MUSPARSE_ANALYSIS_POLICY_REUSE to
improve
// computation performance
musparseDbsric0_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_Lt,
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 == musparseXbsric0_zeroPivot(handle,
info,
&position))
\{
printf("A has structural zero at A(%d,%d)\n", position, position);
\}

// Compute incomplete Cholesky factorization M = LL'
musparseDbsric0(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 == musparseXbsric0_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 L'y = z
musparseDbsrsv_solve(handle,
MUSPARSE_DIRECTION_ROW,
MUSPARSE_OPERATION_TRANSPOSE,
mb,
nnzb,
&alpha,
descr_Lt,
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_Lt);
musparseDestroy(handle);

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsric0

MUSPARSE_EXPORT musparseStatus_t musparseDbsric0(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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsric0

MUSPARSE_EXPORT musparseStatus_t musparseCbsric0(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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsric0

MUSPARSE_EXPORT musparseStatus_t musparseZbsric0(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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseSbsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const float `boost_tol, const float `boost_val)

Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"107"\},"children":[\{"type":"text","text":"$A_\{j,j\} =\n\\text\{boost_val\}$"\}]\} if formula \{"type":"element","name":"formula","attributes":\{"id":"108"\},"children":[\{"type":"text","text":"$\\text\{tol\} \\ge \\left|A_\{j,j\}\\right|$"\}]\}.

注意:The boost value is enabled by setting enable_boost to 1 or disabled by setting enable_boost to 0.

注意:tol and boost_val can be in host or device memory.

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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info, tol or boost_val pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const float boost_tol const float boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDbsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const double `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const double boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseCbsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const float `boost_tol, const muComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const float boost_tol const muComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseZbsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const muDoubleComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const muDoubleComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDSbsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDSbsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const float `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const float boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDCbsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDCbsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const muComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const muComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu0_bufferSize

MUSPARSE_EXPORT 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)

Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.

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.

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_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements 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().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb, or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr, bsr_col_ind, info or buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu0_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu0_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu0_bufferSize

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu0_analysis

MUSPARSE_EXPORT 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)

Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.

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.

注意: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.

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_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb, or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr, bsr_col_ind, info or temp_buffer pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu0_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu0_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu0_analysis

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsrilu0

MUSPARSE_EXPORT 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)

Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.

musparseXbsrilu0 computes the incomplete LU factorization with 0 fill-ins and no pivoting of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"102"\},"children":[\{"type":"text","text":"$mb \\times mb$"\}]\} BSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"109"\},"children":[\{"type":"text","text":"\\[ A \\approx LU \\]"\}]\}

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().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

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_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nnzb, or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, bsr_val, bsr_row_ptr or bsr_col_ind pointer 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.

Example:

Consider the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, stored in BSR storage format. The following example computes the incomplete LU factorization formula \{"type":"element","name":"formula","attributes":\{"id":"110"\},"children":[\{"type":"text","text":"$M \\approx LU$"\}]\} and solves the preconditioned system formula \{"type":"element","name":"formula","attributes":\{"id":"111"\},"children":[\{"type":"text","text":"$My =\n x$"\}]\}.

// 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);

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsrilu0

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsrilu0

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsrilu0

MUSPARSE_EXPORT 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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsric0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsric0_bufferSize returns the size of the temporary storage buffer that is required by musparseScsric0_analysis(), musparseDcsric0_analysis(), musparseScsric0() and musparseDcsric0(). The temporary storage buffer must be allocated by the user. The size of the temporary storage buffer is identical to the size returned by musparseScsrsv_bufferSize(), musparseDcsrsv_bufferSize(), musparseScsrilu0_bufferSize() and musparseDcsrilu0_bufferSize() if the matrix sparsity pattern is identical. The user allocated buffer can thus be shared between subsequent calls to those functions.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • info: structure that holds the information collected during the analysis step.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseScsric0_analysis(), musparseDcsric0_analysis(), musparseScsric0() and musparseDcsric0().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr, csr_col_ind, info or buffer_size pointer is invalid.

Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsric0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsric0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsric0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsric0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseScsric0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsric0_analysis performs the analysis step for musparseScsric0() and musparseDcsric0(). 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 musparseXcsric0_clear().

musparseXcsric0_analysis can share its meta data with musparseScsrilu0_analysis(), musparseDcsrilu0_analysis(), musparseCcsrilu0_analysis(), musparseZcsrilu0_analysis(), musparseScsrsv_analysis(), musparseDcsrsv_analysis(), musparseCcsrsv_analysis(), musparseZcsrsv_analysis(), musparseScsrsm_analysis(), musparseDcsrsm_analysis(), musparseScsrsm_analysis() and musparseDcsrsm_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.

注意: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.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr, csr_col_ind, info or temp_buffer pointer is invalid.

Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDcsric0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCcsric0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsric0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZcsric0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsric0

MUSPARSE_EXPORT musparseStatus_t musparseScsric0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsric0 computes the incomplete Cholesky factorization with 0 fill-ins and no pivoting of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"103"\},"children":[\{"type":"text","text":"\\[ A \\approx LL^T \\]"\}]\}

musparseXcsric0 requires a user allocated temporary buffer. Its size is returned by musparseScsric0_bufferSize() or musparseDcsric0_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseScsric0_analysis() or musparseDcsric0_analysis(). musparseXcsric0 reports the first zero pivot (either numerical or structural zero). The zero pivot status can be obtained by calling musparseXcsric0_zeroPivot().

注意:The sparse CSR matrix has to be sorted. This can be achieved by calling musparseXcsrsort().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr or csr_col_ind pointer is invalid. * Return values:

  • 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 trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

Consider the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, stored in CSR storage format. The following example computes the incomplete Cholesky factorization formula \{"type":"element","name":"formula","attributes":\{"id":"104"\},"children":[\{"type":"text","text":"$M \\approx LL^T$"\}]\} and solves the preconditioned system formula \{"type":"element","name":"formula","attributes":\{"id":"105"\},"children":[\{"type":"text","text":"$My\n = x$"\}]\}.

// 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 L'
musparseMatDescr_t descr_Lt;
musparseCreateMatDescr(&descr_Lt);
musparseSetMatFillMode(descr_Lt, MUSPARSE_FILL_MODE_UPPER);
musparseSetMatDiagType(descr_Lt, 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_Lt;
musparseDcsric0_bufferSize(handle,
m,
nnz,
descr_M,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
&buffer_size_M);
musparseDcsrsv_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr_L,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
&buffer_size_L);
musparseDcsrsv_bufferSize(handle,
MUSPARSE_OPERATION_TRANSPOSE,
m,
nnz,
descr_Lt,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
&buffer_size_Lt);

size_t buffer_size = max(buffer_size_M, max(buffer_size_L,
buffer_size_Lt));

// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);

// Perform analysis steps, using MUSPARSE_ANALYSIS_POLICY_REUSE to
improve
// computation performance
musparseDcsric0_analysis(handle,
m,
nnz,
descr_M,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
musparseDcsrsv_analysis(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr_L,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
musparseDcsrsv_analysis(handle,
MUSPARSE_OPERATION_TRANSPOSE,
m,
nnz,
descr_Lt,
csr_val,
csr_row_ptr,
csr_col_ind,
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 == musparseXcsric0_zeroPivot(handle,
info,
&position))
\{
printf("A has structural zero at A(%d,%d)\n", position, position);
\}

// Compute incomplete Cholesky factorization M = LL'
musparseDcsric0(handle,
m,
nnz,
descr_M,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);

// Check for zero pivot
if(MUSPARSE_EXPORT
MUSPARSE_STATUS_ZERO_PIVOT == musparseXcsric0_zeroPivot(handle,
info,
&position))
\{
printf("L has structural and/or numerical zero at L(%d,%d)\n",
position,
position);
\}

// Solve Lz = x
musparseDcsrsv_solve(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
&alpha,
descr_L,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
x,
z,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);

// Solve L'y = z
musparseDcsrsv_solve(handle,
MUSPARSE_OPERATION_TRANSPOSE,
m,
nnz,
&alpha,
descr_Lt,
csr_val,
csr_row_ptr,
csr_col_ind,
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_Lt);
musparseDestroy(handle);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsric0

MUSPARSE_EXPORT musparseStatus_t musparseDcsric0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsric0

MUSPARSE_EXPORT musparseStatus_t musparseCcsric0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsric0

MUSPARSE_EXPORT musparseStatus_t musparseZcsric0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const float `boost_tol, const float `boost_val)

Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsrilu0_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 formula \{"type":"element","name":"formula","attributes":\{"id":"107"\},"children":[\{"type":"text","text":"$A_\{j,j\} =\n\\text\{boost_val\}$"\}]\} if formula \{"type":"element","name":"formula","attributes":\{"id":"108"\},"children":[\{"type":"text","text":"$\\text\{tol\} \\ge \\left|A_\{j,j\}\\right|$"\}]\}.

注意:The boost value is enabled by setting enable_boost to 1 or disabled by setting enable_boost to 0.

注意:tol and boost_val can be in host or device memory.

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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info, tol or boost_val pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const float boost_tol const float boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const double `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const double boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const float `boost_tol, const muComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const float boost_tol const muComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const muDoubleComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const muDoubleComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDScsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDScsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const float `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const float boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDCcsrilu0_numericBoost

MUSPARSE_EXPORT musparseStatus_t musparseDCcsrilu0_numericBoost(musparseHandle_t handle, musparseMatInfo_t info, muInt enable_boost, const double `boost_tol, const muComplex `boost_val)

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info
  • muInt enable_boost const double boost_tol const muComplex boost_val

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsrilu0_bufferSize returns the size of the temporary storage buffer that is required by musparseScsrilu0_analysis(), musparseDcsrilu0_analysis(), musparseCcsrilu0_analysis(), musparseZcsrilu0_analysis(), musparseScsrilu0(), musparseDcsrilu0(), musparseCcsrilu0() and musparseZcsrilu0(). The temporary storage buffer must be allocated by the user. The size of the temporary storage buffer is identical to the size returned by musparseScsrsv_bufferSize(), musparseDcsrsv_bufferSize(), musparseCcsrsv_bufferSize() and musparseZcsrsv_bufferSize() if the matrix sparsity pattern is identical. The user allocated buffer can thus be shared between subsequent calls to those functions.

Parameters:

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr, csr_col_ind, info or buffer_size pointer is invalid.

Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu0_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu0_bufferSize(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsrilu0_analysis performs the analysis step for musparseScsrilu0(), musparseDcsrilu0(), musparseCcsrilu0() and musparseZcsrilu0(). 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 musparseXcsrilu0_clear().

musparseXcsrilu0_analysis can share its meta data with musparseScsric0_analysis(), musparseDcsric0_analysis(), musparseCcsric0_analysis(), musparseZcsric0_analysis(), musparseScsrsv_analysis(), musparseDcsrsv_analysis(), musparseCcsrsv_analysis(), musparseZcsrsv_analysis(), musparseScsrsm_analysis(), musparseDcsrsm_analysis(), musparseScsrsm_analysis() and musparseDcsrsm_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.

注意: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.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr, csr_col_ind, info or temp_buffer pointer is invalid.

Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu0_analysis

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu0_analysis(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseAnalysisPolicy_t analysis, musparseSolvePolicy_t solve, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseAnalysisPolicy_t analysis
  • musparseSolvePolicy_t solve void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrilu0

MUSPARSE_EXPORT musparseStatus_t musparseScsrilu0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsrilu0 computes the incomplete LU factorization with 0 fill-ins and no pivoting of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"109"\},"children":[\{"type":"text","text":"\\[ A \\approx LU \\]"\}]\}

musparseXcsrilu0 requires a user allocated temporary buffer. Its size is returned by musparseScsrilu0_bufferSize(), musparseDcsrilu0_bufferSize(), musparseCcsrilu0_bufferSize() or musparseZcsrilu0_bufferSize(). Furthermore, analysis meta data is required. It can be obtained by musparseScsrilu0_analysis(), musparseDcsrilu0_analysis(), musparseCcsrilu0_analysis() or musparseZcsrilu0_analysis(). musparseXcsrilu0 reports the first zero pivot (either numerical or structural zero). The zero pivot status can be obtained by calling musparseXcsrilu0_zeroPivot().

注意:The sparse CSR matrix has to be sorted. This can be achieved by calling musparseXcsrsort().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • 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.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_val, csr_row_ptr or csr_col_ind pointer is invalid. * Return values:

  • 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 trans != MUSPARSE_OPERATION_NON_TRANSPOSE or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

Consider the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, stored in CSR storage format. The following example computes the incomplete LU factorization formula \{"type":"element","name":"formula","attributes":\{"id":"110"\},"children":[\{"type":"text","text":"$M \\approx LU$"\}]\} and solves the preconditioned system formula \{"type":"element","name":"formula","attributes":\{"id":"111"\},"children":[\{"type":"text","text":"$My =\n x$"\}]\}.

// 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;
musparseDcsrilu0_bufferSize(handle,
m,
nnz,
descr_M,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
&buffer_size_M);
musparseDcsrsv_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr_L,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
&buffer_size_L);
musparseDcsrsv_bufferSize(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr_U,
csr_val,
csr_row_ptr,
csr_col_ind,
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
musparseDcsrilu0_analysis(handle,
m,
nnz,
descr_M,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
musparseDcsrsv_analysis(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr_L,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
MUSPARSE_ANALYSIS_POLICY_REUSE,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);
musparseDcsrsv_analysis(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
descr_U,
csr_val,
csr_row_ptr,
csr_col_ind,
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 == musparseXcsrilu0_zeroPivot(handle,
info,
&position))
\{
printf("A has structural zero at A(%d,%d)\n", position, position);
\}

// Compute incomplete LU factorization
musparseDcsrilu0(handle,
m,
nnz,
descr_M,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);

// Check for zero pivot
if(MUSPARSE_EXPORT
MUSPARSE_STATUS_ZERO_PIVOT == musparseXcsrilu0_zeroPivot(handle,
info,
&position))
\{
printf("U has structural and/or numerical zero at U(%d,%d)\n",
position,
position);
\}

// Solve Lz = x
musparseDcsrsv_solve(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
&alpha,
descr_L,
csr_val,
csr_row_ptr,
csr_col_ind,
info,
x,
z,
MUSPARSE_SOLVE_POLICY_USE_LEVEL,
temp_buffer);

// Solve Uy = z
musparseDcsrsv_solve(handle,
MUSPARSE_OPERATION_NON_TRANSPOSE,
m,
nnz,
&alpha,
descr_U,
csr_val,
csr_row_ptr,
csr_col_ind,
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);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrilu0

MUSPARSE_EXPORT musparseStatus_t musparseDcsrilu0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrilu0

MUSPARSE_EXPORT musparseStatus_t musparseCcsrilu0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrilu0

MUSPARSE_EXPORT musparseStatus_t musparseZcsrilu0(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, musparseSolvePolicy_t policy, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info
  • musparseSolvePolicy_t policy void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv_bufferSize(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, const float `B, muInt ldb, size_t *buffer_size)

Tridiagonal solver with pivoting.

musparseXgtsv_bufferSize returns the size of the temporary storage buffer that is required by musparseSgtsv(), musparseDgtsv(), musparseCgtsv() and musparseZgtsv(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: size of the tri-diagonal linear system (must be >= 2).
  • n: number of columns in the dense matrix B.
  • dl: lower diagonal of tri-diagonal system. First entry must be zero.
  • d: main diagonal of tri-diagonal system.
  • du: upper diagonal of tri-diagonal system. Last entry must be zero.
  • B: Dense matrix of size ( ldb, n ).
  • ldb: Leading dimension of B. Must satisfy ldb >= max(1, m).
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSgtsv(), musparseDgtsv(), musparseCgtsv() and musparseZgtsv().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or ldb is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p dl, d, du, B or buffer_size pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du const float B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv_bufferSize(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, const double `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du const double B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv_bufferSize(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du const muComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv_bufferSize(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, float `B, muInt ldb, void *temp_buffer)

Tridiagonal solver with pivoting.

musparseXgtsv solves a tridiagonal system for multiple right hand sides using pivoting.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: size of the tri-diagonal linear system (must be >= 2).
  • n: number of columns in the dense matrix B.
  • dl: lower diagonal of tri-diagonal system. First entry must be zero.
  • d: main diagonal of tri-diagonal system.
  • du: upper diagonal of tri-diagonal system. Last entry must be zero.
  • B: Dense matrix of size ( ldb, n ).
  • ldb: Leading dimension of B. Must satisfy ldb >= max(1, m).
  • temp_buffer: temporary storage buffer allocated by the user.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or ldb is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p dl, d, du, B or temp_buffer pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du float B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, double `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du double B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, muComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du muComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, muDoubleComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du muDoubleComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv_nopivot_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv_nopivot_bufferSize(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, const float `B, muInt ldb, size_t *buffer_size)

Tridiagonal solver (no pivoting)

musparseXgtsv_nopivot_bufferSize returns the size of the temporary storage buffer that is required by musparseSgtsv_nopivot(), musparseDgtsv_nopivot(), musparseCgtsv_nopivot() and musparseZgtsv_nopivot(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: size of the tri-diagonal linear system (must be >= 2).
  • n: number of columns in the dense matrix B.
  • dl: lower diagonal of tri-diagonal system. First entry must be zero.
  • d: main diagonal of tri-diagonal system.
  • du: upper diagonal of tri-diagonal system. Last entry must be zero.
  • B: Dense matrix of size ( ldb, n ).
  • ldb: Leading dimension of B. Must satisfy ldb >= max(1, m).
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSgtsv_nopivot(), musparseDgtsv_nopivot(), musparseCgtsv_nopivot() and musparseZgtsv_nopivot().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or ldb is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p dl, d, du, B or buffer_size pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du const float B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv_nopivot_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv_nopivot_bufferSize(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, const double `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du const double B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv_nopivot_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv_nopivot_bufferSize(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du const muComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv_nopivot_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv_nopivot_bufferSize(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `B, muInt ldb, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex B
  • muInt ldb size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsv_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseSgtsv_nopivot(musparseHandle_t handle, muInt m, muInt n, const float `dl, const float `d, const float `du, float `B, muInt ldb, void *temp_buffer)

Tridiagonal solver (no pivoting)

musparseXgtsv_nopivot solves a tridiagonal linear system for multiple right-hand sides

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: size of the tri-diagonal linear system (must be >= 2).
  • n: number of columns in the dense matrix B.
  • dl: lower diagonal of tri-diagonal system. First entry must be zero.
  • d: main diagonal of tri-diagonal system.
  • du: upper diagonal of tri-diagonal system. Last entry must be zero.
  • B: Dense matrix of size ( ldb, n ).
  • ldb: Leading dimension of B. Must satisfy ldb >= max(1, m).
  • temp_buffer: temporary storage buffer allocated by the user.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or ldb is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p dl, d, du, B or temp_buffer pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float dl const float d const float du float B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsv_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseDgtsv_nopivot(musparseHandle_t handle, muInt m, muInt n, const double `dl, const double `d, const double `du, double `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double dl const double d const double du double B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsv_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseCgtsv_nopivot(musparseHandle_t handle, muInt m, muInt n, const muComplex `dl, const muComplex `d, const muComplex `du, muComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muComplex dl const muComplex d const muComplex du muComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsv_nopivot

MUSPARSE_EXPORT musparseStatus_t musparseZgtsv_nopivot(musparseHandle_t handle, muInt m, muInt n, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, muDoubleComplex `B, muInt ldb, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du muDoubleComplex B
  • muInt ldb void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsvStridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseSgtsvStridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const float `dl, const float `d, const float `du, const float `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Strided Batch tridiagonal solver (no pivoting)

musparseXgtsv_noPivot_stridedBatch_bufferSize returns the size of the temporary storage buffer that is required by musparseSgtsvStridedBatch(), musparseDgtsvStridedBatch(), musparseCgtsvStridedBatch() and musparseZgtsvStridedBatch(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: size of the tri-diagonal linear system.
  • dl: lower diagonal of tri-diagonal system where the ith system lower diagonal starts at dl+batch_stride*i.
  • d: main diagonal of tri-diagonal system where the ith system diagonal starts at d+batch_stride*i.
  • du: upper diagonal of tri-diagonal system where the ith system upper diagonal starts at du+batch_stride*i.
  • x: Dense array of righthand-sides where the ith righthand-side starts at x+batch_stride*i.
  • batch_count: The number of systems to solve.
  • batch_stride: The number of elements that separate each system. Must satisfy batch_stride >= m.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSgtsvStridedBatch(), musparseDgtsvStridedBatch(), musparseCgtsvStridedBatch() and musparseZgtsvStridedBatch().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, batch_count or batch_stride is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: dl, d, du, x or buffer_size pointer is invalid. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m const float dl const float d const float du const float x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsvStridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseDgtsvStridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const double `dl, const double `d, const double `du, const double `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m const double dl const double d const double du const double x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsvStridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseCgtsvStridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m const muComplex dl const muComplex d const muComplex du const muComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsvStridedBatch_bufferSizeExt

MUSPARSE_EXPORT musparseStatus_t musparseZgtsvStridedBatch_bufferSizeExt(musparseHandle_t handle, muInt m, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsvStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseSgtsvStridedBatch(musparseHandle_t handle, muInt m, const float `dl, const float `d, const float `du, float `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Strided Batch tridiagonal solver (no pivoting)

musparseXgtsv_noPivot_stridedBatch solves a batched tridiagonal linear system

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: size of the tri-diagonal linear system (must be >= 2).
  • dl: lower diagonal of tri-diagonal system. First entry must be zero.
  • d: main diagonal of tri-diagonal system.
  • du: upper diagonal of tri-diagonal system. Last entry must be zero.
  • x: Dense array of righthand-sides where the ith righthand-side starts at x+batch_stride*i.
  • batch_count: The number of systems to solve.
  • batch_stride: The number of elements that separate each system. Must satisfy batch_stride >= m.
  • temp_buffer: temporary storage buffer allocated by the user.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, batch_count or batch_stride is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: dl, d, du, x or temp_buffer pointer is invalid. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m const float dl const float d const float du float x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsvStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseDgtsvStridedBatch(musparseHandle_t handle, muInt m, const double `dl, const double `d, const double `du, double `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m const double dl const double d const double du double x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsvStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseCgtsvStridedBatch(musparseHandle_t handle, muInt m, const muComplex `dl, const muComplex `d, const muComplex `du, muComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m const muComplex dl const muComplex d const muComplex du muComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsvStridedBatch

MUSPARSE_EXPORT musparseStatus_t musparseZgtsvStridedBatch(musparseHandle_t handle, muInt m, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, muDoubleComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSgtsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, const float `dl, const float `d, const float `du, const float `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Interleaved Batch tridiagonal solver.

musparseXgtsvInterleavedBatch_bufferSize returns the size of the temporary storage buffer that is required by musparseSgtsvInterleavedBatch(), musparseDgtsvInterleavedBatch(), musparseCgtsvInterleavedBatch() and musparseZgtsvInterleavedBatch(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • alg: Algorithm to use when solving tridiagonal systems. Options are thomas ( musparse_gtsv_interleaved_thomas ), LU ( musparse_gtsv_interleaved_lu ), or QR ( musparse_gtsv_interleaved_qr ). Passing musparse_gtsv_interleaved_default defaults the algorithm to use QR. Thomas algorithm is the fastest but is not stable while LU and QR are slower but are stable.
  • m: size of the tri-diagonal linear system.
  • dl: lower diagonal of tri-diagonal system. The first element of the lower diagonal must be zero.
  • d: main diagonal of tri-diagonal system.
  • du: upper diagonal of tri-diagonal system. The last element of the upper diagonal must be zero.
  • x: Dense array of righthand-sides with dimension batch_stride by m.
  • batch_count: The number of systems to solve.
  • batch_stride: The number of elements that separate consecutive elements in a system. Must satisfy batch_stride >= batch_count.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSgtsvInterleavedBatch(), musparseDgtsvInterleavedBatch(), musparseCgtsvInterleavedBatch() and musparseZgtsvInterleavedBatch().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, batch_count, batch_stride is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: dl, d, du, x or buffer_size pointer is invalid. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m const float dl const float d const float du const float x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDgtsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, const double `dl, const double `d, const double `du, const double `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m const double dl const double d const double du const double x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCgtsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m const muComplex dl const muComplex d const muComplex du const muComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZgtsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgtsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSgtsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, float `dl, float `d, float `du, float `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Interleaved Batch tridiagonal solver.

musparseXgtsvInterleavedBatch solves a batched tridiagonal linear system. The routine requires a temporary storage buffer that must be allocated by the user. The size of this buffer can be determined by first calling musparseXgtsvInterleavedBatch_bufferSize. The user can specify different algorithms for musparseXgtsvInterleavedBatch to use. Options are thomas ( musparse_gtsv_interleaved_thomas ), LU ( musparse_gtsv_interleaved_lu ), or QR ( musparse_gtsv_interleaved_qr ). Passing musparse_gtsv_interleaved_default defaults the algorithm to use QR.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • alg: Algorithm to use when solving tridiagonal systems. Options are thomas ( musparse_gtsv_interleaved_thomas ), LU ( musparse_gtsv_interleaved_lu ), or QR ( musparse_gtsv_interleaved_qr ). Passing musparse_gtsv_interleaved_default defaults the algorithm to use QR. Thomas algorithm is the fastest but is not stable while LU and QR are slower but are stable.
  • m: size of the tri-diagonal linear system.
  • dl: lower diagonal of tri-diagonal system. The first element of the lower diagonal must be zero.
  • d: main diagonal of tri-diagonal system.
  • du: upper diagonal of tri-diagonal system. The last element of the upper diagonal must be zero.
  • x: Dense array of righthand-sides with dimension batch_stride by m.
  • batch_count: The number of systems to solve.
  • batch_stride: The number of elements that separate consecutive elements in a system. Must satisfy batch_stride >= batch_count.
  • temp_buffer: temporary storage buffer allocated by the user.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or batch_count or batch_stride is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: dl, d, du, x or temp_buffer pointer is invalid. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m float dl float d float du float x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgtsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseDgtsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, double `dl, double `d, double `du, double `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m double dl double d double du double x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgtsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseCgtsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, muComplex `dl, muComplex `d, muComplex `du, muComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m muComplex dl muComplex d muComplex du muComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgtsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseZgtsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGtsvInterleavedAlg_t alg, muInt m, muDoubleComplex `dl, muDoubleComplex `d, muDoubleComplex `du, muDoubleComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGtsvInterleavedAlg_t alg
  • muInt m muDoubleComplex dl muDoubleComplex d muDoubleComplex du muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgpsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSgpsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, const float `ds, const float `dl, const float `d, const float `du, const float `dw, const float `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Batched Pentadiagonal solver.

musparseXgpsvInterleavedBatch_bufferSize calculates the required buffer size for musparseXgpsvInterleavedBatch(). It is the users responsibility to allocate this buffer.

Parameters:

  • handle: handle to the musparse library context queue.
  • alg: algorithm to solve the linear system.
  • m: size of the pentadiagonal linear system.
  • ds: lower diagonal (distance 2) of pentadiagonal system. First two entries must be zero.
  • dl: lower diagonal of pentadiagonal system. First entry must be zero.
  • d: main diagonal of pentadiagonal system.
  • du: upper diagonal of pentadiagonal system. Last entry must be zero.
  • dw: upper diagonal (distance 2) of pentadiagonal system. Last two entries must be zero.
  • x: Dense array of right-hand-sides with dimension batch_stride by m.
  • batch_count: The number of systems to solve.
  • batch_stride: The number of elements that separate consecutive elements in a system. Must satisfy batch_stride >= batch_count.
  • buffer_size: Number of bytes of the temporary storage buffer required.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, alg, batch_count or batch_stride is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p ds, dl, d, du, dw, x or temp_buffer pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m const float ds const float dl const float d const float du const float dw const float x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgpsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDgpsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, const double `ds, const double `dl, const double `d, const double `du, const double `dw, const double `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m const double ds const double dl const double d const double du const double dw const double x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgpsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseCgpsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, const muComplex `ds, const muComplex `dl, const muComplex `d, const muComplex `du, const muComplex `dw, const muComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m const muComplex ds const muComplex dl const muComplex d const muComplex du const muComplex dw const muComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgpsvInterleavedBatch_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseZgpsvInterleavedBatch_bufferSize(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, const muDoubleComplex `ds, const muDoubleComplex `dl, const muDoubleComplex `d, const muDoubleComplex `du, const muDoubleComplex `dw, const muDoubleComplex `x, muInt batch_count, muInt batch_stride, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m const muDoubleComplex ds const muDoubleComplex dl const muDoubleComplex d const muDoubleComplex du const muDoubleComplex dw const muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgpsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSgpsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, float `ds, float `dl, float `d, float `du, float `dw, float `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Batched Pentadiagonal solver.

musparseXgpsvInterleavedBatch solves a batch of pentadiagonal linear systems. The coefficient matrix of each pentadiagonal linear system is defined by five vectors for the lower part (ds, dl), main diagonal (d) and upper part (du, dw).

The function requires a temporary buffer. The size of the required buffer is returned by musparseXgpsvInterleavedBatch_bufferSize().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

注意:The routine is numerically stable because it uses QR to solve the linear systems.

注意:m need to be at least 3, to be a valid pentadiagonal matrix.

Parameters:

  • handle: handle to the musparse library context queue.
  • alg: algorithm to solve the linear system.
  • m: size of the pentadiagonal linear system.
  • ds: lower diagonal (distance 2) of pentadiagonal system. First two entries must be zero.
  • dl: lower diagonal of pentadiagonal system. First entry must be zero.
  • d: main diagonal of pentadiagonal system.
  • du: upper diagonal of pentadiagonal system. Last entry must be zero.
  • dw: upper diagonal (distance 2) of pentadiagonal system. Last two entries must be zero.
  • x: Dense array of right-hand-sides with dimension batch_stride by m.
  • batch_count: The number of systems to solve.
  • batch_stride: The number of elements that separate consecutive elements in a system. Must satisfy batch_stride >= batch_count.
  • temp_buffer: Temporary storage buffer allocated by the user.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, alg, batch_count or batch_stride is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p ds, dl, d, du, dw, x or temp_buffer pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m float ds float dl float d float du float dw float x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgpsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseDgpsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, double `ds, double `dl, double `d, double `du, double `dw, double `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m double ds double dl double d double du double dw double x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgpsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseCgpsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, muComplex `ds, muComplex `dl, muComplex `d, muComplex `du, muComplex `dw, muComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m muComplex ds muComplex dl muComplex d muComplex du muComplex dw muComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgpsvInterleavedBatch_legacy

MUSPARSE_EXPORT musparseStatus_t musparseZgpsvInterleavedBatch_legacy(musparseHandle_t handle, musparseGpsvInterleavedAlg_t alg, muInt m, muDoubleComplex `ds, muDoubleComplex `dl, muDoubleComplex `d, muDoubleComplex `du, muDoubleComplex `dw, muDoubleComplex `x, muInt batch_count, muInt batch_stride, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseGpsvInterleavedAlg_t alg
  • muInt m muDoubleComplex ds muDoubleComplex dl muDoubleComplex d muDoubleComplex du muDoubleComplex dw muDoubleComplex x
  • muInt batch_count
  • muInt batch_stride void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSnnz

MUSPARSE_EXPORT musparseStatus_t musparseSnnz(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t descr, const float `A, muInt ld, muInt `nnz_per_row_columns, muInt *nnz_total_dev_host_ptr)

This function computes the number of nonzero elements per row or column and the total number of nonzero elements in a dense matrix.

The routine does support asynchronous execution if the pointer mode is set to device. 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.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • descr: the descriptor of the dense matrix A.
  • A: array of dimensions (ld, n)
  • ld: leading dimension of dense array A.
  • nnz_per_row_columns: array of size m or n containing the number of nonzero elements per row or column, respectively.
  • nnz_total_dev_host_ptr: total number of nonzero elements in device or host memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or ld is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p A or nnz_per_row_columns or nnz_total_dev_host_ptr pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const float A
  • muInt ld muInt nnz_per_row_columns muInt nnz_total_dev_host_ptr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnnz

MUSPARSE_EXPORT musparseStatus_t musparseDnnz(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t descr, const double `A, muInt ld, muInt `nnz_per_row_columns, muInt *nnz_total_dev_host_ptr)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const double A
  • muInt ld muInt nnz_per_row_columns muInt nnz_total_dev_host_ptr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCnnz

MUSPARSE_EXPORT musparseStatus_t musparseCnnz(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t descr, const muComplex `A, muInt ld, muInt `nnz_per_row_columns, muInt *nnz_total_dev_host_ptr)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muComplex A
  • muInt ld muInt nnz_per_row_columns muInt nnz_total_dev_host_ptr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZnnz

MUSPARSE_EXPORT musparseStatus_t musparseZnnz(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t descr, const muDoubleComplex `A, muInt ld, muInt `nnz_per_row_columns, muInt *nnz_total_dev_host_ptr)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muDoubleComplex A
  • muInt ld muInt nnz_per_row_columns muInt nnz_total_dev_host_ptr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSdense2csr

MUSPARSE_EXPORT musparseStatus_t musparseSdense2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const float `A, muInt ld, const muInt `nnz_per_rows, float `csr_val, muInt `csr_row_ptr, muInt *csr_col_ind)

This function converts the matrix A in dense format into a sparse matrix in CSR format. All the parameters are assumed to have been pre-allocated by the user and the arrays are filled in based on nnz_per_row, which can be pre-computed with musparse_xnnz(). It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • A: array of dimensions (ld, n)
  • ld: leading dimension of dense array A.
  • nnz_per_rows: array of size n containing the number of non-zero elements per row.
  • csr_val: array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) nonzero elements of matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • csr_col_ind: integer array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) column indices of the non-zero elements of matrix A.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or ld is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p A or nnz_per_rows or csr_val csr_row_ptr or csr_col_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const float A
  • muInt ld const muInt nnz_per_rows float csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDdense2csr

MUSPARSE_EXPORT musparseStatus_t musparseDdense2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const double `A, muInt ld, const muInt `nnz_per_rows, double `csr_val, muInt `csr_row_ptr, muInt *csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const double A
  • muInt ld const muInt nnz_per_rows double csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCdense2csr

MUSPARSE_EXPORT musparseStatus_t musparseCdense2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muComplex `A, muInt ld, const muInt `nnz_per_rows, muComplex `csr_val, muInt `csr_row_ptr, muInt *csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muComplex A
  • muInt ld const muInt nnz_per_rows muComplex csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZdense2csr

MUSPARSE_EXPORT musparseStatus_t musparseZdense2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muDoubleComplex `A, muInt ld, const muInt `nnz_per_rows, muDoubleComplex `csr_val, muInt `csr_row_ptr, muInt *csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muDoubleComplex A
  • muInt ld const muInt nnz_per_rows muDoubleComplex csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csr_bufferSize(musparseHandle_t handle, muInt m, muInt n, const float `A, muInt lda, const float `threshold, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, size_t `buffer_size)

This function computes the the size of the user allocated temporary storage buffer used when converting and pruning a dense matrix to a CSR matrix.

musparseXpruneDense2csr_bufferSize returns the size of the temporary storage buffer that is required by musparseSpruneDense2csr_nnz(), musparseDpruneDense2csr_nnz(), musparseSpruneDense2csr(), and musparseDpruneDense2csr(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • A: array of dimensions (lda, n)
  • lda: leading dimension of dense array A.
  • threshold: pointer to the pruning non-negative threshold which can exist in either host or device memory.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • csr_val: array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) nonzero elements of matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • csr_col_ind: integer array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) column indices of the non-zero elements of matrix A.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSpruneDense2csr_nnz(), musparseDpruneDense2csr_nnz(), musparseSpruneDense2csr() and musparseDpruneDense2csr().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float A
  • muInt lda const float threshold
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csr_bufferSize(musparseHandle_t handle, muInt m, muInt n, const double `A, muInt lda, const double `threshold, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double A
  • muInt lda const double threshold
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csr_nnz(musparseHandle_t handle, muInt m, muInt n, const float `A, muInt lda, const float `threshold, const musparseMatDescr_t descr, muInt `csr_row_ptr, muInt `nnz_total_dev_host_ptr, void *temp_buffer)

This function computes the number of nonzero elements per row and the total number of nonzero elements in a dense matrix once elements less than the threshold are pruned from the matrix.

The routine does support asynchronous execution if the pointer mode is set to device.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • A: array of dimensions (lda, n)
  • lda: leading dimension of dense array A.
  • threshold: pointer to the pruning non-negative threshold which can exist in either host or device memory.
  • descr: the descriptor of the dense matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • nnz_total_dev_host_ptr: total number of nonzero elements in device or host memory.
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xprune_dense2csr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or lda is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: A or threshold or descr or csr_row_ptr or nnz_total_dev_host_ptr or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float A
  • muInt lda const float threshold
  • const musparseMatDescr_t descr muInt csr_row_ptr muInt nnz_total_dev_host_ptr void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csr_nnz(musparseHandle_t handle, muInt m, muInt n, const double `A, muInt lda, const double `threshold, const musparseMatDescr_t descr, muInt `csr_row_ptr, muInt `nnz_total_dev_host_ptr, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double A
  • muInt lda const double threshold
  • const musparseMatDescr_t descr muInt csr_row_ptr muInt nnz_total_dev_host_ptr void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csr_nnz(musparseHandle_t handle, muInt m, muInt n, const __half `A, muInt lda, const __half `threshold, const musparseMatDescr_t descr, muInt `csr_row_ptr, muInt `nnz_total_dev_host_ptr, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const __half A
  • muInt lda const __half threshold
  • const musparseMatDescr_t descr muInt csr_row_ptr muInt nnz_total_dev_host_ptr void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csr

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csr(musparseHandle_t handle, muInt m, muInt n, const float `A, muInt lda, const float `threshold, const musparseMatDescr_t descr, float `csr_val, const muInt `csr_row_ptr, muInt `csr_col_ind, void `temp_buffer)

This function converts the matrix A in dense format into a sparse matrix in CSR format while pruning values that are less than the threshold. All the parameters are assumed to have been pre-allocated by the user.

The user first allocates csr_row_ptr to have m+1 elements and then calls musparse_xprune_dense2csr_nnz() which fills in the csr_row_ptr array and stores the number of elements that are larger than the pruning threshold in nnz_total_dev_host_ptr. The user then allocates csr_col_ind and csr_val to have size nnz_total_dev_host_ptr and completes the conversion by calling musparse_xprune_dense2csr(). A temporary storage buffer is used by both musparse_xprune_dense2csr_nnz() and musparse_xprune_dense2csr() and must be allocated by the user and whose size is determined by musparse_xprune_dense2csr_buffer_size(). The routine musparse_xprune_dense2csr() is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • A: array of dimensions (lda, n)
  • lda: leading dimension of dense array A.
  • threshold: pointer to the non-negative pruning threshold which can exist in either host or device memory.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • csr_val: array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) nonzero elements of matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • csr_col_ind: integer array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) column indices of the non-zero elements of matrix A.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparse_xprune_dense2csr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or lda is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: A or descr or threshold or csr_val or csr_row_ptr or csr_col_ind or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float A
  • muInt lda const float threshold
  • const musparseMatDescr_t descr float csr_val const muInt csr_row_ptr muInt csr_col_ind void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csr

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csr(musparseHandle_t handle, muInt m, muInt n, const double `A, muInt lda, const double `threshold, const musparseMatDescr_t descr, double `csr_val, const muInt `csr_row_ptr, muInt `csr_col_ind, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double A
  • muInt lda const double threshold
  • const musparseMatDescr_t descr double csr_val const muInt csr_row_ptr muInt csr_col_ind void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csr

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csr(musparseHandle_t handle, muInt m, muInt n, const __half `A, muInt lda, const __half `threshold, const musparseMatDescr_t descr, __half `csr_val, const muInt `csr_row_ptr, muInt `csr_col_ind, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const __half A
  • muInt lda const __half threshold
  • const musparseMatDescr_t descr __half csr_val const muInt csr_row_ptr muInt csr_col_ind void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csrByPercentage_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csrByPercentage_bufferSize(musparseHandle_t handle, muInt m, muInt n, const float `A, muInt lda, float percentage, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t *buffer_size)

This function computes the size of the user allocated temporary storage buffer used when converting and pruning by percentage a dense matrix to a CSR matrix.

When converting and pruning a dense matrix A to a CSR matrix by percentage the following steps are performed. First the user calls musparseXpruneDense2csrByPercentage_bufferSize which determines the size of the temporary storage buffer. Once determined, this buffer must be allocated by the user. Next the user allocates the csr_row_ptr array to have m+1 elements and calls musparseXpruneDense2csr_nnzByPercentage. Finally the user finishes the conversion by allocating the csr_col_ind and csr_val arrays (whos size is determined by the value at nnz_total_dev_host_ptr) and calling musparseXpruneDense2csrByPercentage.

The pruning by percentage works by first sorting the absolute values of the dense matrix A. We then determine a position in this sorted array by formula \{"type":"element","name":"formula","attributes":\{"id":"112"\},"children":[\{"type":"text","text":"\\[\n pos = ceil(mn(percentage/100)) - 1\n pos = min(pos, m*n-1)\n pos = max(pos, 0)\n threshold = sorted_A[pos]\n \\]"\}]\} Once we have this threshold we prune values in the dense matrix A as in musparseXpruneDense2csr. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • A: array of dimensions (lda, n)
  • lda: leading dimension of dense array A.
  • percentage: percentage >= 0 and percentage <= 100.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • csr_val: array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) nonzero elements of matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • csr_col_ind: integer array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) column indices of the non-zero elements of matrix A.
  • info: prune information structure
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSpruneDense2csr_nnzByPercentage(), musparseDpruneDense2csr_nnzByPercentage(), musparseSpruneDense2csrByPercentage() and musparseDpruneDense2csrByPercentage().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float A
  • muInt lda
  • float percentage
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csrByPercentage_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csrByPercentage_bufferSize(musparseHandle_t handle, muInt m, muInt n, const double `A, muInt lda, double percentage, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double A
  • muInt lda
  • double percentage
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csrByPercentage_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csrByPercentage_bufferSize(musparseHandle_t handle, muInt m, muInt n, const __half `A, muInt lda, float percentage, const musparseMatDescr_t descr, const __half `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseMatInfo_t info, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const __half A
  • muInt lda
  • float percentage
  • const musparseMatDescr_t descr const __half csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csr_nnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csr_nnzByPercentage(musparseHandle_t handle, muInt m, muInt n, const float `A, muInt lda, float percentage, const musparseMatDescr_t descr, muInt `csr_row_ptr, muInt `nnz_total_dev_host_ptr, musparseMatInfo_t info, void `temp_buffer)

This function computes the number of nonzero elements per row and the total number of nonzero elements in a dense matrix when converting and pruning by percentage a dense matrix to a CSR matrix.

When converting and pruning a dense matrix A to a CSR matrix by percentage the following steps are performed. First the user calls musparseXpruneDense2csrByPercentage_bufferSize which determines the size of the temporary storage buffer. Once determined, this buffer must be allocated by the user. Next the user allocates the csr_row_ptr array to have m+1 elements and calls musparseXpruneDense2csr_nnzByPercentage. Finally the user finishes the conversion by allocating the csr_col_ind and csr_val arrays (whos size is determined by the value at nnz_total_dev_host_ptr) and calling musparseXpruneDense2csrByPercentage.

The pruning by percentage works by first sorting the absolute values of the dense matrix A. We then determine a position in this sorted array by formula \{"type":"element","name":"formula","attributes":\{"id":"112"\},"children":[\{"type":"text","text":"\\[\n pos = ceil(mn(percentage/100)) - 1\n pos = min(pos, m*n-1)\n pos = max(pos, 0)\n threshold = sorted_A[pos]\n \\]"\}]\} Once we have this threshold we prune values in the dense matrix A as in musparseXpruneDense2csr. The routine does support asynchronous execution if the pointer mode is set to device.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • A: array of dimensions (lda, n)
  • lda: leading dimension of dense array A.
  • percentage: percentage >= 0 and percentage <= 100.
  • descr: the descriptor of the dense matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • nnz_total_dev_host_ptr: total number of nonzero elements in device or host memory.
  • info: prune information structure
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xprune_dense2csr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or lda or percentage is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: A or descr or info or csr_row_ptr or nnz_total_dev_host_ptr or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float A
  • muInt lda
  • float percentage
  • const musparseMatDescr_t descr muInt csr_row_ptr muInt nnz_total_dev_host_ptr
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csr_nnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csr_nnzByPercentage(musparseHandle_t handle, muInt m, muInt n, const double `A, muInt lda, double percentage, const musparseMatDescr_t descr, muInt `csr_row_ptr, muInt `nnz_total_dev_host_ptr, musparseMatInfo_t info, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double A
  • muInt lda
  • double percentage
  • const musparseMatDescr_t descr muInt csr_row_ptr muInt nnz_total_dev_host_ptr
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csr_nnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csr_nnzByPercentage(musparseHandle_t handle, muInt m, muInt n, const __half `A, muInt lda, float percentage, const musparseMatDescr_t descr, muInt `csr_row_ptr, muInt `nnz_total_dev_host_ptr, musparseMatInfo_t info, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const __half A
  • muInt lda
  • float percentage
  • const musparseMatDescr_t descr muInt csr_row_ptr muInt nnz_total_dev_host_ptr
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneDense2csrByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseSpruneDense2csrByPercentage(musparseHandle_t handle, muInt m, muInt n, const float `A, muInt lda, float percentage, const musparseMatDescr_t descr, float `csr_val, const muInt `csr_row_ptr, muInt `csr_col_ind, musparseMatInfo_t info, void *temp_buffer)

This function converts the matrix A in dense format into a sparse matrix in CSR format while pruning values based on percentage.

When converting and pruning a dense matrix A to a CSR matrix by percentage the following steps are performed. First the user calls musparseXpruneDense2csrByPercentage_bufferSize which determines the size of the temporary storage buffer. Once determined, this buffer must be allocated by the user. Next the user allocates the csr_row_ptr array to have m+1 elements and calls musparseXpruneDense2csr_nnzByPercentage. Finally the user finishes the conversion by allocating the csr_col_ind and csr_val arrays (whos size is determined by the value at nnz_total_dev_host_ptr) and calling musparseXpruneDense2csrByPercentage.

The pruning by percentage works by first sorting the absolute values of the dense matrix A. We then determine a position in this sorted array by formula \{"type":"element","name":"formula","attributes":\{"id":"112"\},"children":[\{"type":"text","text":"\\[\n pos = ceil(mn(percentage/100)) - 1\n pos = min(pos, m*n-1)\n pos = max(pos, 0)\n threshold = sorted_A[pos]\n \\]"\}]\} Once we have this threshold we prune values in the dense matrix A as in musparseXpruneDense2csr. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • A: array of dimensions (lda, n)
  • lda: leading dimension of dense array A.
  • percentage: percentage >= 0 and percentage <= 100.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • csr_val: array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) nonzero elements of matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • csr_col_ind: integer array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) column indices of the non-zero elements of matrix A.
  • info: prune information structure
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparse_xprune_dense2csr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or lda or percentage is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: A or descr or info or csr_val or csr_row_ptr or csr_col_ind or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const float A
  • muInt lda
  • float percentage
  • const musparseMatDescr_t descr float csr_val const muInt csr_row_ptr muInt csr_col_ind
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneDense2csrByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseDpruneDense2csrByPercentage(musparseHandle_t handle, muInt m, muInt n, const double `A, muInt lda, double percentage, const musparseMatDescr_t descr, double `csr_val, const muInt `csr_row_ptr, muInt `csr_col_ind, musparseMatInfo_t info, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const double A
  • muInt lda
  • double percentage
  • const musparseMatDescr_t descr double csr_val const muInt csr_row_ptr muInt csr_col_ind
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csrByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csrByPercentage(musparseHandle_t handle, muInt m, muInt n, const __half `A, muInt lda, float percentage, const musparseMatDescr_t descr, __half `csr_val, const muInt `csr_row_ptr, muInt `csr_col_ind, musparseMatInfo_t info, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const __half A
  • muInt lda
  • float percentage
  • const musparseMatDescr_t descr __half csr_val const muInt csr_row_ptr muInt csr_col_ind
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSdense2csc

MUSPARSE_EXPORT musparseStatus_t musparseSdense2csc(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const float `A, muInt ld, const muInt `nnz_per_columns, float `csc_val, muInt `csc_col_ptr, muInt *csc_row_ind)

This function converts the matrix A in dense format into a sparse matrix in CSC format. All the parameters are assumed to have been pre-allocated by the user and the arrays are filled in based on nnz_per_columns, which can be pre-computed with musparse_xnnz(). It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • A: array of dimensions (ld, n)
  • ld: leading dimension of dense array A.
  • nnz_per_columns: array of size n containing the number of non-zero elements per column.
  • csc_val: array of nnz ( = csc_col_ptr[m] - csc_col_ptr[0] ) nonzero elements of matrix A.
  • csc_col_ptr: integer array of m+1 elements that contains the start of every column and the end of the last column plus one.
  • csc_row_ind: integer array of nnz ( = csc_col_ptr[m] - csc_col_ptr[0] ) column indices of the non-zero elements of matrix A.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or ld is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p A or nnz_per_columns or csc_val csc_col_ptr or csc_row_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const float A
  • muInt ld const muInt nnz_per_columns float csc_val muInt csc_col_ptr muInt csc_row_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDdense2csc

MUSPARSE_EXPORT musparseStatus_t musparseDdense2csc(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const double `A, muInt ld, const muInt `nnz_per_columns, double `csc_val, muInt `csc_col_ptr, muInt *csc_row_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const double A
  • muInt ld const muInt nnz_per_columns double csc_val muInt csc_col_ptr muInt csc_row_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCdense2csc

MUSPARSE_EXPORT musparseStatus_t musparseCdense2csc(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muComplex `A, muInt ld, const muInt `nnz_per_columns, muComplex `csc_val, muInt `csc_col_ptr, muInt *csc_row_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muComplex A
  • muInt ld const muInt nnz_per_columns muComplex csc_val muInt csc_col_ptr muInt csc_row_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZdense2csc

MUSPARSE_EXPORT musparseStatus_t musparseZdense2csc(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muDoubleComplex `A, muInt ld, const muInt `nnz_per_columns, muDoubleComplex `csc_val, muInt `csc_col_ptr, muInt *csc_row_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muDoubleComplex A
  • muInt ld const muInt nnz_per_columns muDoubleComplex csc_val muInt csc_col_ptr muInt csc_row_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSdense2coo

MUSPARSE_EXPORT musparseStatus_t musparseSdense2coo(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const float `A, muInt ld, const muInt `nnz_per_rows, float `coo_val, muInt `coo_row_ind, muInt *coo_col_ind)

This function converts the matrix A in dense format into a sparse matrix in COO format. All the parameters are assumed to have been pre-allocated by the user and the arrays are filled in based on nnz_per_rows, which can be pre-computed with musparse_xnnz().

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • A: array of dimensions (ld, n)
  • ld: leading dimension of dense array A.
  • nnz_per_rows: array of size n containing the number of non-zero elements per row.
  • coo_val: array of nnz nonzero elements of matrix A.
  • coo_row_ind: integer array of nnz row indices of the non-zero elements of matrix A.
  • coo_col_ind: integer array of nnz column indices of the non-zero elements of matrix A.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or ld is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p A or nnz_per_rows or coo_val coo_col_ind or coo_row_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const float A
  • muInt ld const muInt nnz_per_rows float coo_val muInt coo_row_ind muInt coo_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDdense2coo

MUSPARSE_EXPORT musparseStatus_t musparseDdense2coo(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const double `A, muInt ld, const muInt `nnz_per_rows, double `coo_val, muInt `coo_row_ind, muInt *coo_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const double A
  • muInt ld const muInt nnz_per_rows double coo_val muInt coo_row_ind muInt coo_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCdense2coo

MUSPARSE_EXPORT musparseStatus_t musparseCdense2coo(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muComplex `A, muInt ld, const muInt `nnz_per_rows, muComplex `coo_val, muInt `coo_row_ind, muInt *coo_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muComplex A
  • muInt ld const muInt nnz_per_rows muComplex coo_val muInt coo_row_ind muInt coo_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZdense2coo

MUSPARSE_EXPORT musparseStatus_t musparseZdense2coo(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muDoubleComplex `A, muInt ld, const muInt `nnz_per_rows, muDoubleComplex `coo_val, muInt `coo_row_ind, muInt *coo_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muDoubleComplex A
  • muInt ld const muInt nnz_per_rows muDoubleComplex coo_val muInt coo_row_ind muInt coo_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2dense

MUSPARSE_EXPORT musparseStatus_t musparseScsr2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, float `A, muInt ld)

This function converts the sparse matrix in CSR format into a dense matrix. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • csr_val: array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) nonzero elements of matrix A.
  • csr_row_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • csr_col_ind: integer array of nnz ( = csr_row_ptr[m] - csr_row_ptr[0] ) column indices of the non-zero elements of matrix A.
  • A: array of dimensions (ld, n)
  • ld: leading dimension of dense array A.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or ld is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p A or csr_val csr_row_ptr or csr_col_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind float A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2dense

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, double `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind double A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2dense

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muComplex `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind muComplex A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2dense

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muDoubleComplex `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind muDoubleComplex A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsc2dense

MUSPARSE_EXPORT musparseStatus_t musparseScsc2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const float `csc_val, const muInt `csc_col_ptr, const muInt `csc_row_ind, float `A, muInt ld)

This function converts the sparse matrix in CSC format into a dense matrix. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • csc_val: array of nnz ( = csc_col_ptr[m] - csc_col_ptr[0] ) nonzero elements of matrix A.
  • csc_col_ptr: integer array of m+1 elements that contains the start of every row and the end of the last row plus one.
  • csc_row_ind: integer array of nnz ( = csc_col_ptr[m] - csc_col_ptr[0] ) column indices of the non-zero elements of matrix A.
  • A: array of dimensions (ld, n)
  • ld: leading dimension of dense array A.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or ld is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p A or csc_val csc_col_ptr or csc_row_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const float csc_val const muInt csc_col_ptr const muInt csc_row_ind float A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsc2dense

MUSPARSE_EXPORT musparseStatus_t musparseDcsc2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const double `csc_val, const muInt `csc_col_ptr, const muInt `csc_row_ind, double `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const double csc_val const muInt csc_col_ptr const muInt csc_row_ind double A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsc2dense

MUSPARSE_EXPORT musparseStatus_t musparseCcsc2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muComplex `csc_val, const muInt `csc_col_ptr, const muInt `csc_row_ind, muComplex `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muComplex csc_val const muInt csc_col_ptr const muInt csc_row_ind muComplex A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsc2dense

MUSPARSE_EXPORT musparseStatus_t musparseZcsc2dense(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muDoubleComplex `csc_val, const muInt `csc_col_ptr, const muInt `csc_row_ind, muDoubleComplex `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muDoubleComplex csc_val const muInt csc_col_ptr const muInt csc_row_ind muDoubleComplex A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScoo2dense

MUSPARSE_EXPORT musparseStatus_t musparseScoo2dense(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const float `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, float `A, muInt ld)

This function converts the sparse matrix in COO format into a dense matrix. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the dense matrix A.
  • n: number of columns of the dense matrix A.
  • nnz: number of non-zero entries of the sparse COO matrix.
  • descr: the descriptor of the dense matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • coo_val: array of nnz nonzero elements of matrix A.
  • coo_row_ind: integer array of nnz row indices of the non-zero elements of matrix A.
  • coo_col_ind: integer array of nnz column indices of the non-zero elements of matrix A.
  • A: array of dimensions (ld, n)
  • ld: leading dimension of dense array A.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or nnz or ld is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: A or coo_val coo_col_ind or coo_row_ind pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const float coo_val const muInt coo_row_ind const muInt coo_col_ind float A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcoo2dense

MUSPARSE_EXPORT musparseStatus_t musparseDcoo2dense(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const double `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, double `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const double coo_val const muInt coo_row_ind const muInt coo_col_ind double A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcoo2dense

MUSPARSE_EXPORT musparseStatus_t musparseCcoo2dense(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const muComplex `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, muComplex `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex coo_val const muInt coo_row_ind const muInt coo_col_ind muComplex A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcoo2dense

MUSPARSE_EXPORT musparseStatus_t musparseZcoo2dense(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `coo_val, const muInt `coo_row_ind, const muInt `coo_col_ind, muDoubleComplex `A, muInt ld)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex coo_val const muInt coo_row_ind const muInt coo_col_ind muDoubleComplex A
  • muInt ld

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSnnz_compress

MUSPARSE_EXPORT musparseStatus_t musparseSnnz_compress(musparseHandle_t handle, muInt m, const musparseMatDescr_t descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, muInt `nnz_per_row, muInt `nnz_C, float tol)

Given a sparse CSR matrix and a non-negative tolerance, this function computes how many entries would be left in each row of the matrix if elements less than the tolerance were removed. It also computes the total number of remaining elements in the matrix.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • descr_A: the descriptor of the sparse CSR matrix.
  • csr_val_A: array of nnz_A elements of the sparse CSR matrix.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the uncompressed sparse CSR matrix.
  • nnz_per_row: array of length m containing the number of entries that will be kept per row in the final compressed CSR matrix.
  • nnz_C: number of elements in the column indices and values arrays of the compressed sparse CSR matrix. Can be either host or device pointer.
  • tol: the non-negative tolerance used for compression. If tol is complex then only the magnitude of the real part is used. Entries in the input uncompressed CSR array that are below the tolerance are removed in output compressed CSR matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: tol is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_val_A or csr_row_ptr_A or nnz_per_row or nnz_C pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t descr_A const float csr_val_A const muInt csr_row_ptr_A muInt nnz_per_row muInt nnz_C
  • float tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDnnz_compress

MUSPARSE_EXPORT musparseStatus_t musparseDnnz_compress(musparseHandle_t handle, muInt m, const musparseMatDescr_t descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, muInt `nnz_per_row, muInt `nnz_C, double tol)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t descr_A const double csr_val_A const muInt csr_row_ptr_A muInt nnz_per_row muInt nnz_C
  • double tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCnnz_compress

MUSPARSE_EXPORT musparseStatus_t musparseCnnz_compress(musparseHandle_t handle, muInt m, const musparseMatDescr_t descr_A, const muComplex `csr_val_A, const muInt `csr_row_ptr_A, muInt `nnz_per_row, muInt `nnz_C, muComplex tol)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t descr_A const muComplex csr_val_A const muInt csr_row_ptr_A muInt nnz_per_row muInt nnz_C
  • muComplex tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZnnz_compress

MUSPARSE_EXPORT musparseStatus_t musparseZnnz_compress(musparseHandle_t handle, muInt m, const musparseMatDescr_t descr_A, const muDoubleComplex `csr_val_A, const muInt `csr_row_ptr_A, muInt `nnz_per_row, muInt `nnz_C, muDoubleComplex tol)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t descr_A const muDoubleComplex csr_val_A const muInt csr_row_ptr_A muInt nnz_per_row muInt nnz_C
  • muDoubleComplex tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsr2gebsc_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSgebsr2gebsc_bufferSize_legacy(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const float `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

Convert a sparse GEneral BSR matrix into a sparse GEneral BSC matrix.

musparseXgebsr2gebsc_bufferSize returns the size of the temporary storage buffer required by musparseSgebsr2gebsc(), musparseDgebsr2gebsc(), musparseCgebsr2gebsc() and musparseZgebsr2gebsc(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • mb: number of rows of the sparse GEneral BSR matrix.
  • nb: number of columns of the sparse GEneral BSR matrix.
  • nnzb: number of non-zero entries of the sparse GEneral BSR matrix.
  • bsr_val: array of nnzb*row_block_dim*col_block_dim containing the values of the sparse GEneral BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every row of the sparse GEneral BSR matrix.
  • bsr_col_ind: array of nnzb elements containing the column indices of the sparse GEneral BSR matrix.
  • row_block_dim: row size of the blocks in the sparse general BSR matrix.
  • col_block_dim: col size of the blocks in the sparse general BSR matrix.
  • p_buffer_size: number of bytes of the temporary storage buffer required by musparseSgebsr2gebsc(), musparseDgebsr2gebsc(), musparseCgebsr2gebsc() and musparseZgebsr2gebsc().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nb or nnzb is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_row_ptr, bsr_col_ind or buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const float bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsr2gebsc_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseDgebsr2gebsc_bufferSize_legacy(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const double `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const double bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsr2gebsc_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseCgebsr2gebsc_bufferSize_legacy(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const muComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const muComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsr2gebsc_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseZgebsr2gebsc_bufferSize_legacy(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const muDoubleComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const muDoubleComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsr2gebsc

MUSPARSE_EXPORT musparseStatus_t musparseSgebsr2gebsc(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const float `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, float `bsc_val, muInt `bsc_row_ind, muInt `bsc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Convert a sparse GEneral BSR matrix into a sparse GEneral BSC matrix.

musparseXgebsr2gebsc converts a GEneral BSR matrix into a GEneral BSC matrix. musparseXgebsr2gebsc can also be used to convert a GEneral BSC matrix into a GEneral BSR matrix. copy_values decides whether bsc_val is being filled during conversion (MUSPARSE_ACTION_NUMERIC) or not (MUSPARSE_ACTION_SYMBOLIC).

musparseXgebsr2gebsc requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by musparseXgebsr2gebsc_bufferSize().

注意:The resulting matrix can also be seen as the transpose of the input matrix.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • mb: number of rows of the sparse GEneral BSR matrix.
  • nb: number of columns of the sparse GEneral BSR matrix.
  • nnzb: number of non-zero entries of the sparse GEneral BSR matrix.
  • bsr_val: array of nnzb row_block_dim*col_block_dim` elements of the sparse GEneral BSR matrix.
  • bsr_row_ptr: array of m+1 elements that point to the start of every row of the sparse GEneral BSR matrix.
  • bsr_col_ind: array of nnz elements containing the column indices of the sparse GEneral BSR matrix.
  • row_block_dim: row size of the blocks in the sparse general BSR matrix.
  • col_block_dim: col size of the blocks in the sparse general BSR matrix.
  • bsc_val: array of nnz elements of the sparse BSC matrix.
  • bsc_row_ind: array of nnz elements containing the row indices of the sparse BSC matrix.
  • bsc_col_ptr: array of n+1 elements that point to the start of every column of the sparse BSC matrix.
  • copy_values: MUSPARSE_ACTION_SYMBOLIC or MUSPARSE_ACTION_NUMERIC.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseXgebsr2gebsc_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb, nb or nnzb is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_val, bsr_row_ptr, bsr_col_ind, bsc_val, bsc_row_ind, bsc_col_ptr or temp_buffer pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Example:

This example computes the transpose of a GEneral BSR matrix.

// 1 2 0 3
// A = 0 4 5 0
// 6 0 0 7
// 1 2 3 4

muInt mb_A = 2;
muInt row_block_dim = 2;
muInt col_block_dim = 2;
muInt nb_A = 2;
muInt nnzb_A = 4;

bsr_row_ptr_A[mb_A+1] = \{0, 2, 4\}; // device memory
bsr_col_ind_A[nnzb_A] = \{0, 1, 0, 1\}; // device memory
bsr_val_A[nnzb_A] = \{1, 0, 2, 4, 0, 5, 3, 0, 6, 1, 0, 2, 0, 3, 7,
4\}; // device memory

// Allocate memory for transposed BSR matrix
muInt mb_T = nb_A;
muInt nb_T = mb_A;
muInt nnzb_T = nnzb_A;

muInt* bsr_row_ptr_T;
muInt* bsr_col_ind_T;
float* bsr_val_T;

musaMalloc((void``)&bsr_row_ptr_T, sizeof(muInt) * (mb_T + 1));
musaMalloc((void``)&bsr_col_ind_T, sizeof(muInt) * nnzb_T);
musaMalloc((void``)&bsr_val_T, sizeof(float) * nnzb_T);

// Obtain the temporary buffer size
size_t buffer_size;
musparseXgebsr2gebsc_bufferSize(handle,
mb_A,
nb_A,
nnzb_A,
bsr_row_ptr_A,
bsr_col_ind_A,
MUSPARSE_ACTION_NUMERIC,
&buffer_size);

// Allocate temporary buffer
void* temp_buffer;
musaMalloc(&temp_buffer, buffer_size);

musparseSgebsr2gebsc(handle,
mb_A,
nb_A,
nnzb_A,
bsr_val_A,
bsr_row_ptr_A,
bsr_col_ind_A,
row_block_dim,
col_block_dim,
bsr_val_T,
bsr_col_ind_T,
bsr_row_ptr_T,
MUSPARSE_ACTION_NUMERIC,
MUSPARSE_INDEX_BASE_ZERO,
temp_buffer);

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const float bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim float bsc_val muInt bsc_row_ind muInt bsc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsr2gebsc

MUSPARSE_EXPORT musparseStatus_t musparseDgebsr2gebsc(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const double `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, double `bsc_val, muInt `bsc_row_ind, muInt `bsc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const double bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim double bsc_val muInt bsc_row_ind muInt bsc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsr2gebsc

MUSPARSE_EXPORT musparseStatus_t musparseCgebsr2gebsc(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const muComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, muComplex `bsc_val, muInt `bsc_row_ind, muInt `bsc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const muComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim muComplex bsc_val muInt bsc_row_ind muInt bsc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsr2gebsc

MUSPARSE_EXPORT musparseStatus_t musparseZgebsr2gebsc(musparseHandle_t handle, muInt mb, muInt nb, muInt nnzb, const muDoubleComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, muDoubleComplex `bsc_val, muInt `bsc_row_ind, muInt `bsc_col_ptr, musparseAction_t copy_values, musparseIndexBase_t idx_base, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt mb
  • muInt nb
  • muInt nnzb const muDoubleComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim muDoubleComplex bsc_val muInt bsc_row_ind muInt bsc_col_ptr
  • musparseAction_t copy_values
  • musparseIndexBase_t idx_base void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2ell

MUSPARSE_EXPORT musparseStatus_t musparseScsr2ell(musparseHandle_t handle, muInt m, const musparseMatDescr_t csr_descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t ell_descr, muInt ell_width, float `ell_val, muInt *ell_col_ind)

Convert a sparse CSR matrix into a sparse ELL matrix.

musparseXcsr2ell converts a CSR matrix into an ELL matrix. It is assumed, that ell_val and ell_col_ind are allocated. Allocation size is computed by the number of rows times the number of ELL non-zero elements per row, such that formula \{"type":"element","name":"formula","attributes":\{"id":"113"\},"children":[\{"type":"text","text":"$\\text\{nnz\}_\{\\text\{ELL\}\} = m \\cdot \\text\{ell_width\}$"\}]\}. The number of ELL non-zero elements per row is obtained by musparseXcsr2csr2ell_width().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array containing the column indices of the sparse CSR matrix.
  • ell_descr: descriptor of the sparse ELL matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • ell_width: number of non-zero elements per row in ELL storage format.
  • ell_val: array of m times ell_width elements of the sparse ELL matrix.
  • ell_col_ind: array of m times ell_width elements containing the column indices of the sparse ELL matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or ell_width is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p csr_descr, csr_val, csr_row_ptr, csr_col_ind, ell_descr, ell_val or ell_col_ind pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example converts a CSR matrix into an ELL matrix.

// 1 2 0 3 0
// A = 0 4 5 0 0
// 6 0 0 7 8

muInt m = 3;
muInt n = 5;
muInt nnz = 8;

csr_row_ptr[m+1] = \{0, 3, 5, 8\}; // device memory
csr_col_ind[nnz] = \{0, 1, 3, 1, 2, 0, 3, 4\}; // device memory
csr_val[nnz] = \{1, 2, 3, 4, 5, 6, 7, 8\}; // device memory

// Create ELL matrix descriptor
musparseMatDescr_t ell_descr;
musparseCreateMatDescr(&ell_descr);

// Obtain the ELL width
muInt ell_width;
musparseXcsr2csr2ell_width(handle,
m,
csr_descr,
csr_row_ptr,
ell_descr,
&ell_width);

// Compute ELL non-zero entries
muInt ell_nnz = m * ell_width;

// Allocate ELL column and value arrays
muInt* ell_col_ind;
musaMalloc((void``)&ell_col_ind, sizeof(muInt) * ell_nnz);

float* ell_val;
musaMalloc((void``)&ell_val, sizeof(float) * ell_nnz);

// Format conversion
musparseScsr2ell(handle,
m,
csr_descr,
csr_val,
csr_row_ptr,
csr_col_ind,
ell_descr,
ell_width,
ell_val,
ell_col_ind);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t csr_descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t ell_descr
  • muInt ell_width float ell_val muInt ell_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2ell

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2ell(musparseHandle_t handle, muInt m, const musparseMatDescr_t csr_descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t ell_descr, muInt ell_width, double `ell_val, muInt *ell_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t csr_descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t ell_descr
  • muInt ell_width double ell_val muInt ell_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2ell

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2ell(musparseHandle_t handle, muInt m, const musparseMatDescr_t csr_descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t ell_descr, muInt ell_width, muComplex `ell_val, muInt *ell_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t csr_descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t ell_descr
  • muInt ell_width muComplex ell_val muInt ell_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2ell

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2ell(musparseHandle_t handle, muInt m, const musparseMatDescr_t csr_descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t ell_descr, muInt ell_width, muDoubleComplex `ell_val, muInt *ell_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t csr_descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t ell_descr
  • muInt ell_width muDoubleComplex ell_val muInt ell_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2hyb

MUSPARSE_EXPORT musparseStatus_t musparseScsr2hyb(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseHybMat_t hyb, muInt user_ell_width, musparseHybPartition_t partition_type)

Convert a sparse CSR matrix into a sparse HYB matrix.

musparseXcsr2hyb converts a CSR matrix into a HYB matrix. It is assumed that hyb has been initialized with musparseCreateHybMat().

注意:This function requires a significant amount of storage for the HYB matrix, depending on the matrix structure.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array containing the column indices of the sparse CSR matrix.
  • hyb: sparse matrix in HYB format.
  • user_ell_width: width of the ELL part of the HYB matrix (only required if partition_type == MUSPARSE_HYB_PARTITION_USER).
  • partition_type: MUSPARSE_HYB_PARTITION_AUTO (recommended), MUSPARSE_HYB_PARTITION_USER or MUSPARSE_HYB_PARTITION_MAX.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or user_ell_width is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: partition_type is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, hyb, csr_val, csr_row_ptr or csr_col_ind pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer for the HYB matrix could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example converts a CSR matrix into a HYB matrix using user defined partitioning.

// Create HYB matrix structure
musparseHybMat_t hyb;
musparseCreateHybMat(&hyb);

// User defined ell width
muInt user_ell_width = 5;

// Perform the conversion
musparseScsr2hyb(handle,
m,
n,
descr,
csr_val,
csr_row_ptr,
csr_col_ind,
hyb,
user_ell_width,
MUSPARSE_HYB_PARTITION_USER);

// Do some work

// Clean up
musparseDestroyHybMat(hyb);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseHybMat_t hyb
  • muInt user_ell_width
  • musparseHybPartition_t partition_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2hyb

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2hyb(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseHybMat_t hyb, muInt user_ell_width, musparseHybPartition_t partition_type)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseHybMat_t hyb
  • muInt user_ell_width
  • musparseHybPartition_t partition_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2hyb

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2hyb(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseHybMat_t hyb, muInt user_ell_width, musparseHybPartition_t partition_type)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseHybMat_t hyb
  • muInt user_ell_width
  • musparseHybPartition_t partition_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2hyb

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2hyb(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt *csr_col_ind, musparseHybMat_t hyb, muInt user_ell_width, musparseHybPartition_t partition_type)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • musparseHybMat_t hyb
  • muInt user_ell_width
  • musparseHybPartition_t partition_type

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2bsr

MUSPARSE_EXPORT musparseStatus_t musparseScsr2bsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt block_dim, const musparseMatDescr_t bsr_descr, float `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind)

Convert a sparse CSR matrix into a sparse BSR matrix.

musparseXcsr2bsr converts a CSR matrix into a BSR matrix. It is assumed, that bsr_val, bsr_col_ind and bsr_row_ptr are allocated. Allocation size for bsr_row_ptr is computed as mb+1 where mb is the number of block rows in the BSR matrix. Allocation size for bsr_val and bsr_col_ind is computed using csr2bsr_nnz() which also fills in bsr_row_ptr.

musparseXcsr2bsr requires extra temporary storage that is allocated internally if block_dim\>16

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: the storage format of the blocks, MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnz elements containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • block_dim: size of the blocks in the sparse BSR matrix.
  • bsr_descr: descriptor of the sparse BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb*block_dim*block_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse BSR matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_val, bsr_row_ptr, bsr_col_ind, csr_val, csr_row_ptr or csr_col_ind pointer is invalid.

Example:

This example converts a CSR matrix into an BSR matrix.

// 1 4 0 0 0 0
// A = 0 2 3 0 0 0
// 5 0 0 7 8 0
// 0 0 9 0 6 0

muInt m = 4;
muInt n = 6;
muInt block_dim = 2;
muInt nnz = 9;
muInt mb = (m + block_dim - 1) / block_dim;
muInt nb = (n + block_dim - 1) / block_dim;

csr_row_ptr[m+1] = \{0, 2, 4, 7, 9\}; // device memory
csr_col_ind[nnz] = \{0, 1, 1, 2, 0, 3, 4, 2, 4\}; // device memory
csr_val[nnz] = \{1, 4, 2, 3, 5, 7, 8, 9, 6\}; // device memory

musaMalloc(&bsr_row_ptr, sizeof(muInt) *(mb + 1));
muInt nnzb;
muInt* nnzTotalHostPtr = &nnzb;
csr2bsr_nnz(handle,
MUSPARSE_DIRECTION_ROW,
m,
n,
csr_descr,
csr_row_ptr,
csr_col_ind,
block_dim,
bsr_descr,
bsr_row_ptr,
nnzTotalHostPtr);
nnzb = *nnzTotalDevHostPtr;
musaMalloc(&bsr_col_ind, sizeof(muInt)*nnzb);
musaMalloc(&bsr_val, sizeof(float)`(block_dim ` block_dim) * nnzb);
scsr2bsr(handle,
MUSPARSE_DIRECTION_ROW,
m,
n,
csr_descr,
csr_val,
csr_row_ptr,
csr_col_ind,
block_dim,
bsr_descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind);

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t bsr_descr float bsr_val muInt bsr_row_ptr muInt bsr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2bsr

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2bsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt block_dim, const musparseMatDescr_t bsr_descr, double `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t bsr_descr double bsr_val muInt bsr_row_ptr muInt bsr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2bsr

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2bsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt block_dim, const musparseMatDescr_t bsr_descr, muComplex `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t bsr_descr muComplex bsr_val muInt bsr_row_ptr muInt bsr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2bsr

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2bsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt block_dim, const musparseMatDescr_t bsr_descr, muDoubleComplex `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t bsr_descr muDoubleComplex bsr_val muInt bsr_row_ptr muInt bsr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseScsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

musparseXcsr2gebsr_bufferSize returns the size of the temporary buffer that is required by musparse_csr2gebcsr_nnz, musparse_scsr2gebcsr, musparseDcsr2gebsr, musparseCcsr2gebsr and musparseZcsr2gebsr. The temporary storage buffer must be allocated by the user.

This function computes the number of nonzero block columns per row and the total number of nonzero blocks in a sparse GEneral BSR matrix given a sparse CSR matrix as input.

The routine does support asynchronous execution if the pointer mode is set to device.

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.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnz elements containing the values of the sparse CSR matrix.
  • csr_row_ptr: integer array containing m+1 elements that point to the start of each row of the CSR matrix
  • csr_col_ind: integer array of the column indices for each non-zero element in the CSR matrix
  • row_block_dim: the row block dimension of the GEneral BSR matrix. Between 1 and m
  • col_block_dim: the col block dimension of the GEneral BSR matrix. Between 1 and n
  • p_buffer_size: (host/device) number of bytes of the temporary storage buffer required by musparseXcsr2gebsr_nnz and musparseScsr2gebsr.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or row_block_dim col_block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_val or csr_row_ptr or csr_col_ind or bsr_row_ptr or p_buffer_size pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt row_block_dim, muInt col_block_dim, size_t `p_buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim size_t p_buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2gebsr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2gebsr_nnz(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t bsr_descr, muInt `bsr_row_ptr, muInt row_block_dim, muInt col_block_dim, muInt `bsr_nnz_devhost, void *p_buffer)

This function computes the number of nonzero block columns per row and the total number of nonzero blocks in a sparse GEneral BSR matrix given a sparse CSR matrix as input.

The routine does support asynchronous execution if the pointer mode is set to device.

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.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr: integer array containing m+1 elements that point to the start of each row of the CSR matrix
  • csr_col_ind: integer array of the column indices for each non-zero element in the CSR matrix
  • bsr_descr: descriptor of the sparse GEneral BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_row_ptr: integer array containing mb+1 elements that point to the start of each block row of the General BSR matrix
  • row_block_dim: the row block dimension of the GEneral BSR matrix. Between 1 and min(m, n)
  • col_block_dim: the col block dimension of the GEneral BSR matrix. Between 1 and min(m, n)
  • bsr_nnz_devhost: total number of nonzero elements in device or host memory.
  • p_buffer: buffer allocated by the user whose size is determined by calling musparse_xcsr2gebsr_buffer_size.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or row_block_dim col_block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p csr_row_ptr or csr_col_ind or bsr_row_ptr or bsr_nnz_devhost pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t bsr_descr muInt bsr_row_ptr
  • muInt row_block_dim
  • muInt col_block_dim muInt bsr_nnz_devhost void p_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseScsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t bsr_descr, float `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, void *p_buffer)

Convert a sparse CSR matrix into a sparse GEneral BSR matrix.

musparseXcsr2gebsr converts a CSR matrix into a GEneral BSR matrix. It is assumed, that bsr_val, bsr_col_ind and bsr_row_ptr are allocated. Allocation size for bsr_row_ptr is computed as mb+1 where mb is the number of block rows in the GEneral BSR matrix. Allocation size for bsr_val and bsr_col_ind is computed using csr2gebsr_nnz() which also fills in bsr_row_ptr.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: the storage format of the blocks, MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnz elements containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • bsr_descr: descriptor of the sparse BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb* row_block_dim*col_block_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse BSR matrix.
  • row_block_dim: row size of the blocks in the sparse GEneral BSR matrix.
  • col_block_dim: col size of the blocks in the sparse GEneral BSR matrix.
  • p_buffer: buffer allocated by the user whose size is determined by calling musparse_xcsr2gebsr_buffer_size.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or row_block_dim or col_block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p bsr_val, bsr_row_ptr, bsr_col_ind, csr_val, csr_row_ptr or csr_col_ind pointer is invalid.

Example:

This example converts a CSR matrix into an BSR matrix.

// 1 4 0 0 0 0
// A = 0 2 3 0 0 0
// 5 0 0 7 8 0
// 0 0 9 0 6 0

muInt m = 4;
muInt n = 6;
muInt row_block_dim = 2;
muInt col_block_dim = 3;
muInt nnz = 9;
muInt mb = (m + row_block_dim - 1) / row_block_dim;
muInt nb = (n + col_block_dim - 1) / col_block_dim;

csr_row_ptr[m+1] = \{0, 2, 4, 7, 9\}; // device memory
csr_col_ind[nnz] = \{0, 1, 1, 2, 0, 3, 4, 2, 4\}; // device memory
csr_val[nnz] = \{1, 4, 2, 3, 5, 7, 8, 9, 6\}; // device memory

musaMalloc(&bsr_row_ptr, sizeof(muInt) *(mb + 1));
muInt nnzb;
muInt* nnzTotalHostPtr = &nnzb;
csr2gebsr_nnz(handle,
MUSPARSE_DIRECTION_ROW,
m,
n,
csr_descr,
csr_row_ptr,
csr_col_ind,
row_block_dim,
col_block_dim,
bsr_descr,
bsr_row_ptr,
nnzTotalHostPtr);
nnzb = *nnzTotalDevHostPtr;
musaMalloc(&bsr_col_ind, sizeof(muInt)*nnzb);
musaMalloc(&bsr_val, sizeof(float)`(row_block_dim ` col_block_dim) *
nnzb); scsr2gebsr(handle, MUSPARSE_DIRECTION_ROW, m, n, csr_descr, csr_val,
csr_row_ptr,
csr_col_ind,
row_block_dim,
col_block_dim,
bsr_descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind);

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t bsr_descr float bsr_val muInt bsr_row_ptr muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim void p_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t bsr_descr, double `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, void *p_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t bsr_descr double bsr_val muInt bsr_row_ptr muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim void p_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t bsr_descr, muComplex `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, void *p_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t bsr_descr muComplex bsr_val muInt bsr_row_ptr muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim void p_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const musparseMatDescr_t bsr_descr, muDoubleComplex `bsr_val, muInt `bsr_row_ptr, muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, void *p_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind
  • const musparseMatDescr_t bsr_descr muDoubleComplex bsr_val muInt bsr_row_ptr muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim void p_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsr2csr_compress

MUSPARSE_EXPORT musparseStatus_t musparseScsr2csr_compress(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, muInt nnz_A, const muInt `nnz_per_row, float `csr_val_C, muInt `csr_row_ptr_C, muInt *csr_col_ind_C, float tol)

Convert a sparse CSR matrix into a compressed sparse CSR matrix.

musparseXcsr2csr_compress converts a CSR matrix into a compressed CSR matrix by removing entries in the input CSR matrix that are below a non-negative threshold tol

注意:In the case of complex matrices only the magnitude of the real part of tol is used.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • descr_A: matrix descriptor for the CSR matrix
  • csr_val_A: array of nnz_A elements of the sparse CSR matrix.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the uncompressed sparse CSR matrix.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the uncompressed sparse CSR matrix.
  • nnz_A: number of elements in the column indices and values arrays of the uncompressed sparse CSR matrix.
  • nnz_per_row: array of length m containing the number of entries that will be kept per row in the final compressed CSR matrix.
  • csr_val_C: array of nnz_C elements of the compressed sparse CSC matrix.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every column of the compressed sparse CSR matrix.
  • csr_col_ind_C: array of nnz_C elements containing the row indices of the compressed sparse CSR matrix.
  • tol: the non-negative tolerance used for compression. If tol is complex then only the magnitude of the real part is used. Entries in the input uncompressed CSR array that are below the tolerance are removed in output compressed CSR matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz_A is invalid.
  • MUSPARSE_STATUS_INVALID_VALUE: tol is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_val_A, csr_row_ptr_A, csr_col_ind_A, csr_val_C, csr_row_ptr_C, csr_col_ind_C or nnz_per_row pointer is invalid.

Example:

This example demonstrates how to compress a CSR matrix. Compressing a CSR matrix involves two steps. First we use nnz_compress() to determine how many entries will be in the final compressed CSR matrix. Then we call csr2csr_compress() to finish the compression and fill in the column indices and values arrays of the compressed CSR matrix.

// 1 2 0 3 0
// A = 0 4 5 0 0
// 6 0 0 7 8

float tol = 0.0f;

muInt m = 3;
muInt n = 5;
muInt nnz_A = 8;

csr_row_ptr_A[m+1] = \{0, 3, 5, 8\}; // device memory
csr_col_ind_A[nnz_A] = \{0, 1, 3, 1, 2, 0, 3, 4\}; // device memory
csr_val_A[nnz_A] = \{1, 0, 3, 4, 0, 6, 7, 0\}; // device memory

// Allocate memory for the row pointer array of the compressed CSR
matrix muInt* csr_row_ptr_C; musaMalloc(csr_row_ptr_C,
sizeof(muInt) * (m + 1));

// Allocate memory for the nnz_per_row array
muInt* nnz_per_row;
musaMalloc(nnz_per_row, sizeof(muInt) * m);

// Call nnz_compress() which fills in nnz_per_row array and finds the
number
// of entries that will be in the compressed CSR matrix
muInt nnz_C;
nnz_compress(handle,
m,
descr_A,
csr_val_A,
csr_row_ptr_A,
nnz_per_row,
&nnz_C,
tol);

// Allocate column indices and values array for the compressed CSR
matrix muInt` csr_col_ind_C; muInt` csr_val_C;
musaMalloc(csr_col_ind_C, sizeof(muInt) * nnz_C;
musaMalloc(csr_val_C, sizeof(muInt) * nnz_C;

// Finish compression by calling csr2csr_compress()
csr2csr_compress(handle,
m,
n,
descr_A,
csr_val_A,
csr_row_ptr_A,
csr_col_ind_A,
nnz_A,
nnz_per_row,
csr_val_C,
csr_row_ptr_C,
csr_col_ind_C,
tol);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • muInt nnz_A const muInt nnz_per_row float csr_val_C muInt csr_row_ptr_C muInt csr_col_ind_C
  • float tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsr2csr_compress

MUSPARSE_EXPORT musparseStatus_t musparseDcsr2csr_compress(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, muInt nnz_A, const muInt `nnz_per_row, double `csr_val_C, muInt `csr_row_ptr_C, muInt *csr_col_ind_C, double tol)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • muInt nnz_A const muInt nnz_per_row double csr_val_C muInt csr_row_ptr_C muInt csr_col_ind_C
  • double tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsr2csr_compress

MUSPARSE_EXPORT musparseStatus_t musparseCcsr2csr_compress(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr_A, const muComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, muInt nnz_A, const muInt `nnz_per_row, muComplex `csr_val_C, muInt `csr_row_ptr_C, muInt *csr_col_ind_C, muComplex tol)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr_A const muComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • muInt nnz_A const muInt nnz_per_row muComplex csr_val_C muInt csr_row_ptr_C muInt csr_col_ind_C
  • muComplex tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsr2csr_compress

MUSPARSE_EXPORT musparseStatus_t musparseZcsr2csr_compress(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr_A, const muDoubleComplex `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, muInt nnz_A, const muInt `nnz_per_row, muDoubleComplex `csr_val_C, muInt `csr_row_ptr_C, muInt *csr_col_ind_C, muDoubleComplex tol)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr_A const muDoubleComplex csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • muInt nnz_A const muInt nnz_per_row muDoubleComplex csr_val_C muInt csr_row_ptr_C muInt csr_col_ind_C
  • muDoubleComplex tol

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csr_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const float `threshold, const musparseMatDescr_t csr_descr_C, const float `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, size_t `buffer_size)

Convert and prune sparse CSR matrix into a sparse CSR matrix.

musparseXpruneCsr2csr_bufferSize returns the size of the temporary buffer that is required by musparseSpruneCsr2csr_nnz, musparseDpruneCsr2csr_nnz, musparseSpruneCsr2csr, and musparseDpruneCsr2csr. The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • nnz_A: number of non-zeros in the sparse CSR matrix A.
  • csr_descr_A: descriptor of the sparse CSR matrix A. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_A: array of nnz_A elements containing the values of the sparse CSR matrix A.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix A.
  • threshold: pointer to the non-negative pruning threshold which can exist in either host or device memory.
  • csr_descr_C: descriptor of the sparse CSR matrix C. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_C: array of nnz_C elements containing the values of the sparse CSR matrix C.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix C.
  • csr_col_ind_C: array of nnz_C elements containing the column indices of the sparse CSR matrix C.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSpruneCsr2csr_nnz, musparseDpruneCsr2csr_nnz, musparseSpruneCsr2csr, and musparseDpruneCsr2csr.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const float threshold
  • const musparseMatDescr_t csr_descr_C const float csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csr_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const double `threshold, const musparseMatDescr_t csr_descr_C, const double `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const double threshold
  • const musparseMatDescr_t csr_descr_C const double csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csr_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const __half `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const __half `threshold, const musparseMatDescr_t csr_descr_C, const __half `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const __half csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const __half threshold
  • const musparseMatDescr_t csr_descr_C const __half csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneDense2csr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseHpruneDense2csr_bufferSize(musparseHandle_t handle, muInt m, muInt n, const __half `A, muInt lda, const __half `threshold, const musparseMatDescr_t descr, const __half `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n const __half A
  • muInt lda const __half threshold
  • const musparseMatDescr_t descr const __half csr_val const muInt csr_row_ptr const muInt csr_col_ind size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csr_nnz(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const float `threshold, const musparseMatDescr_t csr_descr_C, muInt `csr_row_ptr_C, muInt `nnz_total_dev_host_ptr, void *temp_buffer)

Convert and prune sparse CSR matrix into a sparse CSR matrix.

musparseXpruneCsr2csr_nnz computes the number of nonzero elements per row and the total number of nonzero elements in a sparse CSR matrix once elements less than the threshold are pruned from the matrix.

注意:The routine does support asynchronous execution if the pointer mode is set to device.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • nnz_A: number of non-zeros in the sparse CSR matrix A.
  • csr_descr_A: descriptor of the sparse CSR matrix A. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_A: array of nnz_A elements containing the values of the sparse CSR matrix A.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix A.
  • threshold: pointer to the non-negative pruning threshold which can exist in either host or device memory.
  • csr_descr_C: descriptor of the sparse CSR matrix C. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix C.
  • nnz_total_dev_host_ptr: total number of nonzero elements in device or host memory.
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xprune_csr2csr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or nnz_A is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: threshold or csr_descr_A or csr_descr_C or csr_val_A or csr_row_ptr_A or csr_col_ind_A or csr_row_ptr_C or nnz_total_dev_host_ptr or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const float threshold
  • const musparseMatDescr_t csr_descr_C muInt csr_row_ptr_C muInt nnz_total_dev_host_ptr void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csr_nnz(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const double `threshold, const musparseMatDescr_t csr_descr_C, muInt `csr_row_ptr_C, muInt `nnz_total_dev_host_ptr, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const double threshold
  • const musparseMatDescr_t csr_descr_C muInt csr_row_ptr_C muInt nnz_total_dev_host_ptr void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csr_nnz(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const __half `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const __half `threshold, const musparseMatDescr_t csr_descr_C, muInt `csr_row_ptr_C, muInt `nnz_total_dev_host_ptr, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const __half csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const __half threshold
  • const musparseMatDescr_t csr_descr_C muInt csr_row_ptr_C muInt nnz_total_dev_host_ptr void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csr(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const float `threshold, const musparseMatDescr_t csr_descr_C, float `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, void `temp_buffer)

Convert and prune sparse CSR matrix into a sparse CSR matrix.

This function converts the sparse CSR matrix A into a sparse CSR matrix C by pruning values in A that are less than the threshold. All the parameters are assumed to have been pre-allocated by the user. The user first calls musparse_xprune_csr2csr_buffer_size() to determine the size of the buffer used by musparse_xprune_csr2csr_nnz() and musparse_xprune_csr2csr() which the user then allocates. The user then allocates csr_row_ptr_C to have m+1 elements and then calls musparse_xprune_csr2csr_nnz() which fills in the csr_row_ptr_C array stores then number of elements that are larger than the pruning threshold in nnz_total_dev_host_ptr. The user then calls musparse_xprune_csr2csr() to complete the conversion. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • nnz_A: number of non-zeros in the sparse CSR matrix A.
  • csr_descr_A: descriptor of the sparse CSR matrix A. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_A: array of nnz_A elements containing the values of the sparse CSR matrix A.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix A.
  • threshold: pointer to the non-negative pruning threshold which can exist in either host or device memory.
  • csr_descr_C: descriptor of the sparse CSR matrix C. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_C: array of nnz_C elements containing the values of the sparse CSR matrix C.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix C.
  • csr_col_ind_C: array of nnz_C elements containing the column indices of the sparse CSR matrix C.
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xprune_csr2csr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or nnz_A is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: threshold or csr_descr_A or csr_descr_C or csr_val_A or csr_row_ptr_A or csr_col_ind_A or csr_val_C or csr_row_ptr_C or csr_col_ind_C or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const float threshold
  • const musparseMatDescr_t csr_descr_C float csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csr(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const double `threshold, const musparseMatDescr_t csr_descr_C, double `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const double threshold
  • const musparseMatDescr_t csr_descr_C double csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csr

musparseStatus_t musparseHpruneCsr2csr(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const __half `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const __half `threshold, const musparseMatDescr_t csr_descr_C, __half `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const __half csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A const __half threshold
  • const musparseMatDescr_t csr_descr_C __half csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C void temp_buffer

Return type: musparseStatus_t

Function musparseSpruneCsr2csrByPercentage_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csrByPercentage_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, float percentage, const musparseMatDescr_t csr_descr_C, const float `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, musparseMatInfo_t info, size_t *buffer_size)

Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.

musparse_prune_csr2csr__by_percentage_buffer_size returns the size of the temporary buffer that is required by musparseSpruneCsr2csr_nnzByPercentage, musparseDpruneCsr2csr_nnzByPercentage, musparseSpruneCsr2csrByPercentage, and musparseDpruneCsr2csrByPercentage. The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • nnz_A: number of non-zeros in the sparse CSR matrix A.
  • csr_descr_A: descriptor of the sparse CSR matrix A. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_A: array of nnz_A elements containing the values of the sparse CSR matrix A.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix A.
  • percentage: percentage >= 0 and percentage <= 100.
  • csr_descr_C: descriptor of the sparse CSR matrix C. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_C: array of nnz_C elements containing the values of the sparse CSR matrix C.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix C.
  • csr_col_ind_C: array of nnz_C elements containing the column indices of the sparse CSR matrix C.
  • info: prune info structure.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseSpruneCsr2csr_nnzByPercentage, musparseDpruneCsr2csr_nnzByPercentage, musparseSpruneCsr2csrByPercentage, and musparseDpruneCsr2csrByPercentage.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • float percentage
  • const musparseMatDescr_t csr_descr_C const float csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csrByPercentage_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csrByPercentage_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, double percentage, const musparseMatDescr_t csr_descr_C, const double `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, musparseMatInfo_t info, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • double percentage
  • const musparseMatDescr_t csr_descr_C const double csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csrByPercentage_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csrByPercentage_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const __half `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, float percentage, const musparseMatDescr_t csr_descr_C, const __half `csr_val_C, const muInt `csr_row_ptr_C, const muInt `csr_col_ind_C, musparseMatInfo_t info, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const __half csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • float percentage
  • const musparseMatDescr_t csr_descr_C const __half csr_val_C const muInt csr_row_ptr_C const muInt csr_col_ind_C
  • musparseMatInfo_t info size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csr_nnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csr_nnzByPercentage(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, float percentage, const musparseMatDescr_t csr_descr_C, muInt `csr_row_ptr_C, muInt `nnz_total_dev_host_ptr, musparseMatInfo_t info, void `temp_buffer)

Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.

musparseXpruneCsr2csr_nnzByPercentage computes the number of nonzero elements per row and the total number of nonzero elements in a sparse CSR matrix once elements less than the threshold are pruned from the matrix.

注意:The routine does support asynchronous execution if the pointer mode is set to device.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • nnz_A: number of non-zeros in the sparse CSR matrix A.
  • csr_descr_A: descriptor of the sparse CSR matrix A. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_A: array of nnz_A elements containing the values of the sparse CSR matrix A.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix A.
  • percentage: percentage >= 0 and percentage <= 100.
  • csr_descr_C: descriptor of the sparse CSR matrix C. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix C.
  • nnz_total_dev_host_ptr: total number of nonzero elements in device or host memory.
  • info: prune info structure.
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xprune_csr2csr_by_percentage_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or nnz_A or percentage is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_descr_A or csr_descr_C or info or csr_val_A or csr_row_ptr_A or csr_col_ind_A or csr_row_ptr_C or nnz_total_dev_host_ptr or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • float percentage
  • const musparseMatDescr_t csr_descr_C muInt csr_row_ptr_C muInt nnz_total_dev_host_ptr
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csr_nnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csr_nnzByPercentage(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, double percentage, const musparseMatDescr_t csr_descr_C, muInt `csr_row_ptr_C, muInt `nnz_total_dev_host_ptr, musparseMatInfo_t info, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • double percentage
  • const musparseMatDescr_t csr_descr_C muInt csr_row_ptr_C muInt nnz_total_dev_host_ptr
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csr_nnzByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csr_nnzByPercentage(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const __half `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, float percentage, const musparseMatDescr_t csr_descr_C, muInt `csr_row_ptr_C, muInt `nnz_total_dev_host_ptr, musparseMatInfo_t info, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const __half csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • float percentage
  • const musparseMatDescr_t csr_descr_C muInt csr_row_ptr_C muInt nnz_total_dev_host_ptr
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpruneCsr2csrByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseSpruneCsr2csrByPercentage(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const float `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, float percentage, const musparseMatDescr_t csr_descr_C, float `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, musparseMatInfo_t info, void *temp_buffer)

Convert and prune by percentage a sparse CSR matrix into a sparse CSR matrix.

This function converts the sparse CSR matrix A into a sparse CSR matrix C by pruning values in A that are less than the threshold. All the parameters are assumed to have been pre-allocated by the user. The user first calls musparse_xprune_csr2csr_buffer_size() to determine the size of the buffer used by musparse_xprune_csr2csr_nnz() and musparse_xprune_csr2csr() which the user then allocates. The user then allocates csr_row_ptr_C to have m+1 elements and then calls musparse_xprune_csr2csr_nnz() which fills in the csr_row_ptr_C array stores then number of elements that are larger than the pruning threshold in nnz_total_dev_host_ptr. The user then calls musparse_xprune_csr2csr() to complete the conversion. It is executed asynchronously with respect to the host and may return control to the application on the host before the entire result is ready.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows in the sparse CSR matrix.
  • n: number of columns in the sparse CSR matrix.
  • nnz_A: number of non-zeros in the sparse CSR matrix A.
  • csr_descr_A: descriptor of the sparse CSR matrix A. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_A: array of nnz_A elements containing the values of the sparse CSR matrix A.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix A.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix A.
  • percentage: percentage >= 0 and percentage <= 100.
  • csr_descr_C: descriptor of the sparse CSR matrix C. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val_C: array of nnz_C elements containing the values of the sparse CSR matrix C.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix C.
  • csr_col_ind_C: array of nnz_C elements containing the column indices of the sparse CSR matrix C.
  • info: prune info structure.
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xprune_csr2csr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or nnz_A or percentage is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_descr_A or csr_descr_C or info or csr_val_A or csr_row_ptr_A or csr_col_ind_A or csr_val_C or csr_row_ptr_C or csr_col_ind_C or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const float csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • float percentage
  • const musparseMatDescr_t csr_descr_C float csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDpruneCsr2csrByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseDpruneCsr2csrByPercentage(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const double `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, double percentage, const musparseMatDescr_t csr_descr_C, double `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, musparseMatInfo_t info, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const double csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • double percentage
  • const musparseMatDescr_t csr_descr_C double csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseHpruneCsr2csrByPercentage

MUSPARSE_EXPORT musparseStatus_t musparseHpruneCsr2csrByPercentage(musparseHandle_t handle, muInt m, muInt n, muInt nnz_A, const musparseMatDescr_t csr_descr_A, const __half `csr_val_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, float percentage, const musparseMatDescr_t csr_descr_C, __half `csr_val_C, const muInt `csr_row_ptr_C, muInt `csr_col_ind_C, musparseMatInfo_t info, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz_A
  • const musparseMatDescr_t csr_descr_A const __half csr_val_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • float percentage
  • const musparseMatDescr_t csr_descr_C __half csr_val_C const muInt csr_row_ptr_C muInt csr_col_ind_C
  • musparseMatInfo_t info void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSell2csr

MUSPARSE_EXPORT musparseStatus_t musparseSell2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t ell_descr, muInt ell_width, const float `ell_val, const muInt `ell_col_ind, const musparseMatDescr_t csr_descr, float `csr_val, const muInt `csr_row_ptr, muInt *csr_col_ind)

Convert a sparse ELL matrix into a sparse CSR matrix.

musparseXell2csr converts an ELL matrix into a CSR matrix. It is assumed that csr_row_ptr has already been filled and that csr_val and csr_col_ind are allocated by the user. csr_row_ptr and allocation size of csr_col_ind and csr_val is defined by the number of CSR non-zero elements. Both can be obtained by musparseXcsr2ell2csr_nnz().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse ELL matrix.
  • n: number of columns of the sparse ELL matrix.
  • ell_descr: descriptor of the sparse ELL matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • ell_width: number of non-zero elements per row in ELL storage format.
  • ell_val: array of m times ell_width elements of the sparse ELL matrix.
  • ell_col_ind: array of m times ell_width elements containing the column indices of the sparse ELL matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array containing the column indices of the sparse CSR matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or ell_width is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_descr, csr_val, csr_row_ptr, csr_col_ind, ell_descr, ell_val or ell_col_ind pointer is ` ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example converts an ELL matrix into a CSR matrix.

// 1 2 0 3 0
// A = 0 4 5 0 0
// 6 0 0 7 8

muInt m = 3;
muInt n = 5;
muInt nnz = 9;
muInt ell_width = 3;

ell_col_ind[nnz] = \{0, 1, 0, 1, 2, 3, 3, -1, 4\}; // device memory
ell_val[nnz] = \{1, 4, 6, 2, 5, 7, 3, 0, 8\}; // device memory

// Create CSR matrix descriptor
musparseMatDescr_t csr_descr;
musparseCreateMatDescr(&csr_descr);

// Allocate csr_row_ptr array for row offsets
muInt* csr_row_ptr;
musaMalloc((void``)&csr_row_ptr, sizeof(muInt) * (m + 1));

// Obtain the number of CSR non-zero entries
// and fill csr_row_ptr array with row offsets
muInt csr_nnz;
musparseXcsr2ell2csr_nnz(handle,
m,
n,
ell_descr,
ell_width,
ell_col_ind,
csr_descr,
csr_row_ptr,
&csr_nnz);

// Allocate CSR column and value arrays
muInt* csr_col_ind;
musaMalloc((void``)&csr_col_ind, sizeof(muInt) * csr_nnz);

float* csr_val;
musaMalloc((void``)&csr_val, sizeof(float) * csr_nnz);

// Format conversion
musparseSell2csr(handle,
m,
n,
ell_descr,
ell_width,
ell_val,
ell_col_ind,
csr_descr,
csr_val,
csr_row_ptr,
csr_col_ind);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t ell_descr
  • muInt ell_width const float ell_val const muInt ell_col_ind
  • const musparseMatDescr_t csr_descr float csr_val const muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDell2csr

MUSPARSE_EXPORT musparseStatus_t musparseDell2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t ell_descr, muInt ell_width, const double `ell_val, const muInt `ell_col_ind, const musparseMatDescr_t csr_descr, double `csr_val, const muInt `csr_row_ptr, muInt *csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t ell_descr
  • muInt ell_width const double ell_val const muInt ell_col_ind
  • const musparseMatDescr_t csr_descr double csr_val const muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCell2csr

MUSPARSE_EXPORT musparseStatus_t musparseCell2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t ell_descr, muInt ell_width, const muComplex `ell_val, const muInt `ell_col_ind, const musparseMatDescr_t csr_descr, muComplex `csr_val, const muInt `csr_row_ptr, muInt *csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t ell_descr
  • muInt ell_width const muComplex ell_val const muInt ell_col_ind
  • const musparseMatDescr_t csr_descr muComplex csr_val const muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZell2csr

MUSPARSE_EXPORT musparseStatus_t musparseZell2csr(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t ell_descr, muInt ell_width, const muDoubleComplex `ell_val, const muInt `ell_col_ind, const musparseMatDescr_t csr_descr, muDoubleComplex `csr_val, const muInt `csr_row_ptr, muInt *csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t ell_descr
  • muInt ell_width const muDoubleComplex ell_val const muInt ell_col_ind
  • const musparseMatDescr_t csr_descr muDoubleComplex csr_val const muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseShyb2csr

MUSPARSE_EXPORT musparseStatus_t musparseShyb2csr(musparseHandle_t handle, const musparseMatDescr_t descr, const musparseHybMat_t hyb, float `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind, void `temp_buffer)

Convert a sparse HYB matrix into a sparse CSR matrix.

musparseXhyb2csr converts a HYB matrix into a CSR matrix.

musparseXhyb2csr requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by musparseXhyb2csr_bufferSize().

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • descr: descriptor of the sparse HYB matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • hyb: sparse matrix in HYB format.
  • csr_val: array containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array containing the column indices of the sparse CSR matrix.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseXhyb2csr_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, hyb, csr_val, csr_row_ptr, csr_col_ind or temp_buffer pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

This example converts a HYB matrix into a CSR matrix.

// Create CSR matrix arrays
muInt* csr_row_ptr;
muInt* csr_col_ind;
float* csr_val;

musaMalloc((void``)&csr_row_ptr, sizeof(muInt) * (m + 1));
musaMalloc((void``)&csr_col_ind, sizeof(muInt) * nnz);
musaMalloc((void``)&csr_val, sizeof(float) * nnz);

// Get required size of temporary buffer
size_t size;
musparseXhyb2csr_bufferSize(handle,
descr,
hyb,
csr_row_ptr,
&size);

// Allocate temporary buffer
void* buffer;
musaMalloc(&buffer, size);

// Perform the conversion
musparseShyb2csr(handle,
descr,
hyb,
csr_val,
csr_row_ptr,
csr_col_ind,
buffer);

Parameters:

  • musparseHandle_t handle
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb float csr_val muInt csr_row_ptr muInt csr_col_ind void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDhyb2csr

MUSPARSE_EXPORT musparseStatus_t musparseDhyb2csr(musparseHandle_t handle, const musparseMatDescr_t descr, const musparseHybMat_t hyb, double `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb double csr_val muInt csr_row_ptr muInt csr_col_ind void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseChyb2csr

MUSPARSE_EXPORT musparseStatus_t musparseChyb2csr(musparseHandle_t handle, const musparseMatDescr_t descr, const musparseHybMat_t hyb, muComplex `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb muComplex csr_val muInt csr_row_ptr muInt csr_col_ind void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZhyb2csr

MUSPARSE_EXPORT musparseStatus_t musparseZhyb2csr(musparseHandle_t handle, const musparseMatDescr_t descr, const musparseHybMat_t hyb, muDoubleComplex `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind, void `temp_buffer)

Parameters:

  • musparseHandle_t handle
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb muDoubleComplex csr_val muInt csr_row_ptr muInt csr_col_ind void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSbsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseSbsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const float `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt block_dim, const musparseMatDescr_t csr_descr, float `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Convert a sparse BSR matrix into a sparse CSR matrix.

musparseXbsr2csr converts a BSR matrix into a CSR matrix. It is assumed, that csr_val, csr_col_ind and csr_row_ptr are allocated. Allocation size for csr_row_ptr is computed by the number of block rows multiplied by the block dimension plus one. Allocation for csr_val and csr_col_ind is computed by the the number of blocks in the BSR matrix multiplied by the block dimension squared.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: the storage format of the blocks, MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN
  • mb: number of block rows in the sparse BSR matrix.
  • nb: number of block columns in the sparse BSR matrix.
  • bsr_descr: descriptor of the sparse BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb*block_dim*block_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse BSR matrix.
  • block_dim: size of the blocks in the sparse BSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnzb*block_dim*block_dim elements containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 where m=mb*block_dim elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnzb*block_dim*block_dim elements containing the column indices of the sparse CSR matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb or nb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_val, bsr_row_ptr, bsr_col_ind, csr_val, csr_row_ptr or csr_col_ind pointer is invalid.

Example:

This example converts a BSR matrix into an CSR matrix.

// 1 4 0 0 0 0
// A = 0 2 3 0 0 0
// 5 0 0 7 8 0
// 0 0 9 0 6 0

muInt mb = 2;
muInt nb = 3;
muInt block_dim = 2;
muInt m = Mb * block_dim;
muInt n = Nb * block_dim;

bsr_row_ptr[mb+1] = \{0, 2, 5\}; // device memory
bsr_col_ind[nnzb] = \{0, 1, 0, 1, 2\}; // device memory
bsr_val[nnzb`block_dim`block_dim] = \{1, 0, 4, 2, 0, 3, 0, 0, 5, 0, 0, 0,
0, 9, 7, 0, 8, 6, 0, 0\}; // device memory

muInt nnzb = bsr_row_ptr[mb] - bsr_row_ptr[0];

// Create CSR arrays on device
muInt* csr_row_ptr;
muInt* csr_col_ind;
float* csr_val;
musaMalloc((void``)&csr_row_ptr, sizeof(muInt) * (m + 1));
musaMalloc((void``)&csr_col_ind, sizeof(muInt) ` nnzb `
block_dim ` block_dim); musaMalloc((void``)&csr_val, sizeof(float) ` nnzb *
block_dim * block_dim);

// Create musparse handle
musparse_local_handle handle;

musparseMatDescr_t bsr_descr = nullptr;
musparseCreateMatDescr(&bsr_descr);

musparseMatDescr_t csr_descr = nullptr;
musparseCreateMatDescr(&csr_descr);

musparseSetMatIndexBase(bsr_descr, MUSPARSE_INDEX_BASE_ZERO);
musparseSetMatIndexBase(csr_descr, MUSPARSE_INDEX_BASE_ZERO);

// Format conversion
musparseSbsr2csr(handle,
MUSPARSE_DIRECTION_COLUMN,
mb,
nb,
bsr_descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
block_dim,
csr_descr,
csr_val,
csr_row_ptr,
csr_col_ind);

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const float bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t csr_descr float csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDbsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseDbsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const double `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt block_dim, const musparseMatDescr_t csr_descr, double `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const double bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t csr_descr double csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCbsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseCbsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const muComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt block_dim, const musparseMatDescr_t csr_descr, muComplex `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const muComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t csr_descr muComplex csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZbsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseZbsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const muDoubleComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt block_dim, const musparseMatDescr_t csr_descr, muDoubleComplex `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const muDoubleComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t csr_descr muDoubleComplex csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseSgebsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const float `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const musparseMatDescr_t csr_descr, float `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Convert a sparse general BSR matrix into a sparse CSR matrix.

musparseXgebsr2csr converts a BSR matrix into a CSR matrix. It is assumed, that csr_val, csr_col_ind and csr_row_ptr are allocated. Allocation size for csr_row_ptr is computed by the number of block rows multiplied by the block dimension plus one. Allocation for csr_val and csr_col_ind is computed by the the number of blocks in the BSR matrix multiplied by the product of the block dimensions.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: the storage format of the blocks, MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN
  • mb: number of block rows in the sparse general BSR matrix.
  • nb: number of block columns in the sparse general BSR matrix.
  • bsr_descr: descriptor of the sparse general BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_val: array of nnzb*row_block_dim*col_block_dim containing the values of the sparse BSR matrix.
  • bsr_row_ptr: array of mb+1 elements that point to the start of every block row of the sparse BSR matrix.
  • bsr_col_ind: array of nnzb elements containing the block column indices of the sparse BSR matrix.
  • row_block_dim: row size of the blocks in the sparse general BSR matrix.
  • col_block_dim: column size of the blocks in the sparse general BSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_val: array of nnzb*row_block_dim*col_block_dim elements containing the values of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 where m=mb*row_block_dim elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnzb*block_dim*block_dim elements containing the column indices of the sparse CSR matrix.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb or nb or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_val, bsr_row_ptr, bsr_col_ind, csr_val, csr_row_ptr or csr_col_ind pointer is invalid.

Example:

This example converts a general BSR matrix into an CSR matrix.

// 1 4 0 0 0 0
// A = 0 2 3 0 0 0
// 5 0 0 7 8 0
// 0 0 9 0 6 0

muInt mb = 2;
muInt nb = 2;
muInt row_block_dim = 2;
muInt col_block_dim = 3;
muInt m = Mb * row_block_dim;
muInt n = Nb * col_block_dim;

bsr_row_ptr[mb+1] = \{0, 1, 3\}; // device memory
bsr_col_ind[nnzb] = \{0, 0, 1\}; // device memory
bsr_val[nnzb`block_dim`block_dim] = \{1, 0, 4, 2, 0, 3, 5, 0, 0, 0, 0, 9,
7, 0, 8, 6, 0, 0\}; // device memory

muInt nnzb = bsr_row_ptr[mb] - bsr_row_ptr[0];

// Create CSR arrays on device
muInt* csr_row_ptr;
muInt* csr_col_ind;
float* csr_val;
musaMalloc((void``)&csr_row_ptr, sizeof(muInt) * (m + 1));
musaMalloc((void``)&csr_col_ind, sizeof(muInt) ` nnzb `
row_block_dim ` col_block_dim); musaMalloc((void``)&csr_val, sizeof(float) `
nnzb ` row_block_dim ` col_block_dim);

// Create musparse handle
musparse_local_handle handle;

musparseMatDescr_t bsr_descr = nullptr;
musparseCreateMatDescr(&bsr_descr);

musparseMatDescr_t csr_descr = nullptr;
musparseCreateMatDescr(&csr_descr);

musparseSetMatIndexBase(bsr_descr, MUSPARSE_INDEX_BASE_ZERO);
musparseSetMatIndexBase(csr_descr, MUSPARSE_INDEX_BASE_ZERO);

// Format conversion
musparseSgebsr2csr(handle,
MUSPARSE_DIRECTION_COLUMN,
mb,
nb,
bsr_descr,
bsr_val,
bsr_row_ptr,
bsr_col_ind,
row_block_dim,
col_block_dim,
csr_descr,
csr_val,
csr_row_ptr,
csr_col_ind);

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const float bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim
  • const musparseMatDescr_t csr_descr float csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseDgebsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const double `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const musparseMatDescr_t csr_descr, double `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const double bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim
  • const musparseMatDescr_t csr_descr double csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseCgebsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const muComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const musparseMatDescr_t csr_descr, muComplex `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const muComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim
  • const musparseMatDescr_t csr_descr muComplex csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsr2csr

MUSPARSE_EXPORT musparseStatus_t musparseZgebsr2csr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, const musparseMatDescr_t bsr_descr, const muDoubleComplex `bsr_val, const muInt `bsr_row_ptr, const muInt `bsr_col_ind, muInt row_block_dim, muInt col_block_dim, const musparseMatDescr_t csr_descr, muDoubleComplex `csr_val, muInt `csr_row_ptr, muInt `csr_col_ind)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • const musparseMatDescr_t bsr_descr const muDoubleComplex bsr_val const muInt bsr_row_ptr const muInt bsr_col_ind
  • muInt row_block_dim
  • muInt col_block_dim
  • const musparseMatDescr_t csr_descr muDoubleComplex csr_val muInt csr_row_ptr muInt csr_col_ind

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSgebsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const float `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, size_t `buffer_size)

This function computes the the size of the user allocated temporary storage buffer used when converting a sparse general BSR matrix to another sparse general BSR matrix.

musparseXgebsr2gebsr_bufferSize returns the size of the temporary storage buffer that is required by musparseXgebsr2gebsr_nnz(), musparseSgebsr2gebsr(), musparseDgebsr2gebsr(), musparseCgebsr2gebsr(), and musparseZgebsr2gebsr(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: the storage format of the blocks, MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN
  • mb: number of block rows of the general BSR sparse matrix A.
  • nb: number of block columns of the general BSR sparse matrix A.
  • nnzb: number of blocks in the general BSR sparse matrix A.
  • descr_A: the descriptor of the general BSR sparse matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • bsr_val_A: array of nnzb*row_block_dim_A*col_block_dim_A containing the values of the sparse general BSR matrix A.
  • bsr_row_ptr_A: array of mb+1 elements that point to the start of every block row of the sparse general BSR matrix A.
  • bsr_col_ind_A: array of nnzb elements containing the block column indices of the sparse general BSR matrix A.
  • row_block_dim_A: row size of the blocks in the sparse general BSR matrix A.
  • col_block_dim_A: column size of the blocks in the sparse general BSR matrix A.
  • row_block_dim_C: row size of the blocks in the sparse general BSR matrix C.
  • col_block_dim_C: column size of the blocks in the sparse general BSR matrix C.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseXgebsr2gebsr_nnz(), musparseSgebsr2gebsr(), musparseDgebsr2gebsr(), musparseCgebsr2gebsr(), and musparseZgebsr2gebsr().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb or nb or nnzb or row_block_dim_A or col_block_dim_A or row_block_dim_C or col_block_dim_C is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_row_ptr_A or bsr_col_ind_A or descr_A or buffer_size pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const float bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseDgebsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const double `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const double bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseCgebsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const muComplex `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const muComplex bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsr2gebsr_bufferSize_legacy

MUSPARSE_EXPORT musparseStatus_t musparseZgebsr2gebsr_bufferSize_legacy(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const muDoubleComplex `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, muInt row_block_dim_C, muInt col_block_dim_C, size_t `buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const muDoubleComplex bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • muInt row_block_dim_C
  • muInt col_block_dim_C size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSgebsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseSgebsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const float `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, const musparseMatDescr_t descr_C, float `bsr_val_C, muInt `bsr_row_ptr_C, muInt `bsr_col_ind_C, muInt row_block_dim_C, muInt col_block_dim_C, void *temp_buffer)

This function converts the general BSR sparse matrix A to another general BSR sparse matrix C.

The conversion uses three steps. First, the user calls musparse_xgebsr2gebsr_buffer_size() to determine the size of the required temporary storage buffer. The user then allocates this buffer. Secondly, the user then allocates mb_C+1 integers for the row pointer array for C where mb_C=(m+row_block_dim_C-1)/row_block_dim_C. The user then calls musparse_xgebsr2gebsr_nnz() to fill in the row pointer array for C ( bsr_row_ptr_C ) and determine the number of non-zero blocks that will exist in C. Finally, the user allocates space for the colimn indices array of C to have nnzb_C elements and space for the values array of C to have nnzb_C*row_block_dim_C*col_block_dim_C and then calls musparse_xgebsr2gebsr() to complete the conversion.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: the storage format of the blocks, MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN
  • mb: number of block rows of the general BSR sparse matrix A.
  • nb: number of block columns of the general BSR sparse matrix A.
  • nnzb: number of blocks in the general BSR sparse matrix A.
  • descr_A: the descriptor of the general BSR sparse matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • bsr_val_A: array of nnzb*row_block_dim_A*col_block_dim_A containing the values of the sparse general BSR matrix A.
  • bsr_row_ptr_A: array of mb+1 elements that point to the start of every block row of the sparse general BSR matrix A.
  • bsr_col_ind_A: array of nnzb elements containing the block column indices of the sparse general BSR matrix A.
  • row_block_dim_A: row size of the blocks in the sparse general BSR matrix A.
  • col_block_dim_A: column size of the blocks in the sparse general BSR matrix A.
  • descr_C: the descriptor of the general BSR sparse matrix C, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • bsr_val_C: array of nnzb_C*row_block_dim_C*col_block_dim_C containing the values of the sparse general BSR matrix C.
  • bsr_row_ptr_C: array of mb_C+1 elements that point to the start of every block row of the sparse general BSR matrix C.
  • bsr_col_ind_C: array of nnzb_C elements containing the block column indices of the sparse general BSR matrix C.
  • row_block_dim_C: row size of the blocks in the sparse general BSR matrix C.
  • col_block_dim_C: column size of the blocks in the sparse general BSR matrix C.
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xgebsr2gebsr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb or nb or nnzb or row_block_dim_A or col_block_dim_A or row_block_dim_C or col_block_dim_C is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_row_ptr_A or bsr_col_ind_A or bsr_val_A or bsr_row_ptr_C or bsr_col_ind_C or bsr_val_C or descr_A or descr_C or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const float bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • const musparseMatDescr_t descr_C float bsr_val_C muInt bsr_row_ptr_C muInt bsr_col_ind_C
  • muInt row_block_dim_C
  • muInt col_block_dim_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDgebsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseDgebsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const double `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, const musparseMatDescr_t descr_C, double `bsr_val_C, muInt `bsr_row_ptr_C, muInt `bsr_col_ind_C, muInt row_block_dim_C, muInt col_block_dim_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const double bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • const musparseMatDescr_t descr_C double bsr_val_C muInt bsr_row_ptr_C muInt bsr_col_ind_C
  • muInt row_block_dim_C
  • muInt col_block_dim_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCgebsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseCgebsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const muComplex `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, const musparseMatDescr_t descr_C, muComplex `bsr_val_C, muInt `bsr_row_ptr_C, muInt `bsr_col_ind_C, muInt row_block_dim_C, muInt col_block_dim_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const muComplex bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • const musparseMatDescr_t descr_C muComplex bsr_val_C muInt bsr_row_ptr_C muInt bsr_col_ind_C
  • muInt row_block_dim_C
  • muInt col_block_dim_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZgebsr2gebsr

MUSPARSE_EXPORT musparseStatus_t musparseZgebsr2gebsr(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const muDoubleComplex `bsr_val_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, const musparseMatDescr_t descr_C, muDoubleComplex `bsr_val_C, muInt `bsr_row_ptr_C, muInt `bsr_col_ind_C, muInt row_block_dim_C, muInt col_block_dim_C, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const muDoubleComplex bsr_val_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • const musparseMatDescr_t descr_C muDoubleComplex bsr_val_C muInt bsr_row_ptr_C muInt bsr_col_ind_C
  • muInt row_block_dim_C
  • muInt col_block_dim_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScsrcolor

MUSPARSE_EXPORT musparseStatus_t musparseScsrcolor(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const float `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const float `fraction_to_color, muInt `ncolors, muInt `coloring, muInt *reordering, const musparseColorInfo_t info)

Coloring of the adjacency graph of the matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} stored in the CSR format.

musparseXcsrcolor performs the coloring of the undirected graph represented by the (symmetric) sparsity pattern of the matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} stored in CSR format. Graph coloring is a way of coloring the nodes of a graph such that no two adjacent nodes are of the same color. The fraction_to_color is a parameter to only color a given percentage of the graph nodes, the remaining uncolored nodes receive distinct new colors. The optional reordering array is a permutation array such that unknowns of the same color are grouped. The matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} must be stored as a general matrix with a symmetric sparsity pattern, and if the matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} is non-symmetric then the user is responsible to provide the symmetric part formula \{"type":"element","name":"formula","attributes":\{"id":"128"\},"children":[\{"type":"text","text":"$\\frac\{A+A^T\}\{2\}$"\}]\}. Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • nnz: number of non-zero entries of sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • descr: sparse matrix descriptor.
  • csr_val: array of nnz elements of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • fraction_to_color: fraction of nodes to be colored, which should be in the interval [0.0,1.0], for example 0.8 implies that 80 percent of nodes will be colored.
  • ncolors: resulting number of distinct colors.
  • coloring: resulting mapping of colors.
  • reordering: optional resulting reordering permutation if reordering is a non-null pointer.
  • info: structure that holds the information collected during the coloring algorithm.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, csr_val, csr_row_ptr, csr_col_ind, fraction_to_color, ncolors, coloring or info pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const float csr_val const muInt csr_row_ptr const muInt csr_col_ind const float fraction_to_color muInt ncolors muInt coloring muInt reordering
  • const musparseColorInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDcsrcolor

MUSPARSE_EXPORT musparseStatus_t musparseDcsrcolor(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const double `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const double `fraction_to_color, muInt `ncolors, muInt `coloring, muInt *reordering, const musparseColorInfo_t info)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const double csr_val const muInt csr_row_ptr const muInt csr_col_ind const double fraction_to_color muInt ncolors muInt coloring muInt reordering
  • const musparseColorInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCcsrcolor

MUSPARSE_EXPORT musparseStatus_t musparseCcsrcolor(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const float `fraction_to_color, muInt `ncolors, muInt `coloring, muInt *reordering, const musparseColorInfo_t info)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const float fraction_to_color muInt ncolors muInt coloring muInt reordering
  • const musparseColorInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseZcsrcolor

MUSPARSE_EXPORT musparseStatus_t musparseZcsrcolor(musparseHandle_t handle, muInt m, muInt nnz, const musparseMatDescr_t descr, const muDoubleComplex `csr_val, const muInt `csr_row_ptr, const muInt `csr_col_ind, const double `fraction_to_color, muInt `ncolors, muInt `coloring, muInt *reordering, const musparseColorInfo_t info)

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt nnz
  • const musparseMatDescr_t descr const muDoubleComplex csr_val const muInt csr_row_ptr const muInt csr_col_ind const double fraction_to_color muInt ncolors muInt coloring muInt reordering
  • const musparseColorInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Macros

Enumeration types

Enumeration type musparseSpMMOpAlg_t

Definition: musparse-functions.h (line 15084)

enum musparseSpMMOpAlg_t \{
MUSPARSE_SPMM_OP_ALG_DEFAULT
\}

Enumerator MUSPARSE_SPMM_OP_ALG_DEFAULT

Typedefs

Typedef musparseSpSMDescr_t

Definition: musparse-functions.h (line 14859)

typedef struct musparseSpSMDescr* musparseSpSMDescr_t

Return type: struct musparseSpSMDescr *

Typedef musparseSpMMOpPlan_t

Definition: musparse-functions.h (line 15082)

typedef struct musparseSpMMOpPlan* musparseSpMMOpPlan_t

Return type: struct musparseSpMMOpPlan *

Typedef musparseSpGEMMDescr_t

Definition: musparse-functions.h (line 15226)

typedef struct musparseSpGEMMDescr* musparseSpGEMMDescr_t

Return type: struct musparseSpGEMMDescr *

Functions

Function musparseXbsrsv_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXbsrsv_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt *position)

Sparse triangular solve using BSR storage format.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} 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.

注意:musparseXbsrsv_zeroPivot is a blocking function. It might influence performance negatively.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsrsv_clear

MUSPARSE_EXPORT musparseStatus_t musparseXbsrsv_clear(musparseHandle_t handle, musparseMatInfo_t info)

Sparse triangular solve using BSR storage format.

musparseXbsrsv_clear deallocates all memory that was allocated by musparseSbsrsv_analysis(), musparseDbsrsv_analysis(), musparseCbsrsv_analysis() or musparseZbsrsv_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation, e.g. when switching to another sparse matrix format. Calling musparseXbsrsv_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrmv_clear

MUSPARSE_EXPORT musparseStatus_t musparseXcsrmv_clear(musparseHandle_t handle, musparseMatInfo_t info)

Sparse matrix vector multiplication using CSR storage format.

musparseXcsrmv_clear deallocates all memory that was allocated by musparseScsrmv_analysis(), musparseDcsrmv_analysis(), musparseCcsrmv_analysis() or musparseZcsrmv_analysis(). This is especially useful, if memory is an issue and the analysis data is not required anymore for further computation, e.g. when switching to another sparse matrix format.

注意:Calling musparseXcsrmv_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer for the gathered information could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrmv_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXcsrmv_zeroPivot(musparseHandle_t handle, const musparseMatDescr_t descr, musparseMatInfo_t info, muInt *position)

Sparse triangular solve using CSR storage format.

musparseXcsrmv_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseScsrsv_solve(), musparseDcsrsv_solve(), musparseCcsrsv_solve() or musparseZcsrsv_solve() computation. The first zero pivot formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} is stored in position, using same index base as the CSR 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.

注意:musparseXcsrmv_zeroPivot is a blocking function. It might influence performance negatively.

Parameters:

  • handle: handle to the musparse library context queue.
  • descr: descriptor of the sparse CSR matrix.
  • info: structure that holds the information collected during the analysis step.
  • position: pointer to zero pivot formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • const musparseMatDescr_t descr
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrsv_clear

MUSPARSE_EXPORT musparseStatus_t musparseXcsrsv_clear(musparseHandle_t handle, const musparseMatDescr_t descr, musparseMatInfo_t info)

Sparse triangular solve using CSR storage format.

musparseXcsrsv_clear deallocates all memory that was allocated by musparseScsrsv_analysis(), musparseDcsrsv_analysis(), musparseCcsrsv_analysis() or musparseZcsrsv_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation, e.g. when switching to another sparse matrix format. Calling musparseXcsrsv_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • descr: descriptor of the sparse CSR matrix.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • const musparseMatDescr_t descr
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrsm_zeroPivot

MUSPARSE_EXPORT musparseStatus_t musparseXcsrsm_zeroPivot(musparseHandle_t handle, musparseMatInfo_t info, muInt *position)

Sparse triangular system solve using CSR storage format.

musparseXcsrsm_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseScsrsm_solve(), musparseDcsrsm_solve(), musparseCcsrsm_solve() or musparseZcsrsm_solve() computation. The first zero pivot formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} is stored in position, using same index base as the CSR 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.

注意:musparseXcsrsm_zeroPivot is a blocking function. It might influence performance negatively.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrsm_clear

MUSPARSE_EXPORT musparseStatus_t musparseXcsrsm_clear(musparseHandle_t handle, musparseMatInfo_t info)

Sparse triangular system solve using CSR storage format.

musparseXcsrsm_clear deallocates all memory that was allocated by musparseScsrsm_analysis(), musparseDcsrsm_analysis(), musparseCcsrsm_analysis() or musparseZcsrsm_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation, e.g. when switching to another sparse matrix format. Calling musparseXcsrsm_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

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.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} 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.

注意:musparseXbsrsm_zeroPivot is a blocking function. It might influence performance negatively.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsrsm_clear

MUSPARSE_EXPORT musparseStatus_t musparseXbsrsm_clear(musparseHandle_t handle, musparseMatInfo_t info)

Sparse triangular system solve using BSR storage format.

musparseXbsrsm_clear deallocates all memory that was allocated by musparseSbsrsm_analysis(), musparseDbsrsm_analysis(), musparseCbsrsm_analysis() or musparseZbsrsm_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation, e.g. when switching to another sparse matrix format. Calling musparseXbsrsm_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrgeam_nnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsrgeam_nnz(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t descr_A, muInt nnz_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const musparseMatDescr_t descr_C, muInt `csr_row_ptr_C, muInt `nnz_C)

Sparse matrix sparse matrix addition using CSR storage format.

musparseXcsrgeam_nnz computes the total CSR non-zero elements and the CSR row offsets, that point to the start of every row of the sparse CSR matrix, of the resulting matrix C. It is assumed that csr_row_ptr_C has been allocated with size m + 1.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

注意:Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • descr_A: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_A: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr_A: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • descr_B: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_B: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr_B: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_col_ind_B: array of nnz_B elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • descr_C: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • nnz_C: pointer to the number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}. nnz_C can be a host or device pointer.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, nnz_A or nnz_B is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr_A, csr_row_ptr_A, csr_col_ind_A, descr_B, csr_row_ptr_B, csr_col_ind_B, descr_C, csr_row_ptr_C or nnz_C is invalid. ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDmusparseMatrixType_t` != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muInt csr_row_ptr_B const muInt csr_col_ind_B
  • const musparseMatDescr_t descr_C muInt csr_row_ptr_C muInt nnz_C

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrgemm_nnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsrgemm_nnz(musparseHandle_t handle, musparseOperation_t trans_A, musparseOperation_t trans_B, muInt m, muInt n, muInt k, const musparseMatDescr_t descr_A, muInt nnz_A, const muInt `csr_row_ptr_A, const muInt `csr_col_ind_A, const musparseMatDescr_t descr_B, muInt nnz_B, const muInt `csr_row_ptr_B, const muInt `csr_col_ind_B, const musparseMatDescr_t descr_D, muInt nnz_D, const muInt `csr_row_ptr_D, const muInt `csr_col_ind_D, const musparseMatDescr_t descr_C, muInt `csr_row_ptr_C, muInt `nnz_C, const musparseMatInfo_t info_C, void *temp_buffer)

Sparse matrix sparse matrix multiplication using CSR storage format.

musparseXcsrgemm_nnz computes the total CSR non-zero elements and the CSR row offsets, that point to the start of every row of the sparse CSR matrix, of the resulting multiplied matrix C. It is assumed that csr_row_ptr_C has been allocated with size m + 1. The required buffer size can be obtained by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() and musparseZcsrgemm_bufferSize(), respectively.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

注意:Please note, that for matrix products with more than 8192 intermediate products per row, additional temporary storage buffer is allocated by the algorithm.

注意:This function supports unsorted CSR matrices as input, while output will be sorted. Please note that matrices B and D can only be unsorted up to 8192 intermediate products per row. If this number is exceeded, MUSPARSE_EXPORT MUSPARSE_STATUS_REQUIRES_SORTED_STORAGE will be returned.

注意:Currently, only trans_A == trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • trans_B: matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • m: number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • n: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • k: number of columns of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\} and number of rows of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • descr_A: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_A: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • csr_row_ptr_A: array of m+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"28"\},"children":[\{"type":"text","text":"$op(A) == A$"\}]\}, k+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"88"\},"children":[\{"type":"text","text":"$op(A)$"\}]\}.
  • csr_col_ind_A: array of nnz_A elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}.
  • descr_B: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_B: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • csr_row_ptr_B: array of k+1 elements ( formula \{"type":"element","name":"formula","attributes":\{"id":"49"\},"children":[\{"type":"text","text":"$op(B) == B$"\}]\}, m+1 otherwise) that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"47"\},"children":[\{"type":"text","text":"$op(B)$"\}]\}.
  • csr_col_ind_B: array of nnz_B elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}.
  • descr_D: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • nnz_D: number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_row_ptr_D: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • csr_col_ind_D: array of nnz_D elements containing the column indices of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}.
  • descr_C: descriptor of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}. Currenty, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr_C: array of m+1 elements that point to the start of every row of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • nnz_C: pointer to the number of non-zero entries of the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • info_C: structure that holds meta data for the sparse CSR matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseScsrgemm_bufferSize(), musparseDcsrgemm_bufferSize(), musparseCcsrgemm_bufferSize() or musparseZcsrgemm_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n, k, nnz_A, nnz_B or nnz_D is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: descr_A, csr_row_ptr_A, csr_col_ind_A, descr_B, csr_row_ptr_B, csr_col_ind_B, descr_D, csr_row_ptr_D, csr_col_ind_D, descr_C, csr_row_ptr_C, nnz_C, info_C or temp_buffer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR additional buffer for long rows could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans_A != MUSPARSE_OPERATION_NON_TRANSPOSE, trans_B != MUSPARSE_OPERATION_NON_TRANSPOSE, or musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans_A
  • musparseOperation_t trans_B
  • muInt m
  • muInt n
  • muInt k
  • const musparseMatDescr_t descr_A
  • muInt nnz_A const muInt csr_row_ptr_A const muInt csr_col_ind_A
  • const musparseMatDescr_t descr_B
  • muInt nnz_B const muInt csr_row_ptr_B const muInt csr_col_ind_B
  • const musparseMatDescr_t descr_D
  • muInt nnz_D const muInt csr_row_ptr_D const muInt csr_col_ind_D
  • const musparseMatDescr_t descr_C muInt csr_row_ptr_C muInt nnz_C
  • const musparseMatInfo_t info_C void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsric0_zeroPivot

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.

musparseXbsric0_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseSbsric0(), musparseDbsric0(), musparseCbsric0() or musparseZbsric0() computation. The first zero pivot formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} 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.

注意:If a zero pivot is found, position=j means that either the diagonal block A(j,j) is missing (structural zero) or the diagonal block A(j,j) is not positive definite (numerical zero).

注意:musparseXbsric0_zeroPivot is a blocking function. It might influence performance negatively.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsric0_clear

MUSPARSE_EXPORT musparseStatus_t musparseXbsric0_clear(musparseHandle_t handle, musparseMatInfo_t info)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using BSR storage format.

musparseXbsric0_clear deallocates all memory that was allocated by musparseSbsric0_analysis(), musparseDbsric0_analysis(), musparseCbsric0_analysis() or musparseZbsric0_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation.

注意:Calling musparseXbsric0_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

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.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} 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.

注意:If a zero pivot is found, position formula \{"type":"element","name":"formula","attributes":\{"id":"106"\},"children":[\{"type":"text","text":"$=j$"\}]\} means that either the diagonal block formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} is missing (structural zero) or the diagonal block formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} is not invertible (numerical zero).

注意:musparseXbsrilu0_zeroPivot is a blocking function. It might influence performance negatively.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXbsrilu0_clear

MUSPARSE_EXPORT musparseStatus_t musparseXbsrilu0_clear(musparseHandle_t handle, musparseMatInfo_t info)

Incomplete LU factorization with 0 fill-ins and no pivoting using BSR storage format.

musparseXbsrilu0_clear deallocates all memory that was allocated by musparseSbsrilu0_analysis(), musparseDbsrilu0_analysis(), musparseCbsrilu0_analysis() or musparseZbsrilu0_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation.

注意:Calling musparseXbsrilu0_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsric0_zeroPivot

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_csric_zero_pivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseScsric0() or musparseDcsric0() computation. The first zero pivot formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} is stored in position, using same index base as the CSR 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.

注意:musparseXcsric0_zeroPivot is a blocking function. It might influence performance negatively.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsric0_clear

MUSPARSE_EXPORT musparseStatus_t musparseXcsric0_clear(musparseHandle_t handle, musparseMatInfo_t info)

Incomplete Cholesky factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsric0_clear deallocates all memory that was allocated by musparseScsric0_analysis() or musparseDcsric0_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation.

注意:Calling musparseXcsric0_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrilu0_zeroPivot

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.

musparseXcsrilu0_zeroPivot returns MUSPARSE_EXPORT MUSPARSE_STATUS_ZERO_PIVOT, if either a structural or numerical zero has been found during musparseScsrilu0(), musparseDcsrilu0(), musparseCcsrilu0() or musparseZcsrilu0() computation. The first zero pivot formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\} at formula \{"type":"element","name":"formula","attributes":\{"id":"19"\},"children":[\{"type":"text","text":"$A_\{j,j\}$"\}]\} is stored in position, using same index base as the CSR 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.

注意:musparseXcsrilu0_zeroPivot is a blocking function. It might influence performance negatively.

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 formula \{"type":"element","name":"formula","attributes":\{"id":"18"\},"children":[\{"type":"text","text":"$j$"\}]\}, can be in host or device memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info or position pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ZERO_PIVOT zero pivot has been found.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info muInt position

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrilu0_clear

MUSPARSE_EXPORT musparseStatus_t musparseXcsrilu0_clear(musparseHandle_t handle, musparseMatInfo_t info)

Incomplete LU factorization with 0 fill-ins and no pivoting using CSR storage format.

musparseXcsrilu0_clear deallocates all memory that was allocated by musparseScsrilu0_analysis(), musparseDcsrilu0_analysis(), musparseCcsrilu0_analysis() or musparseZcsrilu0_analysis(). This is especially useful, if memory is an issue and the analysis data is not required for further computation.

注意:Calling musparseXcsrilu0_clear is optional. All allocated resources will be cleared, when the opaque musparseMatInfo_t struct is destroyed using musparseDestroyMatInfo().

Parameters:

  • handle: handle to the musparse library context queue.
  • info: structure that holds the information collected during the analysis step.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: info pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR the buffer holding the meta data could not be deallocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • musparseMatInfo_t info

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2coo

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2coo(musparseHandle_t handle, const muInt `csr_row_ptr, muInt nnz, muInt m, muInt `coo_row_ind, musparseIndexBase_t idx_base)

Convert a sparse CSR matrix into a sparse COO matrix.

musparseXcsr2coo converts the CSR array containing the row offsets, that point to the start of every row, into a COO array of row indices.

注意:It can also be used to convert a CSC array containing the column offsets into a COO array of column indices.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • m: number of rows of the sparse CSR matrix.
  • coo_row_ind: array of nnz elements containing the row indices of the sparse COO matrix.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p csr_row_ptr or coo_row_ind pointer is invalid. Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_ARCH_MISMATCH the the device is not supported.

Example:

This example converts a CSR matrix into a COO matrix.

// 1 2 0 3 0
// A = 0 4 5 0 0
// 6 0 0 7 8

muInt m = 3;
muInt n = 5;
muInt nnz = 8;

csr_row_ptr[m+1] = \{0, 3, 5, 8\}; // device memory
csr_col_ind[nnz] = \{0, 1, 3, 1, 2, 0, 3, 4\}; // device memory
csr_val[nnz] = \{1, 2, 3, 4, 5, 6, 7, 8\}; // device memory

// Allocate COO matrix arrays
muInt* coo_row_ind;
muInt* coo_col_ind;
float* coo_val;

musaMalloc((void``)&coo_row_ind, sizeof(muInt) * nnz);
musaMalloc((void``)&coo_col_ind, sizeof(muInt) * nnz);
musaMalloc((void``)&coo_val, sizeof(float) * nnz);

// Convert the csr row offsets into coo row indices
musparseXcsr2coo(handle,
csr_row_ptr,
nnz,
m,
coo_row_ind,
MUSPARSE_INDEX_BASE_ZERO);

// Copy the column and value arrays
musaMemcpy(coo_col_ind,
csr_col_ind,
sizeof(muInt) * nnz,
musaMemcpyDeviceToDevice);

musaMemcpy(coo_val,
csr_val,
sizeof(float) * nnz,
musaMemcpyDeviceToDevice);

Parameters:

  • musparseHandle_t handle const muInt csr_row_ptr
  • muInt nnz
  • muInt m muInt coo_row_ind
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2csc_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2csc_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const muInt `csr_row_ptr, const muInt `csr_col_ind, musparseAction_t copy_values, size_t *buffer_size)

Convert a sparse CSR matrix into a sparse CSC matrix.

musparseXcsr2csc_bufferSize returns the size of the temporary storage buffer required by musparseScsr2csc(), musparseDcsr2csc(), musparseCcsr2csc() and musparseZcsr2csc(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • copy_values: MUSPARSE_ACTION_SYMBOLIC or MUSPARSE_ACTION_NUMERIC.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseScsr2csc(), musparseDcsr2csc(), musparseCcsr2csc() and musparseZcsr2csc().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p csr_row_ptr, csr_col_ind or buffer_size pointer is invalid. * Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const muInt csr_row_ptr const muInt csr_col_ind
  • musparseAction_t copy_values size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2csr2ell_width

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2csr2ell_width(musparseHandle_t handle, muInt m, const musparseMatDescr_t csr_descr, const muInt `csr_row_ptr, const musparseMatDescr_t ell_descr, muInt `ell_width)

Convert a sparse CSR matrix into a sparse ELL matrix.

musparseXcsr2csr2ell_width computes the maximum of the per row non-zero elements over all rows, the ELL width, for a given CSR matrix.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • ell_descr: descriptor of the sparse ELL matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • ell_width: pointer to the number of non-zero elements per row in ELL storage format.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_descr, csr_row_ptr, or ell_width pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • const musparseMatDescr_t csr_descr const muInt csr_row_ptr
  • const musparseMatDescr_t ell_descr muInt ell_width

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2bsr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2bsr_nnz(musparseHandle_t handle, musparseDirection_t dir, muInt m, muInt n, const musparseMatDescr_t csr_descr, const muInt `csr_row_ptr, const muInt `csr_col_ind, muInt block_dim, const musparseMatDescr_t bsr_descr, muInt `bsr_row_ptr, muInt `bsr_nnz)

This function computes the number of nonzero block columns per row and the total number of nonzero blocks in a sparse BSR matrix given a sparse CSR matrix as input.

The routine does support asynchronous execution if the pointer mode is set to device.

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.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr: integer array containing m+1 elements that point to the start of each row of the CSR matrix
  • csr_col_ind: integer array of the column indices for each non-zero element in the CSR matrix
  • block_dim: the block dimension of the BSR matrix. Between 1 and min(m, n)
  • bsr_descr: descriptor of the sparse BSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • bsr_row_ptr: integer array containing mb+1 elements that point to the start of each block row of the BSR matrix
  • bsr_nnz: total number of nonzero elements in device or host memory.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or n or block_dim is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: csr_row_ptr or csr_col_ind or bsr_row_ptr or bsr_nnz pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt m
  • muInt n
  • const musparseMatDescr_t csr_descr const muInt csr_row_ptr const muInt csr_col_ind
  • muInt block_dim
  • const musparseMatDescr_t bsr_descr muInt bsr_row_ptr muInt bsr_nnz

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcoo2csr

MUSPARSE_EXPORT musparseStatus_t musparseXcoo2csr(musparseHandle_t handle, const muInt `coo_row_ind, muInt nnz, muInt m, muInt `csr_row_ptr, musparseIndexBase_t idx_base)

Convert a sparse COO matrix into a sparse CSR matrix.

musparseXcoo2csr converts the COO array containing the row indices into a CSR array of row offsets, that point to the start of every row. It is assumed that the COO row index array is sorted.

注意:It can also be used, to convert a COO array containing the column indices into a CSC array of column offsets, that point to the start of every column. Then, it is assumed that the COO column index array is sorted, instead.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • coo_row_ind: array of nnz elements containing the row indices of the sparse COO matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • m: number of rows of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • idx_base: MUSPARSE_INDEX_BASE_ZERO or MUSPARSE_INDEX_BASE_ONE.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p coo_row_ind or csr_row_ptr pointer is invalid.

Example:

This example converts a COO matrix into a CSR matrix.

// 1 2 0 3 0
// A = 0 4 5 0 0
// 6 0 0 7 8

muInt m = 3;
muInt n = 5;
muInt nnz = 8;

coo_row_ind[nnz] = \{0, 0, 0, 1, 1, 2, 2, 2\}; // device memory
coo_col_ind[nnz] = \{0, 1, 3, 1, 2, 0, 3, 4\}; // device memory
coo_val[nnz] = \{1, 2, 3, 4, 5, 6, 7, 8\}; // device memory

// Allocate CSR matrix arrays
muInt* csr_row_ptr;
muInt* csr_col_ind;
float* csr_val;

musaMalloc((void``)&csr_row_ptr, sizeof(muInt) * (m + 1));
musaMalloc((void``)&csr_col_ind, sizeof(muInt) * nnz);
musaMalloc((void``)&csr_val, sizeof(float) * nnz);

// Convert the coo row indices into csr row offsets
musparseXcoo2csr(handle,
coo_row_ind,
nnz,
m,
csr_row_ptr,
MUSPARSE_INDEX_BASE_ZERO);

// Copy the column and value arrays
musaMemcpy(csr_col_ind,
coo_col_ind,
sizeof(muInt) * nnz,
musaMemcpyDeviceToDevice);

musaMemcpy(csr_val,
coo_val,
sizeof(float) * nnz,
musaMemcpyDeviceToDevice);

Parameters:

  • musparseHandle_t handle const muInt coo_row_ind
  • muInt nnz
  • muInt m muInt csr_row_ptr
  • musparseIndexBase_t idx_base

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsr2ell2csr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseXcsr2ell2csr_nnz(musparseHandle_t handle, muInt m, muInt n, const musparseMatDescr_t ell_descr, muInt ell_width, const muInt `ell_col_ind, const musparseMatDescr_t csr_descr, muInt `csr_row_ptr, muInt *csr_nnz)

Convert a sparse ELL matrix into a sparse CSR matrix.

musparseXcsr2ell2csr_nnz computes the total CSR non-zero elements and the CSR row offsets, that point to the start of every row of the sparse CSR matrix, for a given ELL matrix. It is assumed that csr_row_ptr has been allocated with size m + 1.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse ELL matrix.
  • n: number of columns of the sparse ELL matrix.
  • ell_descr: descriptor of the sparse ELL matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • ell_width: number of non-zero elements per row in ELL storage format.
  • ell_col_ind: array of m times ell_width elements containing the column indices of the sparse ELL matrix.
  • csr_descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_nnz: pointer to the total number of non-zero elements in CSR storage format.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or ell_width is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: ell_descr, ell_col_ind, csr_descr, csr_row_ptr or csr_nnz pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • const musparseMatDescr_t ell_descr
  • muInt ell_width const muInt ell_col_ind
  • const musparseMatDescr_t csr_descr muInt csr_row_ptr muInt csr_nnz

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXhyb2csr_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseXhyb2csr_bufferSize(musparseHandle_t handle, const musparseMatDescr_t descr, const musparseHybMat_t hyb, const muInt `csr_row_ptr, size_t `buffer_size)

Convert a sparse HYB matrix into a sparse CSR matrix.

musparseXhyb2csr_bufferSize returns the size of the temporary storage buffer required by musparseShyb2csr(), musparseDhyb2csr(), musparseChyb2csr() and musparseDhyb2csr(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • descr: descriptor of the sparse HYB matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • hyb: sparse matrix in HYB format.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseShyb2csr(), musparseDhyb2csr(), musparseChyb2csr() and musparseZhyb2csr().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: descr, hyb, csr_row_ptr or buffer_size pointer is invalid. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Parameters:

  • musparseHandle_t handle
  • const musparseMatDescr_t descr
  • const musparseHybMat_t hyb const muInt csr_row_ptr size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseCreateIdentityPermutation

MUSPARSE_EXPORT musparseStatus_t musparseCreateIdentityPermutation(musparseHandle_t handle, muInt n, muInt *p)

Create the identity map.

musparseCreateIdentityPermutation stores the identity map in p, such that formula \{"type":"element","name":"formula","attributes":\{"id":"114"\},"children":[\{"type":"text","text":"$p = 0:1:(n-1)$"\}]\}.

for(i = 0; i < n; ++i)
\{
p[i] = i;
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • n: size of the map p.
  • p: array of n integers containing the map.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: n is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p p pointer is invalid.

Example:

The following example creates an identity permutation.

muInt size = 200;

// Allocate memory to hold the identity map
muInt* perm;
musaMalloc((void``)&perm, sizeof(muInt) * size);

// Fill perm with the identity permutation
musparseCreateIdentityPermutation(handle, size, perm);

Parameters:

  • musparseHandle_t handle
  • muInt n muInt p

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrsort_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseXcsrsort_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const muInt `csr_row_ptr, const muInt `csr_col_ind, size_t *buffer_size)

Sort a sparse CSR matrix.

musparseXcsrsort_bufferSize returns the size of the temporary storage buffer required by musparseXcsrsort(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseXcsrsort().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p csr_row_ptr, csr_col_ind or buffer_size pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const muInt csr_row_ptr const muInt csr_col_ind size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcsrsort

MUSPARSE_EXPORT musparseStatus_t musparseXcsrsort(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const muInt `csr_row_ptr, muInt `csr_col_ind, muInt `perm, void `temp_buffer)

Sort a sparse CSR matrix.

musparseXcsrsort sorts a matrix in CSR format. The sorted permutation vector perm can be used to obtain sorted csr_val array. In this case, perm must be initialized as the identity permutation, see musparseCreateIdentityPermutation().

musparseXcsrsort requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by musparseXcsrsort_bufferSize().

注意:perm can be NULL if a sorted permutation vector is not required.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSR matrix.
  • n: number of columns of the sparse CSR matrix.
  • nnz: number of non-zero entries of the sparse CSR matrix.
  • descr: descriptor of the sparse CSR matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csr_row_ptr: array of m+1 elements that point to the start of every row of the sparse CSR matrix.
  • csr_col_ind: array of nnz elements containing the column indices of the sparse CSR matrix.
  • perm: array of nnz integers containing the unsorted map indices, can be NULL.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseXcsrsort_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csr_row_ptr, csr_col_ind or temp_buffer pointer is invalid. * Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred. ` *
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

The following example sorts a formula \{"type":"element","name":"formula","attributes":\{"id":"115"\},"children":[\{"type":"text","text":"$3 \\times 3$"\}]\} CSR matrix.

// 1 2 3
// A = 4 5 6
// 7 8 9
muInt m = 3;
muInt n = 3;
muInt nnz = 9;

csr_row_ptr[m + 1] = \{0, 3, 6, 9\}; // device memory
csr_col_ind[nnz] = \{2, 0, 1, 0, 1, 2, 0, 2, 1\}; // device memory
csr_val[nnz] = \{3, 1, 2, 4, 5, 6, 7, 9, 8\}; // device memory

// Create permutation vector perm as the identity map
muInt* perm;
musaMalloc((void``)&perm, sizeof(muInt) * nnz);
musparseCreateIdentityPermutation(handle, nnz, perm);

// Allocate temporary buffer
size_t buffer_size;
void* temp_buffer;
musparseXcsrsort_bufferSize(handle, m, n, nnz, csr_row_ptr,
csr_col_ind, &buffer_size); musaMalloc(&temp_buffer, buffer_size);

// Sort the CSR matrix
musparseXcsrsort(handle, m, n, nnz, descr, csr_row_ptr, csr_col_ind,
perm, temp_buffer);

// Gather sorted csr_val array
float* csr_val_sorted;
musaMalloc((void``)&csr_val_sorted, sizeof(float) * nnz);
musparseSgthr(handle, nnz, csr_val, csr_val_sorted, perm,
MUSPARSE_INDEX_BASE_ZERO);

// Clean up
musaFree(temp_buffer);
musaFree(perm);
musaFree(csr_val);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const muInt csr_row_ptr muInt csr_col_ind muInt perm void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcscsort_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseXcscsort_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const muInt `csc_col_ptr, const muInt `csc_row_ind, size_t *buffer_size)

Sort a sparse CSC matrix.

musparseXcscsort_bufferSize returns the size of the temporary storage buffer required by musparseXcscsort(). The temporary storage buffer must be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSC matrix.
  • n: number of columns of the sparse CSC matrix.
  • nnz: number of non-zero entries of the sparse CSC matrix.
  • csc_col_ptr: array of n+1 elements that point to the start of every column of the sparse CSC matrix.
  • csc_row_ind: array of nnz elements containing the row indices of the sparse CSC matrix.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseXcscsort().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p csc_col_ptr, csc_row_ind or buffer_size pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const muInt csc_col_ptr const muInt csc_row_ind size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcscsort

MUSPARSE_EXPORT musparseStatus_t musparseXcscsort(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const musparseMatDescr_t descr, const muInt `csc_col_ptr, muInt `csc_row_ind, muInt `perm, void `temp_buffer)

Sort a sparse CSC matrix.

musparseXcscsort sorts a matrix in CSC format. The sorted permutation vector perm can be used to obtain sorted csc_val array. In this case, perm must be initialized as the identity permutation, see musparseCreateIdentityPermutation().

musparseXcscsort requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by musparseXcscsort_bufferSize().

注意:perm can be NULL if a sorted permutation vector is not required.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse CSC matrix.
  • n: number of columns of the sparse CSC matrix.
  • nnz: number of non-zero entries of the sparse CSC matrix.
  • descr: descriptor of the sparse CSC matrix. Currently, only MUSPARSE_MATRIX_TYPE_GENERAL is supported.
  • csc_col_ptr: array of n+1 elements that point to the start of every column of the sparse CSC matrix.
  • csc_row_ind: array of nnz elements containing the row indices of the sparse CSC matrix.
  • perm: array of nnz integers containing the unsorted map indices, can be NULL.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseXcscsort_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p descr, csc_col_ptr, csc_row_ind or temp_buffer pointer is invalid. * Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred. ` *
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED musparseMatrixType_t != MUSPARSE_MATRIX_TYPE_GENERAL.

Example:

The following example sorts a formula \{"type":"element","name":"formula","attributes":\{"id":"115"\},"children":[\{"type":"text","text":"$3 \\times 3$"\}]\} CSC matrix.

// 1 2 3
// A = 4 5 6
// 7 8 9
muInt m = 3;
muInt n = 3;
muInt nnz = 9;

csc_col_ptr[m + 1] = \{0, 3, 6, 9\}; // device memory
csc_row_ind[nnz] = \{2, 0, 1, 0, 1, 2, 0, 2, 1\}; // device memory
csc_val[nnz] = \{7, 1, 4, 2, 5, 8, 3, 9, 6\}; // device memory

// Create permutation vector perm as the identity map
muInt* perm;
musaMalloc((void``)&perm, sizeof(muInt) * nnz);
musparseCreateIdentityPermutation(handle, nnz, perm);

// Allocate temporary buffer
size_t buffer_size;
void* temp_buffer;
musparseXcscsort_bufferSize(handle, m, n, nnz, csc_col_ptr,
csc_row_ind, &buffer_size); musaMalloc(&temp_buffer, buffer_size);

// Sort the CSC matrix
musparseXcscsort(handle, m, n, nnz, descr, csc_col_ptr, csc_row_ind,
perm, temp_buffer);

// Gather sorted csc_val array
float* csc_val_sorted;
musaMalloc((void``)&csc_val_sorted, sizeof(float) * nnz);
musparseSgthr(handle, nnz, csc_val, csc_val_sorted, perm,
MUSPARSE_INDEX_BASE_ZERO);

// Clean up
musaFree(temp_buffer);
musaFree(perm);
musaFree(csc_val);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz
  • const musparseMatDescr_t descr const muInt csc_col_ptr muInt csc_row_ind muInt perm void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcoosort_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseXcoosort_bufferSize(musparseHandle_t handle, muInt m, muInt n, muInt nnz, const muInt `coo_row_ind, const muInt `coo_col_ind, size_t *buffer_size)

Sort a sparse COO matrix.

coosort_buffer_size returns the size of the temporary storage buffer that is required by musparseXcoosortByRow() and musparseXcoosortByColumn(). The temporary storage buffer has to be allocated by the user.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse COO matrix.
  • n: number of columns of the sparse COO matrix.
  • nnz: number of non-zero entries of the sparse COO matrix.
  • coo_row_ind: array of nnz elements containing the row indices of the sparse COO matrix.
  • coo_col_ind: array of nnz elements containing the column indices of the sparse COO matrix.
  • buffer_size: number of bytes of the temporary storage buffer required by musparseXcoosortByRow() and musparseXcoosortByColumn().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p coo_row_ind, coo_col_ind or buffer_size pointer is invalid. * Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz const muInt coo_row_ind const muInt coo_col_ind size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcoosortByRow

MUSPARSE_EXPORT musparseStatus_t musparseXcoosortByRow(musparseHandle_t handle, muInt m, muInt n, muInt nnz, muInt `coo_row_ind, muInt `coo_col_ind, muInt `perm, void `temp_buffer)

Sort a sparse COO matrix by row.

musparseXcoosortByRow sorts a matrix in COO format by row. The sorted permutation vector perm can be used to obtain sorted coo_val array. In this case, perm must be initialized as the identity permutation, see musparseCreateIdentityPermutation().

musparseXcoosortByRow requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by musparseXcoosort_bufferSize().

注意:perm can be NULL if a sorted permutation vector is not required.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse COO matrix.
  • n: number of columns of the sparse COO matrix.
  • nnz: number of non-zero entries of the sparse COO matrix.
  • coo_row_ind: array of nnz elements containing the row indices of the sparse COO matrix.
  • coo_col_ind: array of nnz elements containing the column indices of the sparse COO matrix.
  • perm: array of nnz integers containing the unsorted map indices, can be NULL.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseXcoosort_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p coo_row_ind, coo_col_ind or temp_buffer pointer is invalid. * Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Example:

The following example sorts a formula \{"type":"element","name":"formula","attributes":\{"id":"115"\},"children":[\{"type":"text","text":"$3 \\times 3$"\}]\} COO matrix by row indices.

// 1 2 3
// A = 4 5 6
// 7 8 9
muInt m = 3;
muInt n = 3;
muInt nnz = 9;

coo_row_ind[nnz] = \{0, 1, 2, 0, 1, 2, 0, 1, 2\}; // device memory
coo_col_ind[nnz] = \{0, 0, 0, 1, 1, 1, 2, 2, 2\}; // device memory
coo_val[nnz] = \{1, 4, 7, 2, 5, 8, 3, 6, 9\}; // device memory

// Create permutation vector perm as the identity map
muInt* perm;
musaMalloc((void``)&perm, sizeof(muInt) * nnz);
musparseCreateIdentityPermutation(handle, nnz, perm);

// Allocate temporary buffer
size_t buffer_size;
void* temp_buffer;
musparseXcoosort_bufferSize(handle,
m,
n,
nnz,
coo_row_ind,
coo_col_ind,
&buffer_size);
musaMalloc(&temp_buffer, buffer_size);

// Sort the COO matrix
musparseXcoosortByRow(handle,
m,
n,
nnz,
coo_row_ind,
coo_col_ind,
perm,
temp_buffer);

// Gather sorted coo_val array
float* coo_val_sorted;
musaMalloc((void``)&coo_val_sorted, sizeof(float) * nnz);
musparseSgthr(handle, nnz, coo_val, coo_val_sorted, perm,
MUSPARSE_INDEX_BASE_ZERO);

// Clean up
musaFree(temp_buffer);
musaFree(perm);
musaFree(coo_val);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz muInt coo_row_ind muInt coo_col_ind muInt perm void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXcoosortByColumn

MUSPARSE_EXPORT musparseStatus_t musparseXcoosortByColumn(musparseHandle_t handle, muInt m, muInt n, muInt nnz, muInt `coo_row_ind, muInt `coo_col_ind, muInt `perm, void `temp_buffer)

Sort a sparse COO matrix by column.

musparseXcoosortByColumn sorts a matrix in COO format by column. The sorted permutation vector perm can be used to obtain sorted coo_val array. In this case, perm must be initialized as the identity permutation, see musparseCreateIdentityPermutation().

musparseXcoosortByColumn requires extra temporary storage buffer that has to be allocated by the user. Storage buffer size can be determined by musparseXcoosort_bufferSize().

注意:perm can be NULL if a sorted permutation vector is not required.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • m: number of rows of the sparse COO matrix.
  • n: number of columns of the sparse COO matrix.
  • nnz: number of non-zero entries of the sparse COO matrix.
  • coo_row_ind: array of nnz elements containing the row indices of the sparse COO matrix.
  • coo_col_ind: array of nnz elements containing the column indices of the sparse COO matrix.
  • perm: array of nnz integers containing the unsorted map indices, can be NULL.
  • temp_buffer: temporary storage buffer allocated by the user, size is returned by musparseXcoosort_bufferSize().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: m, n or nnz is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER:

p coo_row_ind, coo_col_ind or temp_buffer pointer is invalid. * Return values:

  • MUSPARSE_EXPORT: MUSPARSE_STATUS_INTERNAL_ERROR an internal error occurred.

Example:

The following example sorts a formula \{"type":"element","name":"formula","attributes":\{"id":"115"\},"children":[\{"type":"text","text":"$3 \\times 3$"\}]\} COO matrix by column indices.

// 1 2 3
// A = 4 5 6
// 7 8 9
muInt m = 3;
muInt n = 3;
muInt nnz = 9;

coo_row_ind[nnz] = \{0, 0, 0, 1, 1, 1, 2, 2, 2\}; // device memory
coo_col_ind[nnz] = \{0, 1, 2, 0, 1, 2, 0, 1, 2\}; // device memory
coo_val[nnz] = \{1, 2, 3, 4, 5, 6, 7, 8, 9\}; // device memory

// Create permutation vector perm as the identity map
muInt* perm;
musaMalloc((void``)&perm, sizeof(muInt) * nnz);
musparseCreateIdentityPermutation(handle, nnz, perm);

// Allocate temporary buffer
size_t buffer_size;
void* temp_buffer;
musparseXcoosort_bufferSize(handle,
m,
n,
nnz,
coo_row_ind,
coo_col_ind,
&buffer_size);
musaMalloc(&temp_buffer, buffer_size);

// Sort the COO matrix
musparseXcoosortByColumn(handle,
m,
n,
nnz,
coo_row_ind,
coo_col_ind,
perm,
temp_buffer);

// Gather sorted coo_val array
float* coo_val_sorted;
musaMalloc((void``)&coo_val_sorted, sizeof(float) * nnz);
musparseSgthr(handle, nnz, coo_val, coo_val_sorted, perm,
MUSPARSE_INDEX_BASE_ZERO);

// Clean up
musaFree(temp_buffer);
musaFree(perm);
musaFree(coo_val);

Parameters:

  • musparseHandle_t handle
  • muInt m
  • muInt n
  • muInt nnz muInt coo_row_ind muInt coo_col_ind muInt perm void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseXgebsr2gebsr_nnz

MUSPARSE_EXPORT musparseStatus_t musparseXgebsr2gebsr_nnz(musparseHandle_t handle, musparseDirection_t dir, muInt mb, muInt nb, muInt nnzb, const musparseMatDescr_t descr_A, const muInt `bsr_row_ptr_A, const muInt `bsr_col_ind_A, muInt row_block_dim_A, muInt col_block_dim_A, const musparseMatDescr_t descr_C, muInt `bsr_row_ptr_C, muInt row_block_dim_C, muInt col_block_dim_C, muInt `nnz_total_dev_host_ptr, void *temp_buffer)

This function is used when converting a general BSR sparse matrix A to another general BSR sparse matrix C. Specifically, this function determines the number of non-zero blocks that will exist in C (stored using either a host or device pointer), and computes the row pointer array for C.

The routine does support asynchronous execution.

Parameters:

  • handle: handle to the musparse library context queue.
  • dir: the storage format of the blocks, MUSPARSE_DIRECTION_ROW or MUSPARSE_DIRECTION_COLUMN
  • mb: number of block rows of the general BSR sparse matrix A.
  • nb: number of block columns of the general BSR sparse matrix A.
  • nnzb: number of blocks in the general BSR sparse matrix A.
  • descr_A: the descriptor of the general BSR sparse matrix A, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • bsr_row_ptr_A: array of mb+1 elements that point to the start of every block row of the sparse general BSR matrix A.
  • bsr_col_ind_A: array of nnzb elements containing the block column indices of the sparse general BSR matrix A.
  • row_block_dim_A: row size of the blocks in the sparse general BSR matrix A.
  • col_block_dim_A: column size of the blocks in the sparse general BSR matrix A.
  • descr_C: the descriptor of the general BSR sparse matrix C, the supported matrix type is MUSPARSE_MATRIX_TYPE_GENERAL and also any valid value of the musparseIndexBase_t.
  • bsr_row_ptr_C: array of mb_C+1 elements that point to the start of every block row of the sparse general BSR matrix C where mb_C=(m+row_block_dim_C-1)/row_block_dim_C.
  • row_block_dim_C: row size of the blocks in the sparse general BSR matrix C.
  • col_block_dim_C: column size of the blocks in the sparse general BSR matrix C.
  • nnz_total_dev_host_ptr: total number of nonzero blocks in general BSR sparse matrix C stored using device or host memory.
  • temp_buffer: buffer allocated by the user whose size is determined by calling musparse_xgebsr2gebsr_buffer_size().

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_SIZE: mb or nb or nnzb or row_block_dim_A or col_block_dim_A or row_block_dim_C or col_block_dim_C is invalid.
  • MUSPARSE_STATUS_INVALID_POINTER: bsr_row_ptr_A or bsr_col_ind_A or bsr_row_ptr_C or descr_A or descr_C or temp_buffer pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseDirection_t dir
  • muInt mb
  • muInt nb
  • muInt nnzb
  • const musparseMatDescr_t descr_A const muInt bsr_row_ptr_A const muInt bsr_col_ind_A
  • muInt row_block_dim_A
  • muInt col_block_dim_A
  • const musparseMatDescr_t descr_C muInt bsr_row_ptr_C
  • muInt row_block_dim_C
  • muInt col_block_dim_C muInt nnz_total_dev_host_ptr void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseAxpby

MUSPARSE_EXPORT musparseStatus_t musparseAxpby(musparseHandle_t handle, const void `alpha, musparseConstSpVecDescr_t x, const void `beta, musparseDnVecDescr_t y)

Scale a sparse vector and add it to a scaled dense vector.

musparseAxpby multiplies the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} with scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied with scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that

formula \{"type":"element","name":"formula","attributes":\{"id":"116"\},"children":[\{"type":"text","text":"\\[\n y := \\alpha \\cdot x + \\beta \\cdot y\n \\]"\}]\}

for(i = 0; i < nnz; ++i)
\{
y[x_ind[i]] = alpha ` x_val[i] + beta ` y[x_ind[i]]
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • x: sparse matrix descriptor.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: dense matrix descriptor.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, x, beta or y pointer is invalid.

Parameters:

  • musparseHandle_t handle const void alpha
  • musparseConstSpVecDescr_t x const void beta
  • musparseDnVecDescr_t y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseGather

MUSPARSE_EXPORT musparseStatus_t musparseGather(musparseHandle_t handle, const musparseConstDnVecDescr_t y, musparseSpVecDescr_t x)

Gather elements from a dense vector and store them into a sparse vector.

musparseGather gathers the elements from the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} and stores them in the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.

for(i = 0; i < nnz; ++i)
\{
x_val[i] = y[x_ind[i]];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • y: dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}.
  • x: sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: x or y pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • const musparseConstDnVecDescr_t y
  • musparseSpVecDescr_t x

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseScatter

MUSPARSE_EXPORT musparseStatus_t musparseScatter(musparseHandle_t handle, musparseConstSpVecDescr_t x, musparseDnVecDescr_t y)

Scatter elements from a sparse vector into a dense vector.

musparseScatter scatters the elements from the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} in the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}.

for(i = 0; i < nnz; ++i)
\{
y[x_ind[i]] = x_val[i];
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • x: sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: x or y pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • musparseConstSpVecDescr_t x
  • musparseDnVecDescr_t y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseRot

MUSPARSE_EXPORT musparseStatus_t musparseRot(musparseHandle_t handle, const void `c, const void `s, musparseSpVecDescr_t x, musparseDnVecDescr_t y)

Apply Givens rotation to a dense and a sparse vector.

musparseRot applies the Givens rotation matrix formula \{"type":"element","name":"formula","attributes":\{"id":"6"\},"children":[\{"type":"text","text":"$G$"\}]\} to the sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}, where formula \{"type":"element","name":"formula","attributes":\{"id":"7"\},"children":[\{"type":"text","text":"\\[ G = \\begin\{pmatrix\} c\n& s \\\\ -s & c \\end\{pmatrix\} \\]"\}]\}

for(i = 0; i < nnz; ++i)
\{
x_tmp = x_val[i];
y_tmp = y[x_ind[i]];

x_val[i] = c ` x_tmp + s ` y_tmp;
y[x_ind[i]] = c ` y_tmp - s ` x_tmp;
\}

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • c: pointer to the cosine element of formula \{"type":"element","name":"formula","attributes":\{"id":"6"\},"children":[\{"type":"text","text":"$G$"\}]\}, can be on host or device.
  • s: pointer to the sine element of formula \{"type":"element","name":"formula","attributes":\{"id":"6"\},"children":[\{"type":"text","text":"$G$"\}]\}, can be on host or device.
  • x: sparse vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\}.
  • y: dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: c, s, x or y pointer is invalid.

Parameters:

  • musparseHandle_t handle const void c const void s
  • musparseSpVecDescr_t x
  • musparseDnVecDescr_t y

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSparseToDense_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSparseToDense_legacy(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.

musparseSparseToDense musparseSparseToDense performs the conversion of a sparse matrix in CSR, CSC, or COO format to a dense matrix

注意:This function writes the required allocation size (in bytes) to buffer_size and returns without performing the sparse to dense operation, when a nullptr is passed for temp_buffer.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • mat_A: sparse matrix descriptor.
  • mat_B: dense matrix descriptor.
  • alg: algorithm for the sparse to dense computation.
  • buffer_size: number of bytes of the temporary storage buffer. buffer_size is set when temp_buffer is nullptr.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the sparse to dense operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: mat_A, mat_B, or buffer_size pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • const musparseSpMatDescr_t mat_A
  • musparseDnMatDescr_t mat_B
  • musparseSparseToDenseAlg_t alg size_t buffer_size void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDenseToSparse

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.

musparseDenseToSparse musparseDenseToSparse performs the conversion of a dense matrix to a sparse matrix in CSR, CSC, or COO format.

注意:This function writes the required allocation size (in bytes) to buffer_size and returns without performing the dense to sparse operation, when a nullptr is passed for temp_buffer.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • mat_A: dense matrix descriptor.
  • mat_B: sparse matrix descriptor.
  • alg: algorithm for the sparse to dense computation.
  • buffer_size: number of bytes of the temporary storage buffer. buffer_size is set when temp_buffer is nullptr.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the dense to sparse operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: mat_A, mat_B, or buffer_size pointer is invalid.

Parameters:

  • musparseHandle_t handle
  • const musparseDnMatDescr_t mat_A
  • musparseSpMatDescr_t mat_B
  • musparseDenseToSparseAlg_t alg size_t buffer_size void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDenseToSparse_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseDenseToSparse_bufferSize(musparseHandle_t handle, musparseConstDnMatDescr_t matA, musparseSpMatDescr_t matB, musparseDenseToSparseAlg_t alg, size_t *bufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseConstDnMatDescr_t matA
  • musparseSpMatDescr_t matB
  • musparseDenseToSparseAlg_t alg size_t bufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDenseToSparse_analysis

MUSPARSE_EXPORT musparseStatus_t musparseDenseToSparse_analysis(musparseHandle_t handle, musparseConstDnMatDescr_t matA, musparseSpMatDescr_t matB, musparseDenseToSparseAlg_t alg, void *externalBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseConstDnMatDescr_t matA
  • musparseSpMatDescr_t matB
  • musparseDenseToSparseAlg_t alg void externalBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseDenseToSparse_convert

MUSPARSE_EXPORT musparseStatus_t musparseDenseToSparse_convert(musparseHandle_t handle, musparseConstDnMatDescr_t matA, musparseSpMatDescr_t matB, musparseDenseToSparseAlg_t alg, void *externalBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseConstDnMatDescr_t matA
  • musparseSpMatDescr_t matB
  • musparseDenseToSparseAlg_t alg void externalBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpVV_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSpVV_legacy(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.

musparseSpVV computes the inner dot product of the sparse vecotr formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} with the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"117"\},"children":[\{"type":"text","text":"\\[ \\text\{result\} := x^\{'\}\n\\cdot y, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"118"\},"children":[\{"type":"text","text":"\\[ op(x) = \\left\\\{ \\begin\{array\}\{ll\}\n x, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n \\bar\{x\}, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n\\\\ \\end\{array\} \\right. \\]"\}]\}

result = 0;
for(i = 0; i < nnz; ++i)
\{
result += x_val[i] * y[x_ind[i]];
\}

注意:This function writes the required allocation size (in bytes) to buffer_size and returns without performing the SpVV operation, when a nullptr is passed for temp_buffer.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: sparse vector operation type.
  • x: sparse vector descriptor.
  • y: dense vector descriptor.
  • result: pointer to the result, can be host or device memory
  • compute_type: floating point precision for the SpVV computation.
  • buffer_size: number of bytes of the temporary storage buffer. buffer_size is set when temp_buffer is nullptr.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the SpVV operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: x, y, result or buffer_size pointer is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDcompute_type` is currently not supported.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMV_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSpMV_legacy(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, void *temp_buffer)

Sparse matrix vector multiplication.

musparseSpMV multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"25"\},"children":[\{"type":"text","text":"$m\n\\times n$"\}]\} matrix and the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} and adds the result to the dense vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"119"\},"children":[\{"type":"text","text":"\\[\n y := \\alpha \\cdot op(A) \\cdot x + \\beta \\cdot y,\n \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意:This function writes the required allocation size (in bytes) to buffer_size and returns without performing the SpMV operation, when a nullptr is passed for temp_buffer.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • mat: matrix descriptor.
  • x: vector descriptor.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • y: vector descriptor.
  • compute_type: floating point precision for the SpMV computation.
  • alg: SpMV algorithm for the SpMV computation.
  • buffer_size: number of bytes of the temporary storage buffer. buffer_size is set when temp_buffer is nullptr.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the SpMV operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, mat, x, beta, y or buffer_size pointer is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDcompute_typeoralg` is currently not supported.

Parameters:

  • 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 void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMV_legacy_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpMV_legacy_bufferSize(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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMV

MUSPARSE_EXPORT musparseStatus_t musparseSpMV(musparseHandle_t handle, musparseOperation_t trans, const void `alpha, musparseConstSpMatDescr_t mat, musparseConstDnVecDescr_t x, const void `beta, musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpMVAlg_t alg, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const void alpha
  • musparseConstSpMatDescr_t mat
  • musparseConstDnVecDescr_t x const void beta
  • musparseDnVecDescr_t y
  • musparseDataType_t compute_type
  • musparseSpMVAlg_t alg void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMV_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpMV_bufferSize(musparseHandle_t handle, musparseOperation_t trans, const void `alpha, musparseConstSpMatDescr_t mat, musparseConstDnVecDescr_t x, const void `beta, musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpMVAlg_t alg, size_t *buffer_size)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const void alpha
  • musparseConstSpMatDescr_t mat
  • musparseConstDnVecDescr_t x const void beta
  • musparseDnVecDescr_t y
  • musparseDataType_t compute_type
  • musparseSpMVAlg_t alg size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMV_preprocess

MUSPARSE_EXPORT musparseStatus_t musparseSpMV_preprocess(musparseHandle_t handle, musparseOperation_t trans, const void `alpha, musparseConstSpMatDescr_t mat, musparseConstDnVecDescr_t x, const void `beta, const musparseDnVecDescr_t y, musparseDataType_t compute_type, musparseSpMVAlg_t alg, void *temp_buffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t trans const void alpha
  • musparseConstSpMatDescr_t mat
  • musparseConstDnVecDescr_t x const void beta
  • const musparseDnVecDescr_t y
  • musparseDataType_t compute_type
  • musparseSpMVAlg_t alg void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSV

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.

musparse_spsv_solve solves a sparse triangular linear system of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix, defined in CSR or COO storage format, a dense solution vector formula \{"type":"element","name":"formula","attributes":\{"id":"2"\},"children":[\{"type":"text","text":"$y$"\}]\} and the right-hand side formula \{"type":"element","name":"formula","attributes":\{"id":"0"\},"children":[\{"type":"text","text":"$x$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"21"\},"children":[\{"type":"text","text":"\\[ op(A) \\cdot y = \\alpha \\cdot x, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意:SpSV requires three stages to complete. The first stage MUSPARSE_SPSV_STAGE_BUFFER_SIZE will return the size of the temporary storage buffer that is required for subsequent calls. The second stage MUSPARSE_SPSV_STAGE_PREPROCESS will preprocess data that would be saved in the temporary storage buffer. In the final stage MUSPARSE_SPSV_STAGE_COMPUTE, the actual computation is performed.

注意:If MUSPARSE_SPSV_STAGE_AUTO is selected, musparse will automatically detect which stage is required based on the following indicators: If temp_buffer is equal to nullptr, the required buffer size will be returned. If buffer_size is equal to nullptr, analysis will be performed. Otherwise, the SpSV preprocess and the SpSV algorithm will be executed.

注意: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 and trans == MUSPARSE_OPERATION_TRANSPOSE is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans: matrix operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • mat: matrix descriptor.
  • x: vector descriptor.
  • y: vector descriptor.
  • compute_type: floating point precision for the SpSV computation.
  • alg: SpSV algorithm for the SpSV computation.
  • stage: SpSV stage for the SpSV computation.
  • buffer_size: number of bytes of the temporary storage buffer.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the SpSV operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, mat, x, y, descr or buffer_size pointer is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDtrans, compute_type, stageoralg` is currently not supported.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSM

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_spsm_solve solves a sparse triangular linear system of a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"20"\},"children":[\{"type":"text","text":"$m \\times m$"\}]\} matrix, defined in CSR or COO storage format, a dense solution matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} and the right-hand side formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"120"\},"children":[\{"type":"text","text":"\\[ op(A) \\cdot C = \\alpha \\cdot op(B), \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"11"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意:SpSM requires three stages to complete. The first stage MUSPARSE_SPSM_STAGE_BUFFER_SIZE will return the size of the temporary storage buffer that is required for subsequent calls. The second stage MUSPARSE_SPSM_STAGE_PREPROCESS will preprocess data that would be saved in the temporary storage buffer. In the final stage MUSPARSE_SPSM_STAGE_COMPUTE, the actual computation is performed.

注意:If MUSPARSE_SPSM_STAGE_AUTO is selected, musparse will automatically detect which stage is required based on the following indicators: If temp_buffer is equal to nullptr, the required buffer size will be returned. If buffer_size is equal to nullptr, analysis will be performed. Otherwise, the SpSM preprocess and the SpSM algorithm will be executed.

注意: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_NON_TRANSPOSE and trans_A == MUSPARSE_OPERATION_TRANSPOSE is supported. Currently, only trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE and trans_B == MUSPARSE_OPERATION_TRANSPOSE is supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix operation type for the sparse matrix A.
  • trans_B: matrix operation type for the dense matrix B.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • matA: sparse matrix descriptor.
  • matB: dense matrix descriptor.
  • matC: dense matrix descriptor.
  • compute_type: floating point precision for the SpSM computation.
  • alg: SpSM algorithm for the SpSM computation.
  • stage: SpSM stage for the SpSM computation.
  • buffer_size: number of bytes of the temporary storage buffer.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the SpSM operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, matA, matB, matC, descr or buffer_size pointer is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDtrans_A, trans_B, compute_type, stageoralg` is currently not supported.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSM_createDescr

MUSPARSE_EXPORT musparseStatus_t musparseSpSM_createDescr(musparseSpSMDescr_t *descr)

Parameters:

[musparseSpSMDescr\_t](#musparse-functions_8h_1abf5df20836f675d6d1088e20816fcfd1) descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSM_destroyDescr

MUSPARSE_EXPORT musparseStatus_t musparseSpSM_destroyDescr(musparseSpSMDescr_t descr)

Parameters:

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSM_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpSM_bufferSize(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstDnMatDescr_t matB, musparseDnMatDescr_t matC, musaDataType computeType, musparseSpSMAlg_t alg, musparseSpSMDescr_t spsmDescr, size_t `bufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstDnMatDescr_t matB
  • musparseDnMatDescr_t matC
  • musaDataType computeType
  • musparseSpSMAlg_t alg
  • musparseSpSMDescr_t spsmDescr size_t bufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSM_analysis

MUSPARSE_EXPORT musparseStatus_t musparseSpSM_analysis(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstDnMatDescr_t matB, musparseDnMatDescr_t matC, musaDataType computeType, musparseSpSMAlg_t alg, musparseSpSMDescr_t spsmDescr, void `externalBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstDnMatDescr_t matB
  • musparseDnMatDescr_t matC
  • musaDataType computeType
  • musparseSpSMAlg_t alg
  • musparseSpSMDescr_t spsmDescr void externalBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpSM_solve

MUSPARSE_EXPORT musparseStatus_t musparseSpSM_solve(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void *alpha, musparseConstSpMatDescr_t matA, musparseConstDnMatDescr_t matB, musparseDnMatDescr_t matC, musaDataType computeType, musparseSpSMAlg_t alg, musparseSpSMDescr_t spsmDescr)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstDnMatDescr_t matB
  • musparseDnMatDescr_t matC
  • musaDataType computeType
  • musparseSpSMAlg_t alg
  • musparseSpSMDescr_t spsmDescr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMM_ex

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.

musparseSpMM (or musparseSpMM_ex ) multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with a sparse formula \{"type":"element","name":"formula","attributes":\{"id":"90"\},"children":[\{"type":"text","text":"$m \\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, defined in CSR or COO or Blocked ELL storage format, and the dense formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} and adds the result to the dense formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} that is multiplied by the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"121"\},"children":[\{"type":"text","text":"\\[\n C := \\alpha \\cdot op(A) \\cdot op(B) + \\beta \\cdot C,\n \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"81"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意: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_NON_TRANSPOSE is supported for COO and Blocked ELL formats.

注意:Currently, only CSR, COO and Blocked ELL sparse formats are supported.

注意:Different algorithms are available which can provide better performance for different matrices. Currently, the available algorithms are MUSPARSE_SPMM_ALG_CSR, MUSPARSE_SPMM_ALG_CSR_ROW_SPLIT or MUSPARSE_SPMM_ALG_CSR_MERGE for CSR matrices, MUSPARSE_SPMM_ALG_BLOCKED_ELL for Blocked ELL matrices and MUSPARSE_SPMM_ALG_COO_SEGMENTED or MUSPARSE_SPMM_ALG_COO_ATOMIC for COO matrices. Additionally, one can specify the algorithm to be MUSPARSE_SPMM_ALG_DEFAULT. In the case of CSR matrices this will set the algorithm to be MUSPARSE_SPMM_ALG_CSR, in the case of Blocked ELL matrices this will set the algorithm to be MUSPARSE_SPMM_ALG_BLOCKED_ELL and for COO matrices it will set the algorithm to be MUSPARSE_SPMM_ALG_COO_ATOMIC.

注意:This function writes the required allocation size (in bytes) to buffer_size and returns without performing the SpMM operation, when a nullptr is passed for temp_buffer.

注意:SpMM requires three stages to complete. The first stage MUSPARSE_SPMM_STAGE_BUFFER_SIZE will return the size of the temporary storage buffer that is required for subsequent calls to musparseSpMM (or musparseSpMM_ex). The second stage MUSPARSE_SPMM_STAGE_PREPROCESS will preprocess data that would be saved in the temporary storage buffer. In the final stage MUSPARSE_SPMM_STAGE_COMPUTE, the actual computation is performed.

注意:If MUSPARSE_SPMM_STAGE_AUTO is selected, musparse will automatically detect which stage is required based on the following indicators: If temp_buffer is equal to nullptr, the required buffer size will be returned. Else, the SpMM preprocess and the SpMM algorithm will be executed.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: matrix operation type.
  • trans_B: matrix operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • mat_A: matrix descriptor.
  • mat_B: matrix descriptor.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • mat_C: matrix descriptor.
  • compute_type: floating point precision for the SpMM computation.
  • alg: SpMM algorithm for the SpMM computation.
  • stage: SpMM stage for the SpMM computation.
  • buffer_size: number of bytes of the temporary storage buffer. buffer_size is set when temp_buffer is nullptr.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the SpMM operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha, mat_A, mat_B, mat_C, beta, or buffer_size pointer is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDtrans_A, trans_B, compute_typeoralg` is currently not supported.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMM_legacy

MUSPARSE_EXPORT musparseStatus_t musparseSpMM_legacy(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)

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMM_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSpMM_bufferSize(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstDnMatDescr_t matB, const void `beta, musparseDnMatDescr_t matC, musaDataType computeType, musparseSpMMAlg_t alg, size_t *bufferSize)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstDnMatDescr_t matB const void beta
  • musparseDnMatDescr_t matC
  • musaDataType computeType
  • musparseSpMMAlg_t alg size_t bufferSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMM_preprocess

MUSPARSE_EXPORT musparseStatus_t musparseSpMM_preprocess(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstDnMatDescr_t matB, const void `beta, musparseDnMatDescr_t matC, musaDataType computeType, musparseSpMMAlg_t alg, void *externalBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstDnMatDescr_t matB const void beta
  • musparseDnMatDescr_t matC
  • musaDataType computeType
  • musparseSpMMAlg_t alg void externalBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMM

MUSPARSE_EXPORT musparseStatus_t musparseSpMM(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstDnMatDescr_t matB, const void `beta, musparseDnMatDescr_t matC, musaDataType computeType, musparseSpMMAlg_t alg, void *externalBuffer)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstDnMatDescr_t matB const void beta
  • musparseDnMatDescr_t matC
  • musaDataType computeType
  • musparseSpMMAlg_t alg void externalBuffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMMOp_createPlan

MUSPARSE_EXPORT musparseStatus_t musparseSpMMOp_createPlan(musparseHandle_t handle, musparseSpMMOpPlan_t `plan, musparseOperation_t opA, musparseOperation_t opB, musparseConstSpMatDescr_t matA, musparseConstDnMatDescr_t matB, musparseDnMatDescr_t matC, musaDataType computeType, musparseSpMMOpAlg_t alg, const void `addOperationNvvmBuffer, size_t addOperationBufferSize, const void `mulOperationNvvmBuffer, size_t mulOperationBufferSize, const void `epilogueNvvmBuffer, size_t epilogueBufferSize, size_t *SpMMWorkspaceSize)

Parameters:

  • musparseHandle_t handle [musparseSpMMOpPlan\_t](#musparse-functions_8h_1aa9728da5e054f18d4e0b27c19a7c26b9) plan
  • musparseOperation_t opA
  • musparseOperation_t opB
  • musparseConstSpMatDescr_t matA
  • musparseConstDnMatDescr_t matB
  • musparseDnMatDescr_t matC
  • musaDataType computeType
  • musparseSpMMOpAlg_t alg const void addOperationNvvmBuffer
  • size_t addOperationBufferSize const void mulOperationNvvmBuffer
  • size_t mulOperationBufferSize const void epilogueNvvmBuffer
  • size_t epilogueBufferSize size_t SpMMWorkspaceSize

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMMOp

MUSPARSE_EXPORT musparseStatus_t musparseSpMMOp(musparseSpMMOpPlan_t plan, void *externalBuffer)

Parameters:

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpMMOp_destroyPlan

MUSPARSE_EXPORT musparseStatus_t musparseSpMMOp_destroyPlan(musparseSpMMOpPlan_t plan)

Parameters:

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM

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.

musparseSpGEMM multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"90"\},"children":[\{"type":"text","text":"$m \\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} and the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} and adds the result to the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\} that is multiplied by formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}. The final result is stored in the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"122"\},"children":[\{"type":"text","text":"\\[ C := \\alpha \\cdot op(A) \\cdot\nop(B) + \\beta \\cdot D, \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"74"\},"children":[\{"type":"text","text":"\\[ op(A) = \\left\\\{ \\begin\{array\}\{ll\}\n A, & \\text\{if trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if trans_A == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n A^H, & \\text\{if trans_A == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"70"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if trans_B == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n B^H, & \\text\{if trans_B == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE\}\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意:SpGEMM requires three stages to complete. The first stage MUSPARSE_SPGEMM_STAGE_BUFFER_SIZE will return the size of the temporary storage buffer that is required for subsequent calls to musparseSpGEMM. The second stage MUSPARSE_SPGEMM_STAGE_NNZ will determine the number of non-zero elements of the resulting formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} matrix. If the sparsity pattern of formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} is already known, this stage can be skipped. In the final stage MUSPARSE_SPGEMM_STAGE_COMPUTE, the actual computation is performed.

注意:If MUSPARSE_SPGEMM_STAGE_AUTO is selected, musparse will automatically detect which stage is required based on the following indicators: If temp_buffer is equal to nullptr, the required buffer size will be returned. Else, if the number of non-zeros of formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} is zero, the number of non-zero entries will be computed. Else, the SpGEMM algorithm will be executed.

注意:If formula \{"type":"element","name":"formula","attributes":\{"id":"94"\},"children":[\{"type":"text","text":"$\\alpha == 0$"\}]\}, then formula \{"type":"element","name":"formula","attributes":\{"id":"95"\},"children":[\{"type":"text","text":"$C = \\beta \\cdot D$"\}]\} will be computed.

注意:If formula \{"type":"element","name":"formula","attributes":\{"id":"96"\},"children":[\{"type":"text","text":"$\\beta == 0$"\}]\}, then formula \{"type":"element","name":"formula","attributes":\{"id":"123"\},"children":[\{"type":"text","text":"$C = \\alpha \\cdot op(A)\n\\cdot op(B)$"\}]\} will be computed.

注意:If MUSPARSE_SPGEMM_STAGE_SYMBOLIC is selected then the symbolic computation is performed only.

注意:If MUSPARSE_SPGEMM_STAGE_NUMERIC is selected then the numeric computation is performed only.

注意:formula \{"type":"element","name":"formula","attributes":\{"id":"98"\},"children":[\{"type":"text","text":"$\\alpha == beta == 0$"\}]\} is invalid.

注意:It is allowed to pass the same sparse matrix for formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\}, if both matrices have the same sparsity pattern.

注意:Currently, only trans_A == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:Currently, only trans_B == MUSPARSE_OPERATION_NON_TRANSPOSE is supported.

注意:This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.

注意:Please note, that for rare matrix products with more than 4096 non-zero entries per row, additional temporary storage buffer is allocated by the algorithm.

Parameters:

  • handle: handle to the musparse library context queue.
  • trans_A: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • trans_B: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • A: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} descriptor.
  • B: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} descriptor.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • D: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"89"\},"children":[\{"type":"text","text":"$D$"\}]\} descriptor.
  • C: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} descriptor.
  • compute_type: floating point precision for the SpGEMM computation.
  • alg: SpGEMM algorithm for the SpGEMM computation.
  • stage: SpGEMM stage for the SpGEMM computation.
  • buffer_size: number of bytes of the temporary storage buffer. buffer_size is set when temp_buffer is nullptr.
  • temp_buffer: temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size and function returns without performing the SpGEMM operation.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha and beta are invalid, A, B, D, C or buffer_size pointer is invalid. `
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_MEMORY_ERROR additional buffer for long rows could not be allocated.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED trans_A != MUSPARSE_OPERATION_NON_TRANSPOSE or trans_B != MUSPARSE_OPERATION_NON_TRANSPOSE.

Parameters:

  • 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

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM_createDescr

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMM_createDescr(musparseSpGEMMDescr_t *descr)

Parameters:

[musparseSpGEMMDescr\_t](#musparse-functions_8h_1abf2f26d57d9fb437672c1e65a6a744d6) descr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM_destroyDescr

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMM_destroyDescr(musparseSpGEMMDescr_t descr)

Parameters:

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM_workEstimation

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMM_workEstimation(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, const void `beta, musparseSpMatDescr_t matC, musaDataType computeType, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr, size_t `bufferSize1, void `externalBuffer1)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB const void beta
  • musparseSpMatDescr_t matC
  • musaDataType computeType
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr size_t bufferSize1 void externalBuffer1

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM_getNumProducts

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMM_getNumProducts(musparseSpGEMMDescr_t spgemmDescr, int64_t *num_prods)

Parameters:

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM_estimateMemory

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMM_estimateMemory(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, const void `beta, musparseSpMatDescr_t matC, musaDataType computeType, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr, float chunk_fraction, size_t `bufferSize3, void `externalBuffer3, size_t *bufferSize2)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB const void beta
  • musparseSpMatDescr_t matC
  • musaDataType computeType
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr
  • float chunk_fraction size_t bufferSize3 void externalBuffer3 size_t bufferSize2

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM_compute

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMM_compute(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, const void `beta, musparseSpMatDescr_t matC, musaDataType computeType, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr, size_t `bufferSize2, void `externalBuffer2)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB const void beta
  • musparseSpMatDescr_t matC
  • musaDataType computeType
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr size_t bufferSize2 void externalBuffer2

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMM_copy

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMM_copy(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, const void `beta, musparseSpMatDescr_t matC, musaDataType computeType, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB const void beta
  • musparseSpMatDescr_t matC
  • musaDataType computeType
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMMreuse_workEstimation

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMMreuse_workEstimation(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, musparseSpMatDescr_t matC, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr, size_t `bufferSize1, void `externalBuffer1)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB
  • musparseSpMatDescr_t matC
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr size_t bufferSize1 void externalBuffer1

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMMreuse_nnz

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMMreuse_nnz(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, musparseSpMatDescr_t matC, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr, size_t `bufferSize2, void `externalBuffer2, size_t `bufferSize3, void `externalBuffer3, size_t `bufferSize4, void `externalBuffer4)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB
  • musparseSpMatDescr_t matC
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr size_t bufferSize2 void externalBuffer2 size_t bufferSize3 void externalBuffer3 size_t bufferSize4 void externalBuffer4

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMMreuse_copy

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMMreuse_copy(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, musparseSpMatDescr_t matC, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr, size_t `bufferSize5, void `externalBuffer5)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB
  • musparseSpMatDescr_t matC
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr size_t bufferSize5 void externalBuffer5

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSpGEMMreuse_compute

MUSPARSE_EXPORT musparseStatus_t musparseSpGEMMreuse_compute(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, musparseConstSpMatDescr_t matA, musparseConstSpMatDescr_t matB, const void `beta, musparseSpMatDescr_t matC, musaDataType computeType, musparseSpGEMMAlg_t alg, musparseSpGEMMDescr_t spgemmDescr)

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • musparseConstSpMatDescr_t matA
  • musparseConstSpMatDescr_t matB const void beta
  • musparseSpMatDescr_t matC
  • musaDataType computeType
  • musparseSpGEMMAlg_t alg
  • musparseSpGEMMDescr_t spgemmDescr

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSDDMM

MUSPARSE_EXPORT musparseStatus_t musparseSDDMM(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, const musparseDnMatDescr_t A, const musparseDnMatDescr_t B, const void `beta, musparseSpMatDescr_t C, musparseDataType_t compute_type, musparseSDDMMAlg_t alg, void *temp_buffer)

Sampled Dense-Dense Matrix Multiplication.

musparseSDDMM multiplies the scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\} with the dense formula \{"type":"element","name":"formula","attributes":\{"id":"90"\},"children":[\{"type":"text","text":"$m \\times k$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\}, the dense formula \{"type":"element","name":"formula","attributes":\{"id":"38"\},"children":[\{"type":"text","text":"$k \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\}, filtered by the sparsity pattern of the formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} and adds the result to formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} scaled by formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}. The final result is stored in the sparse formula \{"type":"element","name":"formula","attributes":\{"id":"41"\},"children":[\{"type":"text","text":"$m \\times n$"\}]\} matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\}, such that formula \{"type":"element","name":"formula","attributes":\{"id":"124"\},"children":[\{"type":"text","text":"\\[\n C := \\alpha ( opA(A) \\cdot opB(B) ) \\cdot spy(C) + \\beta C,\n \\]"\}]\} with formula \{"type":"element","name":"formula","attributes":\{"id":"125"\},"children":[\{"type":"text","text":"\\[\n op(A) = \\left\\\{\n \\begin\{array\}\{ll\}\n A, & \\text\{if opA == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n A^T, & \\text\{if opA == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n \\end\{array\}\n \\right.\n \\]"\}]\}, formula \{"type":"element","name":"formula","attributes":\{"id":"126"\},"children":[\{"type":"text","text":"\\[\n op(B) = \\left\\\{\n \\begin\{array\}\{ll\}\n B, & \\text\{if opB == MUSPARSE_OPERATION_NON_TRANSPOSE\} \\\\\n B^T, & \\text\{if opB == MUSPARSE_OPERATION_TRANSPOSE\} \\\\\n \\end\{array\}\n \\right.\n \\]"\}]\} and formula \{"type":"element","name":"formula","attributes":\{"id":"127"\},"children":[\{"type":"text","text":"\\[\n spy(C)_ij = \\left\\\{\n \\begin\{array\}\{ll\}\n 1 \\text\{if i == j\}, & 0 \\text\{if i != j\} \\\\\n \\end\{array\}\n \\right.\n \\]"\}]\}

注意:opA == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE is not supported.

注意:opB == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE is not supported.

Parameters:

  • handle: handle to the musparse library context queue.
  • opA: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • opB: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • A: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} descriptor.
  • B: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} descriptor.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • C: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} descriptor.
  • compute_type: floating point precision for the SDDMM computation.
  • alg: specification of the algorithm to use.
  • temp_buffer: temporary storage buffer allocated by the user. The size must be greater or equal to the size obtained with musparseSDDMM_bufferSize.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_VALUE: the value of trans_A, trans_B, compute_type or alg is incorrect.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha and beta are invalid, A, B, D, C or temp_buffer pointer is ```: MUSPARSE_EXPORT MUSPARSE_STATUS_NOT_IMPLEMENTEDopA== MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE oropB` == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • const musparseDnMatDescr_t A
  • const musparseDnMatDescr_t B const void beta
  • musparseSpMatDescr_t C
  • musparseDataType_t compute_type
  • musparseSDDMMAlg_t alg void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSDDMM_bufferSize

MUSPARSE_EXPORT musparseStatus_t musparseSDDMM_bufferSize(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, const musparseDnMatDescr_t A, const musparseDnMatDescr_t B, const void `beta, musparseSpMatDescr_t C, musparseDataType_t compute_type, musparseSDDMMAlg_t alg, size_t *buffer_size)

Calculate the size in bytes of the required buffer for the use of musparseSDDMM and musparseSDDMM_preprocess.

musparseSDDMM_bufferSize returns the size of the required buffer to execute the SDDMM operation from a given configuration. Parameters:

  • handle: handle to the musparse library context queue.
  • opA: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • opB: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • A: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} descriptor.
  • B: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} descriptor.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • C: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} descriptor.
  • compute_type: floating point precision for the SDDMM computation.
  • alg: specification of the algorithm to use.
  • buffer_size: number of bytes of the temporary storage buffer.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_VALUE: the value of trans_A or trans_B is incorrect.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha and beta are invalid, A, B, D, C or buffer_size pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED opA == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or opB == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • const musparseDnMatDescr_t A
  • const musparseDnMatDescr_t B const void beta
  • musparseSpMatDescr_t C
  • musparseDataType_t compute_type
  • musparseSDDMMAlg_t alg size_t buffer_size

Return type: MUSPARSE_EXPORT musparseStatus_t

Function musparseSDDMM_preprocess

MUSPARSE_EXPORT musparseStatus_t musparseSDDMM_preprocess(musparseHandle_t handle, musparseOperation_t opA, musparseOperation_t opB, const void `alpha, const musparseDnMatDescr_t A, const musparseDnMatDescr_t B, const void `beta, musparseSpMatDescr_t C, musparseDataType_t compute_type, musparseSDDMMAlg_t alg, void *temp_buffer)

Preprocess data before the use of musparseSDDMM.

musparseSDDMM_preprocess executes a part of the algorithm that can be calculated once in the context of multiple calls of the musparseSDDMM with the same sparsity pattern. Parameters:

  • handle: handle to the musparse library context queue.
  • opA: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} operation type.
  • opB: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} operation type.
  • alpha: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"1"\},"children":[\{"type":"text","text":"$\\alpha$"\}]\}.
  • A: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"35"\},"children":[\{"type":"text","text":"$A$"\}]\} descriptor.
  • B: dense matrix formula \{"type":"element","name":"formula","attributes":\{"id":"39"\},"children":[\{"type":"text","text":"$B$"\}]\} descriptor.
  • beta: scalar formula \{"type":"element","name":"formula","attributes":\{"id":"9"\},"children":[\{"type":"text","text":"$\\beta$"\}]\}.
  • C: sparse matrix formula \{"type":"element","name":"formula","attributes":\{"id":"42"\},"children":[\{"type":"text","text":"$C$"\}]\} descriptor.
  • compute_type: floating point precision for the SDDMM computation.
  • alg: specification of the algorithm to use.
  • temp_buffer: temporary storage buffer allocated by the user. The size must be greater or equal to the size obtained with musparseSDDMM_bufferSize.

Return values:

  • MUSPARSE_STATUS_SUCCESS: the operation completed successfully.
  • MUSPARSE_STATUS_INVALID_VALUE: the value of trans_A or trans_B is incorrect.
  • MUSPARSE_STATUS_INVALID_HANDLE: the library context was not initialized.
  • MUSPARSE_STATUS_INVALID_POINTER: alpha and beta are invalid, A, B, D, C or temp_buffer pointer is invalid.
  • MUSPARSE_EXPORT: MUSPARSE_STATUS_NOT_IMPLEMENTED opA == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE or opB == MUSPARSE_OPERATION_CONJUGATE_TRANSPOSE.

Parameters:

  • musparseHandle_t handle
  • musparseOperation_t opA
  • musparseOperation_t opB const void alpha
  • const musparseDnMatDescr_t A
  • const musparseDnMatDescr_t B const void beta
  • musparseSpMatDescr_t C
  • musparseDataType_t compute_type
  • musparseSDDMMAlg_t alg void temp_buffer

Return type: MUSPARSE_EXPORT musparseStatus_t