rocSPARSE is a library that contains basic linear algebra subroutines for sparse matrices and vectors written in HiP for GPU devices. It is designed to be used from C and C++ code. The functionality of rocSPARSE is organized in the following categories:
rocsparse_auxiliary_functions_
describe available helper functions that are required for subsequent library calls.rocsparse_level1_functions_
describe operations between a vector in sparse format and a vector in dense format.rocsparse_level2_functions_
describe operations between a matrix in sparse format and a vector in dense format.rocsparse_level3_functions_
describe operations between a matrix in sparse format and multiple vectors in dense format.rocsparse_extra_functions_
describe operations that manipulate sparse matrices.rocsparse_precond_functions_
describe manipulations on a matrix in sparse format to obtain a preconditioner.rocsparse_conversion_functions_
describe operations on a matrix in sparse format to obtain a different matrix format.rocsparse_reordering_functions_
describe operations on a matrix in sparse format to obtain a reordering.
The code is open and hosted here: https://github.com/ROCmSoftwarePlatform/rocSPARSE
rocSPARSE requires a ROCm enabled platform, more information here.
rocSPARSE can be installed from AMD ROCm repository. For detailed instructions on how to set up ROCm on different platforms, see the AMD ROCm Platform Installation Guide for Linux.
rocSPARSE can be installed on e.g. Ubuntu using
$ sudo apt-get update
$ sudo apt-get install rocsparse
Once installed, rocSPARSE can be used just like any other library with a C API. The header file will need to be included in the user code in order to make calls into rocSPARSE, and the rocSPARSE shared library will become link-time and run-time dependent for the user application.
Building from source is not necessary, as rocSPARSE can be used after installing the pre-built packages as described above. If desired, the following instructions can be used to build rocSPARSE from source. Furthermore, the following compile-time dependencies must be met
- git
- CMake 3.5 or later
- AMD ROCm
- rocPRIM
- googletest (optional, for clients)
The rocSPARSE source code is available at the rocSPARSE GitHub page. Download the master branch using:
$ git clone -b master https://github.com/ROCmSoftwarePlatform/rocSPARSE.git
$ cd rocSPARSE
Below are steps to build different packages of the library, including dependencies and clients. It is recommended to install rocSPARSE using the install.sh script.
The following table lists common uses of install.sh to build dependencies + library.
X{5}{6}|
Command | Description |
---|---|
./install.sh -h | Print help information. |
./install.sh -d | Build dependencies and library in your local directory. The -d flag only needs to be used once. For subsequent invocations of install.sh it is not necessary to rebuild the dependencies. |
./install.sh | Build library in your local directory. It is assumed dependencies are available. |
./install.sh -i | Build library, then build and install rocSPARSE package in /opt/rocm/rocsparse. You will be prompted for sudo access. This will install for all users. |
The client contains example code, unit tests and benchmarks. Common uses of install.sh to build them are listed in the table below.
X{5}{6}|
Command | Description |
---|---|
./install.sh -h | Print help information. |
./install.sh -dc | Build dependencies, library and client in your local directory. The -d flag only needs to be used once. For subsequent invocations of install.sh it is not necessary to rebuild the dependencies. |
./install.sh -c | Build library and client in your local directory. It is assumed dependencies are available. |
./install.sh -idc | Build library, dependencies and client, then build and install rocSPARSE package in /opt/rocm/rocsparse. You will be prompted for sudo access. This will install for all users. |
./install.sh -ic | Build library and client, then build and install rocSPARSE package in opt/rocm/rocsparse. You will be prompted for sudo access. This will install for all users. |
CMake 3.5 or later is required in order to build rocSPARSE. The rocSPARSE library contains both, host and device code, therefore the HIP compiler must be specified during cmake configuration process.
rocSPARSE can be built using the following commands:
# Create and change to build directory
$ mkdir -p build/release ; cd build/release
# Default install path is /opt/rocm, use -DCMAKE_INSTALL_PREFIX=<path> to adjust it
$ CXX=/opt/rocm/bin/hipcc cmake ../..
# Compile rocSPARSE library
$ make -j$(nproc)
# Install rocSPARSE to /opt/rocm
$ make install
GoogleTest is required in order to build rocSPARSE clients.
rocSPARSE with dependencies and clients can be built using the following commands:
# Install googletest
$ mkdir -p build/release/deps ; cd build/release/deps
$ cmake ../../../deps
$ make -j$(nproc) install
# Change to build directory
$ cd ..
# Default install path is /opt/rocm, use -DCMAKE_INSTALL_PREFIX=<path> to adjust it
$ CXX=/opt/rocm/bin/hipcc cmake ../.. -DBUILD_CLIENTS_TESTS=ON \
-DBUILD_CLIENTS_BENCHMARKS=ON \
-DBUILD_CLIENTS_SAMPLES=ON
# Compile rocSPARSE library
$ make -j$(nproc)
# Install rocSPARSE to /opt/rocm
$ make install
Issue: Could not find a package configuration file provided by "ROCM" with any of the following names: ROCMConfig.cmake, rocm-config.cmake
Solution: Install ROCm cmake modules
You can test the installation by running one of the rocSPARSE examples, after successfully compiling the library with clients.
# Navigate to clients binary directory
$ cd rocSPARSE/build/release/clients/staging
# Execute rocSPARSE example
$ ./example_csrmv 1000
Currently, rocSPARSE is supported under the following operating systems
To compile and run rocSPARSE, AMD ROCm Platform is required.
The following HIP capable devices are currently supported
- gfx803 (e.g. Fiji)
- gfx900 (e.g. Vega10, MI25)
- gfx906 (e.g. Vega20, MI50, MI60)
- gfx908
:cpphipSetDevice
and :cpphipGetDevice
are HIP device management APIs. They are NOT part of the rocSPARSE API.
All rocSPARSE library functions, unless otherwise stated, are non blocking and executed asynchronously with respect to the host. They may return before the actual computation has finished. To force synchronization, :cpphipDeviceSynchronize
or :cpphipStreamSynchronize
can be used. This will ensure that all previously executed rocSPARSE functions on the device / this particular stream have completed.
Before a HIP kernel invocation, users need to call :cpphipSetDevice
to set a device, e.g. device 1. If users do not explicitly call it, the system by default sets it as device 0. Unless users explicitly call :cpphipSetDevice
to set to another device, their HIP kernels are always launched on device 0.
The above is a HIP (and CUDA) device management approach and has nothing to do with rocSPARSE. rocSPARSE honors the approach above and assumes users have already set the device before a rocSPARSE routine call.
Once users set the device, they create a handle with rocsparse_create_handle_
.
Subsequent rocSPARSE routines take this handle as an input parameter. rocSPARSE ONLY queries (by :cpphipGetDevice
) the user's device; rocSPARSE does NOT set the device for users. If rocSPARSE does not see a valid device, it returns an error message. It is the users' responsibility to provide a valid device to rocSPARSE and ensure the device safety.
Users CANNOT switch devices between rocsparse_create_handle_
and rocsparse_destroy_handle_
. If users want to change device, they must destroy the current handle and create another rocSPARSE handle.
HIP kernels are always launched in a queue (also known as stream).
If users do not explicitly specify a stream, the system provides a default stream, maintained by the system. Users cannot create or destroy the default stream. However, users can freely create new streams (with :cpphipStreamCreate
) and bind it to the rocSPARSE handle using rocsparse_set_stream_
. HIP kernels are invoked in rocSPARSE routines. The rocSPARSE handle is always associated with a stream, and rocSPARSE passes its stream to the kernels inside the routine. One rocSPARSE routine only takes one stream in a single invocation. If users create a stream, they are responsible for destroying it.
If the system under test has multiple HIP devices, users can run multiple rocSPARSE handles concurrently, but can NOT run a single rocSPARSE handle on different discrete devices. Each handle is associated with a particular singular device, and a new handle should be created for each additional device.
The Coordinate (COO) storage format represents a m × n matrix by
m | number of rows (integer). |
n | number of columns (integer). |
nnz | number of non-zero elements (integer). |
coo_val | array of nnz elements containing the data (floating point). |
coo_row_ind | array of nnz elements containing the row indices (integer). |
coo_col_ind | array of nnz elements containing the column indices (integer). |
The COO matrix is expected to be sorted by row indices and column indices per row. Furthermore, each pair of indices should appear only once. Consider the following 3 × 5 matrix and the corresponding COO structures, with m = 3, n = 5 and nnz = 8 using zero based indexing:
where
The Coordinate (COO) Array of Structure (AoS) storage format represents a m × n matrix by
m |
|
n |
|
nnz |
|
coo_val |
|
coo_ind |
|
The COO (AoS) matrix is expected to be sorted by row indices and column indices per row. Furthermore, each pair of indices should appear only once. Consider the following 3 × 5 matrix and the corresponding COO (AoS) structures, with m = 3, n = 5 and nnz = 8 using zero based indexing:
where
The Compressed Sparse Row (CSR) storage format represents a m × n matrix by
m | number of rows (integer). |
n | number of columns (integer). |
nnz | number of non-zero elements (integer). |
csr_val | array of nnz elements containing the data (floating point). |
csr_row_ptr | array of m+1 elements that point to the start of every row (integer). |
csr_col_ind | array of nnz elements containing the column indices (integer). |
The CSR matrix is expected to be sorted by column indices within each row. Furthermore, each pair of indices should appear only once. Consider the following 3 × 5 matrix and the corresponding CSR structures, with m = 3, n = 5 and nnz = 8 using one based indexing:
where
The Block Compressed Sparse Row (BSR) storage format represents a (mb ⋅ bsr_dim) × (nb ⋅ bsr_dim) matrix by
mb | number of block rows (integer) |
nb | number of block columns (integer) |
nnzb | number of non-zero blocks (integer) |
bsr_val | array of nnzb * bsr_dim * bsr_dim elements containing the data (floating point). Blocks can be stored column-major or row-major. |
bsr_row_ptr | array of mb+1 elements that point to the start of every block row (integer). |
bsr_col_ind | array of nnzb elements containing the block column indices (integer). |
bsr_dim | dimension of each block (integer). |
The BSR matrix is expected to be sorted by column indices within each row. If m or n are not evenly divisible by the block dimension, then zeros are padded to the matrix, such that mb = (m + bsr_dim − 1)/bsr_dim and nb = (n + bsr_dim − 1)/bsr_dim. Consider the following 4 × 3 matrix and the corresponding BSR structures, with bsr_dim = 2, mb = 2, nb = 2 and nnzb = 4 using zero based indexing and column-major storage:
with the blocks Aij
such that
with arrays representation
The General Block Compressed Sparse Row (GEBSR) storage format represents a (mb ⋅ bsr_row_dim) × (nb ⋅ bsr_col_dim) matrix by
mb | number of block rows (integer) |
nb | number of block columns (integer) |
nnzb | number of non-zero blocks (integer) |
bsr_val | array of nnzb * bsr_row_dim * bsr_col_dim elements containing the data (floating point). Blocks can be stored column-major or row-major. |
bsr_row_ptr | array of mb+1 elements that point to the start of every block row (integer). |
bsr_col_ind | array of nnzb elements containing the block column indices (integer). |
bsr_row_dim | row dimension of each block (integer). |
bsr_col_dim | column dimension of each block (integer). |
The GEBSR matrix is expected to be sorted by column indices within each row. If m is not evenly divisible by the row block dimension or n is not evenly divisible by the column block dimension, then zeros are padded to the matrix, such that mb = (m + bsr_row_dim − 1)/bsr_row_dim and nb = (n + bsr_col_dim − 1)/bsr_col_dim. Consider the following 4 × 5 matrix and the corresponding GEBSR structures, with bsr_row_dim = 2, bsr_col_dim = 3, mb = 2, nb = 2` and nnzb = 4 using zero based indexing and column-major storage:
with the blocks Aij
such that
with arrays representation
The Ellpack-Itpack (ELL) storage format represents a m × n matrix by
m | number of rows (integer). |
n | number of columns (integer). |
ell_width | maximum number of non-zero elements per row (integer) |
ell_val | array of m times ell_width elements containing the data (floating point). |
ell_col_ind | array of m times ell_width elements containing the column indices (integer). |
The ELL matrix is assumed to be stored in column-major format. Rows with less than ell_width
non-zero elements are padded with zeros (ell_val
) and − 1 (ell_col_ind
). Consider the following 3 × 5 matrix and the corresponding ELL structures, with m = 3, n = 5 and ell_width = 3 using zero based indexing:
where
The Hybrid (HYB) storage format represents a m × n matrix by
m | number of rows (integer). |
n | number of columns (integer). |
nnz | number of non-zero elements of the COO part (integer) |
ell_width | maximum number of non-zero elements per row of the ELL part (integer) |
ell_val | array of m times ell_width elements containing the ELL part data (floating point). |
ell_col_ind | array of m times ell_width elements containing the ELL part column indices (integer). |
coo_val | array of nnz elements containing the COO part data (floating point). |
coo_row_ind | array of nnz elements containing the COO part row indices (integer). |
coo_col_ind | array of nnz elements containing the COO part column indices (integer). |
The HYB format is a combination of the ELL and COO sparse matrix formats. Typically, the regular part of the matrix is stored in ELL storage format, and the irregular part of the matrix is stored in COO storage format. Three different partitioning schemes can be applied when converting a CSR matrix to a matrix in HYB storage format. For further details on the partitioning schemes, see rocsparse_hyb_partition_
.
rocsparse_handle
rocsparse_mat_descr
rocsparse_mat_info
rocsparse_hyb_mat
For more details on the HYB format, see HYB storage format
.
rocsparse_action
rocsparse_hyb_partition
rocsparse_index_base
rocsparse_matrix_type
rocsparse_fill_mode
rocsparse_diag_type
rocsparse_operation
rocsparse_pointer_mode
rocsparse_analysis_policy
rocsparse_solve_policy
rocsparse_layer_mode
For more details on logging, see rocsparse_logging
.
rocsparse_status
rocsparse_indextype
rocsparse_datatype
rocsparse_format
rocsparse_spmv_alg
rocsparse_spsv_alg
rocsparse_spsv_stage
rocsparse_spsm_alg
rocsparse_spsm_stage
rocsparse_spmm_alg
rocsparse_spmm_stage
rocsparse_sddmm_alg
rocsparse_spgemm_stage
rocsparse_spgemm_alg
rocsparse_sparse_to_dense_alg
rocsparse_dense_to_sparse_alg
rocsparse_gtsv_interleaved_alg
Three different environment variables can be set to enable logging in rocSPARSE: ROCSPARSE_LAYER
, ROCSPARSE_LOG_TRACE_PATH
and ROCSPARSE_LOG_BENCH_PATH
.
ROCSPARSE_LAYER
is a bit mask, where several logging modes (rocsparse_layer_mode_
) can be combined as follows:
ROCSPARSE_LAYER unset |
logging is disabled. |
ROCSPARSE_LAYER set to 1 |
trace logging is enabled. |
ROCSPARSE_LAYER set to 2 |
bench logging is enabled. |
ROCSPARSE_LAYER set to 3 |
trace logging and bench logging is enabled. |
When logging is enabled, each rocSPARSE function call will write the function name as well as function arguments to the logging stream. The default logging stream is stderr
.
If the user sets the environment variable ROCSPARSE_LOG_TRACE_PATH
to the full path name for a file, the file is opened and trace logging is streamed to that file. If the user sets the environment variable ROCSPARSE_LOG_BENCH_PATH
to the full path name for a file, the file is opened and bench logging is streamed to that file. If the file cannot be opened, logging output is stream to stderr
.
Note that performance will degrade when logging is enabled. By default, the environment variable ROCSPARSE_LAYER
is unset and logging is disabled.
Function name |
:cpprocsparse_create_handle |
:cpprocsparse_destroy_handle |
:cpprocsparse_set_stream |
:cpprocsparse_get_stream |
:cpprocsparse_set_pointer_mode |
:cpprocsparse_get_pointer_mode |
:cpprocsparse_get_version |
:cpprocsparse_get_git_rev |
:cpprocsparse_create_mat_descr |
:cpprocsparse_destroy_mat_descr |
:cpprocsparse_copy_mat_descr |
:cpprocsparse_set_mat_index_base |
:cpprocsparse_get_mat_index_base |
:cpprocsparse_set_mat_type |
:cpprocsparse_get_mat_type |
:cpprocsparse_set_mat_fill_mode |
:cpprocsparse_get_mat_fill_mode |
:cpprocsparse_set_mat_diag_type |
:cpprocsparse_get_mat_diag_type |
:cpprocsparse_create_hyb_mat |
:cpprocsparse_destroy_hyb_mat |
:cpprocsparse_create_mat_info |
:cpprocsparse_copy_mat_info |
:cpprocsparse_destroy_mat_info |
:cpprocsparse_create_spvec_descr |
:cpprocsparse_destroy_spvec_descr |
:cpprocsparse_spvec_get |
:cpprocsparse_spvec_get_index_base |
:cpprocsparse_spvec_get_values |
:cpprocsparse_spvec_set_values |
:cpprocsparse_create_coo_descr |
:cpprocsparse_create_csr_descr |
:cpprocsparse_create_csc_descr |
:cpprocsparse_create_ell_descr |
:cpprocsparse_destroy_spmat_descr |
:cpprocsparse_coo_get |
:cpprocsparse_csr_get |
:cpprocsparse_ell_get |
:cpprocsparse_coo_set_pointers |
:cpprocsparse_csr_set_pointers |
:cpprocsparse_csc_set_pointers |
:cpprocsparse_ell_set_pointers |
:cpprocsparse_spmat_get_size |
:cpprocsparse_spmat_get_index_base |
:cpprocsparse_spmat_get_values |
:cpprocsparse_spmat_set_values |
:cpprocsparse_create_dnvec_descr |
:cpprocsparse_destroy_dnvec_descr |
:cpprocsparse_dnvec_get |
:cpprocsparse_dnvec_get_values |
:cpprocsparse_dnvec_set_values |
Function name | single | double | single complex | double complex |
---|---|---|---|---|
:cpprocsparse_Xaxpyi() <rocsparse_saxpyi> |
x | x | x | x |
:cpp |
x |
x |
x x |
x x |
:cpprocsparse_Xgthr() <rocsparse_sgthr> |
x | x | x | x |
:cpp |
x x |
x x |
x |
x |
:cpprocsparse_Xsctr() <rocsparse_ssctr> |
x | x | x | x |
Function name | single | double | single complex | double complex |
---|---|---|---|---|
:cpprocsparse_Xbsrmv() <rocsparse_sbsrmv> |
x | x | x | x |
:cpprocsparse_Xbsrxmv() <rocsparse_sbsrxmv> |
x | x | x | x |
:cpprocsparse_Xbsrsv_buffer_size() <rocsparse_sbsrsv_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xbsrsv_solve() <rocsparse_sbsrsv_solve> |
x | x | x | x |
:cpprocsparse_Xcoomv() <rocsparse_scoomv> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xcsrmv() <rocsparse_scsrmv> |
x | x | x | x |
:cpprocsparse_Xcsrsv_buffer_size() <rocsparse_scsrsv_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xcsrsv_solve() <rocsparse_scsrsv_solve> |
x | x | x | x |
:cpprocsparse_Xellmv() <rocsparse_sellmv> |
x | x | x | x |
:cpprocsparse_Xhybmv() <rocsparse_shybmv> |
x | x | x | x |
:cpprocsparse_Xgebsrmv() <rocsparse_sgebsrmv> |
x | x | x | x |
:cpprocsparse_Xgemvi_buffer_size() <rocsparse_sgemvi_buffer_size> |
x | x | x | x |
:cpprocsparse_Xgemvi() <rocsparse_sgemvi> |
x | x | x | x |
Function name | single | double | single complex | double complex |
---|---|---|---|---|
:cpprocsparse_Xbsrmm() <rocsparse_sbsrmm> |
x | x | x | x |
:cpprocsparse_Xgebsrmm() <rocsparse_sgebsrmm> |
x | x | x | x |
:cpprocsparse_Xcsrmm() <rocsparse_scsrmm> |
x | x | x | x |
:cpprocsparse_Xcsrsm_buffer_size() <rocsparse_scsrsm_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xcsrsm_solve() <rocsparse_scsrsm_solve> |
x | x | x | x |
:cpprocsparse_Xbsrsm_buffer_size() <rocsparse_sbsrsm_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xbsrsm_solve() <rocsparse_sbsrsm_solve> |
x | x | x | x |
:cpprocsparse_Xgemmi() <rocsparse_sgemmi> |
x | x | x | x |
Function name | single | double | single complex | double complex |
---|---|---|---|---|
:cpprocsparse_csrgeam_nnz |
||||
:cpprocsparse_Xcsrgeam() <rocsparse_scsrgeam> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xcsrgemm() <rocsparse_scsrgemm> |
x | x | x | x |
:cpprocsparse_Xcsrgemm_numeric() <rocsparse_scsrgemm_numeric> |
x | x | x | x |
Function name | single | double | single complex | double complex |
---|---|---|---|---|
:cpprocsparse_Xbsric0_buffer_size() <rocsparse_sbsric0_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xbsric0() <rocsparse_sbsric0> |
x | x | x | x |
:cpprocsparse_Xbsrilu0_buffer_size() <rocsparse_sbsrilu0_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xbsrilu0() <rocsparse_sbsrilu0> |
x | x | x | x |
:cpprocsparse_Xcsric0_buffer_size() <rocsparse_scsric0_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xcsric0() <rocsparse_scsric0> |
x | x | x | x |
:cpprocsparse_Xcsrilu0_buffer_size() <rocsparse_scsrilu0_buffer_size> |
x | x | x | x |
:cpprocsparse_Xcsrilu0_numeric_boost() <rocsparse_scsrilu0_numeric_boost> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
:cpprocsparse_Xcsrilu0() <rocsparse_scsrilu0> |
x | x | x | x |
:cpprocsparse_Xgtsv_buffer_size() <rocsparse_sgtsv_buffer_size> |
x | x | x | x |
:cpprocsparse_Xgtsv() <rocsparse_sgtsv> |
x | x | x | x |
:cpprocsparse_Xgtsv_no_pivot_buffer_size() <rocsparse_sgtsv_no_pivot_buffer_size> |
x | x | x | x |
:cpprocsparse_Xgtsv_no_pivot() <rocsparse_sgtsv_no_pivot> |
x | x | x | x |
:cpprocsparse_Xgtsv_no_pivot_strided_batch_buffer_size() <rocsparse_sgtsv_no_pivot_strided_batch_buffer_size> |
x | x | x | x |
:cpprocsparse_Xgtsv_no_pivot_strided_batch() <rocsparse_sgtsv_no_pivot_strided_batch> |
x | x | x | x |
:cpprocsparse_Xgtsv_interleaved_batch_buffer_size() <rocsparse_sgtsv_interleaved_batch_buffer_size> |
x | x | x | x |
:cpprocsparse_Xgtsv_interleaved_batch() <rocsparse_sgtsv_interleaved_batch> |
x | x | x | x |
:cpprocsparse_Xgpsv_interleaved_batch_buffer_size() <rocsparse_sgpsv_interleaved_batch_buffer_size> |
x | x | x | x |
:cpp |
x |
x |
x |
x |
====================================================================================================================== | === === | === === | === =========== | === ============== |
Function name |
|
gle dou | ble single comp | lex double complex |
====================================================================================================================== :cpp |
=== === |
=== === |
=== =========== |
=== ============== |
:cpprocsparse_Xcsr2csc() <rocsparse_scsr2csc> |
|
|
|
|
:cpprocsparse_Xgebsr2gebsc_buffer_size |
|
|
|
|
:cpp |
|
|
|
|
:cpprocsparse_Xcsr2ell() <rocsparse_scsr2ell> |
|
|
|
|
:cpp |
|
|
|
|
:cpp |
|
|
|
|
:cpprocsparse_Xcsr2gebsr_buffer_size() <rocsparse_scsr2gebsr_buffer_size> |
|
|
|
|
:cpp |
|
|
|
|
:cpp |
|
|
|
|
:cpprocsparse_Xhyb2csr() <rocsparse_shyb2csr> |
|
|
|
|
:cpprocsparse_Xbsr2csr() <rocsparse_sbsr2csr> |
|
|
|
|
:cpprocsparse_Xgebsr2csr() <rocsparse_sgebsr2csr> |
|
|
|
|
:cpp |
|
|
|
|
:cpprocsparse_Xgebsr2gebsr() <rocsparse_sgebsr2gebsr> |
|
|
|
|
:cpp |
|
|
|
|
:cpprocsparse_Xdense2csr() <rocsparse_sdense2csr> |
|
|
|
|
:cpprocsparse_Xdense2csc() <rocsparse_sdense2csc> |
|
|
|
|
:cpprocsparse_Xdense2coo() <rocsparse_sdense2coo> |
|
|
|
|
:cpprocsparse_Xcsr2dense() <rocsparse_scsr2dense> |
|
|
|
|
:cpprocsparse_Xcsc2dense() <rocsparse_scsc2dense> |
|
|
|
|
:cpprocsparse_Xcoo2dense() <rocsparse_scoo2dense> |
|
|
|
|
:cpprocsparse_Xnnz_compress() <rocsparse_snnz_compress> |
|
|
|
|
:cpp |
|
|
|
|
Function name | single | double | single complex | double complex |
---|---|---|---|---|
:cpprocsparse_Xcsrcolor() <rocsparse_scsrcolor> |
x | x | x | x |
Function name | single | double | single complex | double complex |
---|---|---|---|---|
:cpprocsparse_axpby() |
x | x | x | x |
:cpprocsparse_gather() |
x | x | x | x |
:cpprocsparse_scatter() |
x | x | x | x |
:cpprocsparse_rot() |
x | x | x | x |
:cpprocsparse_spvv() |
x | x | x | x |
:cpprocsparse_sparse_to_dense() |
x | x | x | x |
:cpprocsparse_dense_to_sparse() |
x | x | x | x |
:cpprocsparse_spmv() |
x | x | x | x |
:cpprocsparse_spsv() |
x | x | x | x |
:cpprocsparse_spmm() |
x | x | x | x |
:cpprocsparse_spsm() |
x | x | x | x |
:cpprocsparse_spgemm() |
x | x | x | x |
:cpprocsparse_sddmm() |
x | x | x | x |
rocSPARSE supports 0 and 1 based indexing. The index base is selected by the :cpprocsparse_index_base
type which is either passed as standalone parameter or as part of the :cpprocsparse_mat_descr
type.
Furthermore, dense vectors are represented with a 1D array, stored linearly in memory. Sparse vectors are represented by a 1D data array stored linearly in memory that hold all non-zero elements and a 1D indexing array stored linearly in memory that hold the positions of the corresponding non-zero elements.
The auxiliary functions :cpprocsparse_set_pointer_mode
and :cpprocsparse_get_pointer_mode
are used to set and get the value of the state variable :cpprocsparse_pointer_mode
. If :cpprocsparse_pointer_mode
is equal to :cpprocsparse_pointer_mode_host
, then scalar parameters must be allocated on the host. If :cpprocsparse_pointer_mode
is equal to :cpprocsparse_pointer_mode_device
, then scalar parameters must be allocated on the device.
There are two types of scalar parameter:
- Scaling parameters, such as alpha and beta used in e.g. :cpp
rocsparse_scsrmv
, :cpprocsparse_scoomv
, ...- Scalar results from functions such as :cpp
rocsparse_sdoti
, :cpprocsparse_cdotci
, ...
For scalar parameters such as alpha and beta, memory can be allocated on the host heap or stack, when :cpprocsparse_pointer_mode
is equal to :cpprocsparse_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 :cpprocsparse_pointer_mode
is equal to :cpprocsparse_pointer_mode_device
, the scalar parameter must not be changed till the kernel completes.
For scalar results, when :cpprocsparse_pointer_mode
is equal to :cpprocsparse_pointer_mode_host
, the function blocks the CPU till the GPU has copied the result back to the host. Using :cpprocsparse_pointer_mode
equal to :cpprocsparse_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.
Except a functions having memory allocation inside preventing asynchronicity, all rocSPARSE functions are configured to operate in non-blocking fashion with respect to CPU, meaning these library functions return immediately.
hipSPARSE is a SPARSE marshalling library, with multiple supported backends. It sits between the application and a worker SPARSE library, marshalling inputs into the backend library and marshalling results back to the application. hipSPARSE exports an interface that does not require the client to change, regardless of the chosen backend. Currently, hipSPARSE supports rocSPARSE and cuSPARSE as backends. hipSPARSE focuses on convenience and portability. If performance outweighs these factors, then using rocSPARSE itself is highly recommended. hipSPARSE can be found on GitHub.
This module holds all sparse auxiliary functions.
The functions that are contained in the auxiliary module describe all available helper functions that are required for subsequent library calls.
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_destroy_mat_descr
rocsparse_copy_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_mat
rocsparse_destroy_hyb_mat
rocsparse_create_mat_info
rocsparse_copy_mat_info
rocsparse_destroy_mat_info
rocsparse_create_spvec_descr
rocsparse_destroy_spvec_descr
rocsparse_spvec_get
rocsparse_spvec_get_index_base
rocsparse_spvec_get_values
rocsparse_spvec_set_values
rocsparse_create_coo_descr
rocsparse_create_csr_descr
rocsparse_create_csc_descr
rocsparse_create_ell_descr
rocsparse_destroy_spmat_descr
rocsparse_coo_get
rocsparse_csr_get
rocsparse_ell_get
rocsparse_coo_set_pointers
rocsparse_csr_set_pointers
rocsparse_csc_set_pointers
rocsparse_ell_set_pointers
rocsparse_spmat_get_size
rocsparse_spmat_get_index_base
rocsparse_spmat_get_values
rocsparse_spmat_set_values
rocsparse_create_dnvec_descr
rocsparse_destroy_dnvec_descr
rocsparse_dnvec_get
rocsparse_dnvec_get_values
rocsparse_dnvec_set_values
The sparse level 1 routines describe operations between a vector in sparse format and a vector in dense format. This section describes all rocSPARSE level 1 sparse linear algebra functions.
rocsparse_saxpyi
rocsparse_daxpyi
rocsparse_caxpyi
rocsparse_zaxpyi
rocsparse_sdoti
rocsparse_ddoti
rocsparse_cdoti
rocsparse_zdoti
rocsparse_cdotci
rocsparse_zdotci
rocsparse_sgthr
rocsparse_dgthr
rocsparse_cgthr
rocsparse_zgthr
rocsparse_sgthrz
rocsparse_dgthrz
rocsparse_cgthrz
rocsparse_zgthrz
rocsparse_sroti
rocsparse_droti
rocsparse_ssctr
rocsparse_dsctr
rocsparse_csctr
rocsparse_zsctr
This module holds all sparse level 2 routines.
The sparse level 2 routines describe operations between a matrix in sparse format and a vector in dense format.
rocsparse_sbsrmv
rocsparse_dbsrmv
rocsparse_cbsrmv
rocsparse_zbsrmv
rocsparse_sbsrxmv
rocsparse_dbsrxmv
rocsparse_cbsrxmv
rocsparse_zbsrxmv
rocsparse_bsrsv_zero_pivot
rocsparse_sbsrsv_buffer_size
rocsparse_dbsrsv_buffer_size
rocsparse_cbsrsv_buffer_size
rocsparse_zbsrsv_buffer_size
rocsparse_sbsrsv_analysis
rocsparse_dbsrsv_analysis
rocsparse_cbsrsv_analysis
rocsparse_zbsrsv_analysis
rocsparse_sbsrsv_solve
rocsparse_dbsrsv_solve
rocsparse_cbsrsv_solve
rocsparse_zbsrsv_solve
rocsparse_bsrsv_clear
rocsparse_scoomv
rocsparse_dcoomv
rocsparse_ccoomv
rocsparse_zcoomv
rocsparse_scsrmv_analysis
rocsparse_dcsrmv_analysis
rocsparse_ccsrmv_analysis
rocsparse_zcsrmv_analysis
rocsparse_scsrmv
rocsparse_dcsrmv
rocsparse_ccsrmv
rocsparse_zcsrmv
rocsparse_csrmv_clear
rocsparse_csrsv_zero_pivot
rocsparse_scsrsv_buffer_size
rocsparse_dcsrsv_buffer_size
rocsparse_ccsrsv_buffer_size
rocsparse_zcsrsv_buffer_size
rocsparse_scsrsv_analysis
rocsparse_dcsrsv_analysis
rocsparse_ccsrsv_analysis
rocsparse_zcsrsv_analysis
rocsparse_scsrsv_solve
rocsparse_dcsrsv_solve
rocsparse_ccsrsv_solve
rocsparse_zcsrsv_solve
rocsparse_csrsv_clear
rocsparse_sellmv
rocsparse_dellmv
rocsparse_cellmv
rocsparse_zellmv
rocsparse_shybmv
rocsparse_dhybmv
rocsparse_chybmv
rocsparse_zhybmv
rocsparse_sgebsrmv
rocsparse_dgebsrmv
rocsparse_cgebsrmv
rocsparse_zgebsrmv
rocsparse_sgemvi_buffer_size
rocsparse_dgemvi_buffer_size
rocsparse_cgemvi_buffer_size
rocsparse_zgemvi_buffer_size
rocsparse_sgemvi
rocsparse_dgemvi
rocsparse_cgemvi
rocsparse_zgemvi
This module holds all sparse level 3 routines.
The sparse level 3 routines describe operations between a matrix in sparse format and multiple vectors in dense format that can also be seen as a dense matrix.
rocsparse_sbsrmm
rocsparse_dbsrmm
rocsparse_cbsrmm
rocsparse_zbsrmm
rocsparse_sgebsrmm
rocsparse_dgebsrmm
rocsparse_cgebsrmm
rocsparse_zgebsrmm
rocsparse_scsrmm
rocsparse_dcsrmm
rocsparse_ccsrmm
rocsparse_zcsrmm
rocsparse_csrsm_zero_pivot
rocsparse_scsrsm_buffer_size
rocsparse_dcsrsm_buffer_size
rocsparse_ccsrsm_buffer_size
rocsparse_zcsrsm_buffer_size
rocsparse_scsrsm_analysis
rocsparse_dcsrsm_analysis
rocsparse_ccsrsm_analysis
rocsparse_zcsrsm_analysis
rocsparse_scsrsm_solve
rocsparse_dcsrsm_solve
rocsparse_ccsrsm_solve
rocsparse_zcsrsm_solve
rocsparse_csrsm_clear
rocsparse_bsrsm_zero_pivot
rocsparse_sbsrsm_buffer_size
rocsparse_dbsrsm_buffer_size
rocsparse_cbsrsm_buffer_size
rocsparse_zbsrsm_buffer_size
rocsparse_sbsrsm_analysis
rocsparse_dbsrsm_analysis
rocsparse_cbsrsm_analysis
rocsparse_zbsrsm_analysis
rocsparse_sbsrsm_solve
rocsparse_dbsrsm_solve
rocsparse_cbsrsm_solve
rocsparse_zbsrsm_solve
rocsparse_bsrsm_clear
rocsparse_sgemmi
rocsparse_dgemmi
rocsparse_cgemmi
rocsparse_zgemmi
This module holds all sparse extra routines.
The sparse extra routines describe operations that manipulate sparse matrices.
rocsparse_csrgeam_nnz
rocsparse_scsrgeam
rocsparse_dcsrgeam
rocsparse_ccsrgeam
rocsparse_zcsrgeam
rocsparse_scsrgemm_buffer_size
rocsparse_dcsrgemm_buffer_size
rocsparse_ccsrgemm_buffer_size
rocsparse_zcsrgemm_buffer_size
rocsparse_csrgemm_nnz
rocsparse_csrgemm_symbolic
rocsparse_scsrgemm
rocsparse_dcsrgemm
rocsparse_ccsrgemm
rocsparse_zcsrgemm
rocsparse_scsrgemm_numeric
rocsparse_dcsrgemm_numeric
rocsparse_ccsrgemm_numeric
rocsparse_zcsrgemm_numeric
This module holds all sparse preconditioners.
The sparse preconditioners describe manipulations on a matrix in sparse format to obtain a sparse preconditioner matrix.
rocsparse_bsric0_zero_pivot
rocsparse_sbsric0_buffer_size
rocsparse_dbsric0_buffer_size
rocsparse_cbsric0_buffer_size
rocsparse_zbsric0_buffer_size
rocsparse_sbsric0_analysis
rocsparse_dbsric0_analysis
rocsparse_cbsric0_analysis
rocsparse_zbsric0_analysis
rocsparse_sbsric0
rocsparse_dbsric0
rocsparse_cbsric0
rocsparse_zbsric0
rocsparse_bsric0_clear
rocsparse_bsrilu0_zero_pivot
rocsparse_sbsrilu0_numeric_boost
rocsparse_dbsrilu0_numeric_boost
rocsparse_cbsrilu0_numeric_boost
rocsparse_zbsrilu0_numeric_boost
rocsparse_sbsrilu0_buffer_size
rocsparse_dbsrilu0_buffer_size
rocsparse_cbsrilu0_buffer_size
rocsparse_zbsrilu0_buffer_size
rocsparse_sbsrilu0_analysis
rocsparse_dbsrilu0_analysis
rocsparse_cbsrilu0_analysis
rocsparse_zbsrilu0_analysis
rocsparse_sbsrilu0
rocsparse_dbsrilu0
rocsparse_cbsrilu0
rocsparse_zbsrilu0
rocsparse_bsrilu0_clear
rocsparse_csric0_zero_pivot
rocsparse_scsric0_buffer_size
rocsparse_dcsric0_buffer_size
rocsparse_ccsric0_buffer_size
rocsparse_zcsric0_buffer_size
rocsparse_scsric0_analysis
rocsparse_dcsric0_analysis
rocsparse_ccsric0_analysis
rocsparse_zcsric0_analysis
rocsparse_scsric0
rocsparse_dcsric0
rocsparse_ccsric0
rocsparse_zcsric0
rocsparse_csric0_clear
rocsparse_csrilu0_zero_pivot
rocsparse_scsrilu0_numeric_boost
rocsparse_dcsrilu0_numeric_boost
rocsparse_ccsrilu0_numeric_boost
rocsparse_zcsrilu0_numeric_boost
rocsparse_scsrilu0_buffer_size
rocsparse_dcsrilu0_buffer_size
rocsparse_ccsrilu0_buffer_size
rocsparse_zcsrilu0_buffer_size
rocsparse_scsrilu0_analysis
rocsparse_dcsrilu0_analysis
rocsparse_ccsrilu0_analysis
rocsparse_zcsrilu0_analysis
rocsparse_scsrilu0
rocsparse_dcsrilu0
rocsparse_ccsrilu0
rocsparse_zcsrilu0
rocsparse_csrilu0_clear
rocsparse_sgtsv_buffer_size
rocsparse_dgtsv_buffer_size
rocsparse_cgtsv_buffer_size
rocsparse_zgtsv_buffer_size
rocsparse_sgtsv
rocsparse_dgtsv
rocsparse_cgtsv
rocsparse_zgtsv
rocsparse_sgtsv_no_pivot_buffer_size
rocsparse_dgtsv_no_pivot_buffer_size
rocsparse_cgtsv_no_pivot_buffer_size
rocsparse_zgtsv_no_pivot_buffer_size
rocsparse_sgtsv_no_pivot
rocsparse_dgtsv_no_pivot
rocsparse_cgtsv_no_pivot
rocsparse_zgtsv_no_pivot
rocsparse_sgtsv_no_pivot_strided_batch_buffer_size
rocsparse_dgtsv_no_pivot_strided_batch_buffer_size
rocsparse_cgtsv_no_pivot_strided_batch_buffer_size
rocsparse_zgtsv_no_pivot_strided_batch_buffer_size
rocsparse_sgtsv_no_pivot_strided_batch
rocsparse_dgtsv_no_pivot_strided_batch
rocsparse_cgtsv_no_pivot_strided_batch
rocsparse_zgtsv_no_pivot_strided_batch
rocsparse_sgtsv_interleaved_batch_buffer_size
rocsparse_dgtsv_interleaved_batch_buffer_size
rocsparse_cgtsv_interleaved_batch_buffer_size
rocsparse_zgtsv_interleaved_batch_buffer_size
rocsparse_sgtsv_interleaved_batch
rocsparse_dgtsv_interleaved_batch
rocsparse_cgtsv_interleaved_batch
rocsparse_zgtsv_interleaved_batch
rocsparse_sgpsv_interleaved_batch_buffer_size
rocsparse_dgpsv_interleaved_batch_buffer_size
rocsparse_cgpsv_interleaved_batch_buffer_size
rocsparse_zgpsv_interleaved_batch_buffer_size
rocsparse_sgpsv_interleaved_batch
rocsparse_dgpsv_interleaved_batch
rocsparse_cgpsv_interleaved_batch
rocsparse_zgpsv_interleaved_batch
This module holds all sparse conversion routines.
The sparse conversion routines describe operations on a matrix in sparse format to obtain a matrix in a different sparse format.
rocsparse_csr2coo
rocsparse_coo2csr
rocsparse_csr2csc_buffer_size
rocsparse_scsr2csc
rocsparse_dcsr2csc
rocsparse_ccsr2csc
rocsparse_zcsr2csc
rocsparse_sgebsr2gebsc_buffer_size
rocsparse_dgebsr2gebsc_buffer_size
rocsparse_cgebsr2gebsc_buffer_size
rocsparse_zgebsr2gebsc_buffer_size
rocsparse_sgebsr2gebsc
rocsparse_dgebsr2gebsc
rocsparse_cgebsr2gebsc
rocsparse_zgebsr2gebsc
rocsparse_csr2ell_width
rocsparse_scsr2ell
rocsparse_dcsr2ell
rocsparse_ccsr2ell
rocsparse_zcsr2ell
rocsparse_ell2csr_nnz
rocsparse_sell2csr
rocsparse_dell2csr
rocsparse_cell2csr
rocsparse_zell2csr
rocsparse_scsr2hyb
rocsparse_dcsr2hyb
rocsparse_ccsr2hyb
rocsparse_zcsr2hyb
rocsparse_hyb2csr_buffer_size
rocsparse_shyb2csr
rocsparse_dhyb2csr
rocsparse_chyb2csr
rocsparse_zhyb2csr
rocsparse_sbsr2csr
rocsparse_dbsr2csr
rocsparse_cbsr2csr
rocsparse_zbsr2csr
rocsparse_sgebsr2csr
rocsparse_dgebsr2csr
rocsparse_cgebsr2csr
rocsparse_zgebsr2csr
rocsparse_sgebsr2gebsr_buffer_size
rocsparse_dgebsr2gebsr_buffer_size
rocsparse_cgebsr2gebsr_buffer_size
rocsparse_zgebsr2gebsr_buffer_size
rocsparse_gebsr2gebsr_nnz
rocsparse_sgebsr2gebsr
rocsparse_dgebsr2gebsr
rocsparse_cgebsr2gebsr
rocsparse_zgebsr2gebsr
rocsparse_csr2bsr_nnz
rocsparse_scsr2bsr
rocsparse_dcsr2bsr
rocsparse_ccsr2bsr
rocsparse_zcsr2bsr
rocsparse_csr2gebsr_nnz
rocsparse_scsr2gebsr_buffer_size
rocsparse_dcsr2gebsr_buffer_size
rocsparse_ccsr2gebsr_buffer_size
rocsparse_zcsr2gebsr_buffer_size
rocsparse_scsr2gebsr
rocsparse_dcsr2gebsr
rocsparse_ccsr2gebsr
rocsparse_zcsr2gebsr
rocsparse_scsr2csr_compress
rocsparse_dcsr2csr_compress
rocsparse_ccsr2csr_compress
rocsparse_zcsr2csr_compress
rocsparse_create_identity_permutation
rocsparse_csrsort_buffer_size
rocsparse_csrsort
rocsparse_cscsort_buffer_size
rocsparse_cscsort
rocsparse_coosort_buffer_size
rocsparse_coosort_by_row
rocsparse_coosort_by_column
rocsparse_snnz_compress
rocsparse_dnnz_compress
rocsparse_cnnz_compress
rocsparse_znnz_compress
rocsparse_snnz
rocsparse_dnnz
rocsparse_cnnz
rocsparse_znnz
rocsparse_sdense2csr
rocsparse_ddense2csr
rocsparse_cdense2csr
rocsparse_zdense2csr
rocsparse_sdense2csc
rocsparse_ddense2csc
rocsparse_cdense2csc
rocsparse_zdense2csc
rocsparse_sdense2coo
rocsparse_ddense2coo
rocsparse_cdense2coo
rocsparse_zdense2coo
rocsparse_scsr2dense
rocsparse_dcsr2dense
rocsparse_ccsr2dense
rocsparse_zcsr2dense
rocsparse_scsc2dense
rocsparse_dcsc2dense
rocsparse_ccsc2dense
rocsparse_zcsc2dense
rocsparse_scoo2dense
rocsparse_dcoo2dense
rocsparse_ccoo2dense
rocsparse_zcoo2dense
rocsparse_sprune_dense2csr_buffer_size
rocsparse_dprune_dense2csr_buffer_size
rocsparse_sprune_dense2csr_nnz
rocsparse_dprune_dense2csr_nnz
rocsparse_sprune_dense2csr
rocsparse_dprune_dense2csr
rocsparse_sprune_csr2csr_buffer_size
rocsparse_dprune_csr2csr_buffer_size
rocsparse_sprune_csr2csr_nnz
rocsparse_dprune_csr2csr_nnz
rocsparse_sprune_csr2csr
rocsparse_dprune_csr2csr
rocsparse_sprune_dense2csr_by_percentage_buffer_size
rocsparse_dprune_dense2csr_by_percentage_buffer_size
rocsparse_sprune_dense2csr_nnz_by_percentage
rocsparse_dprune_dense2csr_nnz_by_percentage
rocsparse_sprune_dense2csr_by_percentage
rocsparse_dprune_dense2csr_by_percentage
rocsparse_sprune_csr2csr_by_percentage_buffer_size
rocsparse_dprune_csr2csr_by_percentage_buffer_size
rocsparse_sprune_csr2csr_nnz_by_percentage
rocsparse_dprune_csr2csr_nnz_by_percentage
rocsparse_sprune_csr2csr_by_percentage
rocsparse_dprune_csr2csr_by_percentage
This module holds all sparse reordering routines.
The sparse reordering routines describe algorithm for reordering sparse matrices.
rocsparse_scsrcolor
rocsparse_dcsrcolor
rocsparse_ccsrcolor
rocsparse_zcsrcolor
This module holds all sparse generic routines.
The sparse generic routines describe operations that manipulate sparse matrices.
rocsparse_axpby
rocsparse_gather
rocsparse_scatter
rocsparse_rot
rocsparse_spvv
rocsparse_spmv
rocsparse_spsv
rocsparse_spsm
rocsparse_spmm
rocsparse_spgemm
rocsparse_sddmm