Skip to content

Exported functions

Nico edited this page Jul 19, 2018 · 13 revisions

Exported sparse BLAS functions

rocSPARSE includes the following auxiliary functions

Function name
rocsparse_create_handle
rocsparse_destroy_handle
rocsparse_add_stream
rocsparse_set_stream
rocsparse_get_stream
rocsparse_set_pointer_mode
rocsparse_get_pointer_mode
rocsparse_get_version
rocsparse_create_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_create_hyb_matrix
rocsparse_destroy_hyb_matrix

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 x x
rocsparse_Xellmv x x
rocsparse_Xhybmv x x

Conversion

Function integer single double single complex double complex half
rocsparse_csr2coo x
rocsparse_csr2csc_buffer_size x
rocsparse_Xcsr2csc x x
rocsparse_csr2ell_width x
rocsparse_Xcsr2ell x x
rocsparse_Xcsr2hyb x x
rocsparse_coo2csr x
rocsparse_create_identity_permutation x
rocsparse_csrsort_buffer_size x
rocsparse_csrsort x
rocsparse_coosort_buffer_size x
rocsparse_coosort_by_row x
rocsparse_coosort_by_column 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