Skip to content

Exported functions

Nico edited this page Jul 14, 2020 · 10 revisions

Exported sparse BLAS functions

hipSPARSE includes the following auxiliary functions

Function name
hipsparseCreate
hipsparseDestroy
hipsparseGetVersion
hipsparseSetStream
hipsparseGetStream
hipsparseSetPointerMode
hipsparseGetPointerMode
hipsparseCreateMatDescr
hipsparseDestroyMatDescr
hipsparseCopyMatDescr
hipsparseSetMatIndexBase
hipsparseGetMatIndexBase
hipsparseSetMatType
hipsparseGetMatType
hipsparseSetMatFillMode
hipsparseGetMatFillMode
hipsparseSetMatDiagType
hipsparseGetMatDiagType
hipsparseCreateHybMatrix
hipsparseDestroyHybMatrix
hipsparseCreateCsrsv2Info
hipsparseDestroyCsrsv2Info
hipsparseCreateCsrilu02Info
hipsparseDestroyCsrilu02Info

hipSPARSE includes the following Level 1, 2 and conversion functions

Level 1

Function single double single complex double complex half
hipsparseXaxpyi x x x x
hipsparseXdoti x x x x
hipsparseXdotci x x
hipsparseXgthr x x x x
hipsparseXgthrz x x x x
hipsparseXroti x x
hipsparseXsctr x x x x

Level 2

Function single double single complex double complex half
hipsparseXbsrmv x x x x
hipsparseXcsrmv x x x x
hipsparseXcsrsv2_bufferSize x x x x
hipsparseXcsrsv2_bufferSizeExt x x x x
hipsparseXcsrsv2_analysis x x x x
hipsparseXcsrsv2_solve x x x x
hipsparseXhybmv x x x x

Level 3

Function single double single complex double complex half
hipsparseXbsrmm x x x x
hipsparseXcsrmm x x x x
hipsparseXcsrmm2 x x x x
hipsparseXcsrsm2_bufferSizeExt x x x x
hipsparseXcsrsm2_analysis x x x x
hipsparseXcsrsm2_solve x x x x
hipsparseXgemmi x x x x

Extra

Function single double single complex double complex half
hipsparseXcsrgeamNnz
hipsparseXcsrgeam x x x x
hipsparseXcsrgemmNnz
hipsparseXcsrgemm x x x x
hipsparseXcsrgemm2_bufferSizeExt x x x x
hipsparseXcsrgemm2Nnz
hipsparseXcsrgemm2 x x x x

Preconditioners

Function single double single complex double complex half
hipsparseXcsrilu02_bufferSize x x x x
hipsparseXcsrilu02_bufferSizeExt x x x x
hipsparseXcsrilu02_analysis x x x x
hipsparseXcsrilu02 x x x x
hipsparseXcsric02_bufferSize x x x x
hipsparseXcsric02_bufferSizeExt x x x x
hipsparseXcsric02_analysis x x x x
hipsparseXcsric02 x x x x

Conversion

Function single double single complex double complex half
hipsparseXcsr2bsrNnz
hipsparseXcsr2bsr x x x x
hipsparseXbsr2csr x x x x
hipsparseXcsr2coo
hipsparseXcsr2csc x x x x
hipsparseXcsr2hyb x x x x
hipsparseXcoo2csr
hipsparseXhyb2csr x x x x
hipsparseXcsr2dense x x x x
hipsparseXdense2csr x x x x
hipsparseXcsc2dense x x x x
hipsparseXdense2csc x x x x
hipsparseXcsr2csr_compress x x x x
hipsparseXnnz x x x x
hipsparseXnnz_compress x x x x
hipsparseCreateIdentityPermutation
hipsparseXcscsort_bufferSizeExt
hipsparseXcscsort
hipsparseXcsrsort_bufferSizeExt
hipsparseXcsrsort
hipsparseXcoosort_bufferSizeExt
hipsparseXcoosortByRow
hipsparseXcoosortByColumn

Additional notes

  • hipSPARSE supports 0 and 1 based indexing. The index base is selected by hipsparseIndexBase_t type, which is either passed as standalone parameter or part of the hipsparseMatDescr_t type.

  • Dense vectors are represented with a 1D array stored linearly in memory.

  • Sparse vectors are represented with a 1D data array stored linearly in memory that holds all non-zero elements and a 1D indexing array stored linearly in memory that holds the positions of the corresponding non-zero elements.

  • The auxiliary functions hipsparseSetPointer and hipsparseGetPointer are used to set and get the value of the state variable hipsparsePointerMode_t. If hipsparsePointerMode_t == HIPSPARSE_POINTER_MODE_HOST, then scalar parameters must be allocated on the host. If hipsparsePointerMode_t == HIPSPARSE_POINTER_MODE_DEVICE, then scalar parameters must be allocated on the device.

    There are two types of scalar parameter:

    1. Scaling parameters, such as alpha and beta used in e.g. csrmv, coomv, ...
    2. Scalar results from functions such as doti, dotci, ...

    For scalar parameters such as alpha and beta, memory can be allocated on the host heap or stack, when hipsparsePointerMode_t == HIPSPARSE_POINTER_MODE_HOST. The kernel launch is asynchronous, and if the scalar parameter is on the heap, it can be freed after the return from the kernel launch. When hipsparsePointerMode_t == HIPSPARSE_POINTER_MODE_DEVICE, the scalar parameter must not be changed till the kernel completes.

    For scalar results, when hipsparsePointerMode_t == HIPSPARSE_POINTER_MODE_HOST, then the function blocks the CPU till the GPU has copied the result back to the host. Using hipsparsePointerMode_t == HIPSPARSE_POINTER_MODE_DEVICE, the function will return after the asynchronous launch. Similarly to vector and matrix results, the scalar result is only available when the kernel has completed execution.