ROCm / hipSPARSE

ROCm SPARSE marshalling library
https://rocm.docs.amd.com/projects/hipSPARSE/en/latest/
MIT License
66 stars 41 forks source link

hipSPARSE

hipSPARSE is a SPARSE marshalling library with multiple supported backends. It sits between your application and a 'worker' SPARSE library, where it marshals inputs to the backend library and marshals results to your application. hipSPARSE exports an interface that doesn't require the client to change, regardless of the chosen backend. Currently, hipSPARSE supports rocSPARSE and NVIDIA CUDA cuSPARSE backends.

Documentation

[!NOTE] The published hipSPARSE documentation is available at https://rocm.docs.amd.com/projects/hipSPARSE/en/latest/ in an organized, easy-to-read format, with search and a table of contents. The documentation source files reside in the hipSPARSE/docs folder of this repository. As with all ROCm projects, the documentation is open source. For more information, see Contribute to ROCm documentation.

To build our documentation locally, run the following code:

cd docs

pip3 install -r sphinx/requirements.txt

python3 -m sphinx -T -E -b html -d _build/doctrees -D language=en . _build/html

Alternatively, build with CMake:

cmake -DBUILD_DOCS=ON ...

Installing pre-built packages

Download pre-built packages from ROCm's package servers using the following code:

`sudo apt update && sudo apt install hipsparse`

Build hipSPARSE

To build hipSPARSE, you can use our bash helper script (for Ubuntu only) or you can perform a manual build (for all supported platforms).

Supported functions

You can find a list of exported functions on our wiki.

Interface examples

The hipSPARSE interface is compatible with rocSPARSE and CUDA cuSPARSE-v2 APIs. Porting a CUDA application that calls the CUDA cuSPARSE API to an application that calls the hipSPARSE API is relatively straightforward. For example, the hipSPARSE SCSRMV interface is:

CSRMV API

hipsparseStatus_t
hipsparseScsrmv(hipsparseHandle_t handle,
                hipsparseOperation_t transA,
                int m, int n, int nnz, const float *alpha,
                const hipsparseMatDescr_t descrA,
                const float *csrValA,
                const int *csrRowPtrA, const int *csrColIndA,
                const float *x, const float *beta,
                float *y);

hipSPARSE assumes matrix A and vectors x, y are allocated in GPU memory space filled with data. Users are responsible for copying data to and from the host and device memory.