Search code examples
c++cudanvcc

Missing functions for NVIDIA CUDA 12.3 CSR Formatted Sparse Linear Algebra


Does anyone know why the cuSPARSE documentation for CUDA version 12 references cusparseDcsrsv2_analysis and cusparseDcsrsv2_solve, but these functions are no where to be found in their actual cusparse.h library?

Their CUDA version 10 does indeed have the functions in cusparse.h. It seems like all types and functions that are of CSR and SV (hence "csrsv") are gone in version 12.

I already submitted a ticket to NVIDIA, but I would like to know a work-around. Are there any equivalent functions for CSR formatted matrix to vector multiplication functions in cuSPARSE?


Solution

  • cuSparse has a new generic API including cusparseSpSV() and cusparseSpMV() (OP mentions "matrix to vector multiplication" which is "mv", not "sv"). Generic means that there is a wrapper cusparseSpMatDescr_t which can describe many different sparse matrix formats including CSR. This way the name/interface of the functions like cusparseSpSV() is independent of the sparse format which makes it easier to build on the cuSparse API when writing generic APIs oneself.

    The fact that cusparseDcsrsv2_analysis() is still mentioned in the documentation (found it in the example here) seems to be an oversight on Nvidia's side and was rightfully reported by OP.

    See cuSparse's Library Organization and Features for a description of the generic API. Note also how these features where marked as "deprecated" in CUDA 11, so their disappearance in CUDA 12 should not be a surprise. This is also what the CUDA 12.0 release notes allude to.