Skip to content

Exported functions

Nico edited this page Sep 25, 2019 · 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_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
rocsparse_Xdoti x x
rocsparse_Xgthr x x
rocsparse_Xgthrz x x
rocsparse_Xroti x x
rocsparse_Xsctr x x

Level 2

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

Level 3

Function single double single complex double complex half
rocsparse_Xcsrmm x x

Extra

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

Preconditioners

Function single double single complex double complex half
rocsparse_Xcsrilu0_buffer_size x x
rocsparse_Xcsrilu0_analysis x x
rocsparse_csrilu0_zero_pivot
rocsparse_csrilu0_clear
rocsparse_Xcsrilu0 x x

Conversion

Function single double single complex double complex half
rocsparse_csr2coo
rocsparse_csr2csc_buffer_size
rocsparse_Xcsr2csc x x
rocsparse_csr2ell_width
rocsparse_Xcsr2ell x x
rocsparse_Xcsr2hyb x x
rocsparse_coo2csr
rocsparse_ell2csr_nnz
rocsparse_Xell2csr 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

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