Skip to content

Exported functions

Nico edited this page May 25, 2020 · 13 revisions

Exported sparse BLAS functions

rocSPARSE includes the following auxiliary functions

Function name
rocsparse_create_handle
rocsparse_destroy_handle
rocsparse_set_stream
rocsparse_get_stream
rocsparse_set_pointer_mode
rocsparse_get_pointer_mode
rocsparse_get_version
rocsparse_get_git_rev
rocsparse_create_mat_descr
rocsparse_copy_mat_descr
rocsparse_destroy_mat_descr
rocsparse_set_mat_index_base
rocsparse_get_mat_index_base
rocsparse_set_mat_type
rocsparse_get_mat_type
rocsparse_set_mat_fill_mode
rocsparse_get_mat_fill_mode
rocsparse_set_mat_diag_type
rocsparse_get_mat_diag_type
rocsparse_create_hyb_matrix
rocsparse_destroy_hyb_matrix
rocsparse_create_mat_info
rocsparse_destroy_mat_info

rocSPARSE includes the following Level 1, 2 and conversion functions

Level 1

Function single double single complex double complex half
rocsparse_Xaxpyi x x x x
rocsparse_Xdoti x x x x
rocsparse_Xdotci x x
rocsparse_Xgthr x x x x
rocsparse_Xgthrz x x x x
rocsparse_Xroti x x
rocsparse_Xsctr x x x x

Level 2

Function single double single complex double complex half
rocsparse_Xbsrmv x x x x
rocsparse_Xcoomv x x x x
rocsparse_Xcsrmv_analysis x x x x
rocsparse_csrmv_clear
rocsparse_Xcsrmv x x x x
rocsparse_Xcsrsv_buffer_size x x x x
rocsparse_Xcsrsv_analysis x x x x
rocsparse_csrsv_zero_pivot
rocsparse_csrsv_clear
rocsparse_Xcsrsv_solve x x x x
rocsparse_Xellmv x x x x
rocsparse_Xhybmv x x x x

Level 3

Function single double single complex double complex half
rocsparse_Xcsrmm x x x x
rocsparse_Xcsrsm_buffer_size x x x x
rocsparse_Xcsrsm_analysis x x x x
rocsparse_csrsm_zero_pivot
rocsparse_csrsm_clear
rocsparse_csrsm_solve x x x x

Extra

Function single double single complex double complex half
rocsparse_csrgeam_nnz
rocsparse_Xcsrgeam x x x x
rocsparse_Xcsrgemm_buffer_size x x x x
rocsparse_csrgemm_nnz
rocsparse_Xcsrgemm x x x x

Preconditioners

Function single double single complex double complex half
rocsparse_Xcsrilu0_buffer_size x x x x
rocsparse_Xcsrilu0_analysis x x x x
rocsparse_csrilu0_zero_pivot
rocsparse_csrilu0_clear
rocsparse_Xcsrilu0 x x x x
rocsparse_Xcsric0_buffer_size x x x x
rocsparse_Xcsric0_analysis x x x x
rocsparse_csric0_zero_pivot
rocsparse_csric0_clear
rocsparse_Xcsric0 x x x x

Conversion

Function single double single complex double complex half
rocsparse_csr2coo
rocsparse_csr2csc_buffer_size
rocsparse_Xcsr2csc x x x x
rocsparse_csr2ell_width
rocsparse_Xcsr2ell x x x x
rocsparse_Xcsr2hyb x x x x
rocsparse_csr2bsr_nnz
rocsparse_Xcsr2bsr x x x x
rocsparse_coo2csr
rocsparse_ell2csr_nnz
rocsparse_Xell2csr x x x x
rocsparse_Xhyb2csr_buffer_size x x x x
rocsparse_Xhyb2csr x x x x
rocsparse_Xbsr2csr x x x x
rocsparse_Xcsr2csr_compress x x x x
rocsparse_create_identity_permutation
rocsparse_cscsort_buffer_size
rocsparse_cscsort
rocsparse_csrsort_buffer_size
rocsparse_csrsort
rocsparse_coosort_buffer_size
rocsparse_coosort_by_row
rocsparse_coosort_by_column
rocsparse_Xdense2csr x x x x
rocsparse_Xdense2csc x x x x
rocsparse_Xcsr2dense x x x x
rocsparse_Xcsc2dense x x x x
rocsparse_Xnnz_compress x x x x
rocsparse_Xnnz x x x x

Additional notes

  • The rocSPARSE library is LP64, so rocsparse_int arguments are 32 bit and rocsparse_long arguments are 64 bit.

  • rocSPARSE supports 0 and 1 based indexing. The index base is selected by rocsparse_index_base type which is either passed as standalone parameter or part of the rocsparse_mat_descr 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 rocsparse_set_pointer and rocsparse_get_pointer are used to set and get the value of the state variable rocsparse_pointer_mode. If rocsparse_pointer_mode == rocsparse_pointer_mode_host, then scalar parameters must be allocated on the host. If rocsparse_pointer_mode == rocsparse_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 rocsparse_pointer_mode == rocsparse_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 rocsparse_pointer_mode == rocsparse_pointer_mode_device, the scalar parameter must not be changed till the kernel completes.

    For scalar results, when rocsparse_pointer_mode == rocsparse_pointer_mode_host, then the function blocks the CPU till the GPU has copied the result back to the host. Using rocsparse_pointer_mode == rocsparse_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