Skip to content

Exported functions

Nico edited this page Aug 8, 2018 · 10 revisions

Exported sparse BLAS functions

hipSPARSE includes the following auxiliary functions

Function name
hipsparseCreate
hipsparseDestroy
hipsparseGetVersion
hipsparseSetStream
hipsparseGetStream
hipsparseSetPointerMode
hipsparseGetPointerMode
hipsparseCreateMatDescr
hipsparseDestroyMatDescr
hipsparseSetMatIndexBase
hipsparseGetMatIndexBase
hipsparseSetMatType
hipsparseGetMatType
hipsparseCreateHybMatrix
hipsparseDestroyHybMatrix

hipSPARSE includes the following Level 1, 2 and conversion functions

Level 1

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

Level 2

Function single double single complex double complex half
hipsparseXcoomv x x
hipsparseXcsrmv x x
hipsparseXellmv x x
hipsparseXhybmv x x

Level 3

Function single double single complex double complex half
hipsparseXcsrmm x x
hipsparseXcsrmm2 x x

Conversion

Function integer single double single complex double complex half
hipsparseXcsr2coo x
hipsparseXcsr2csc x x
hipsparseXcsr2ellWidth x
hipsparseXcsr2ell x x
hipsparseXcsr2hyb x x
hipsparseXcoo2csr x
hipsparseXell2csrNnz x
hipsparseXell2csr x x
hipsparseCreateIdentityPermutation x
hipsparseXcsrsort_bufferSizeExt x
hipsparseXcsrsort x
hipsparseXcoosort_bufferSizeExt x
hipsparseXcoosortByRow x
hipsparseXcoosortByColumn x

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.

Clone this wiki locally