Error in CUDALibrary exampple cuSPARSE/spsv_csr

Dear all,

I was checking the example of the cusparseSpSV CSR found here and unless I am missing something, even if the check is true, the result is mathematically not correct:


The correct solution for the system (Y) in the example is [0, 0.5, 0.5, 0].

Please let me know what is the correct procedure for using cusparseSpSV.

Hi @Jhair_Acosta,
The formula should be op(A) * X = alpha * op(Y) , where X is the output and Y is the input (RHS) . [Will be fixed soon]
SpSV and SpSM take a square sparse matrix and use cusparseSpMatSetAttribute() to specify the fill mode: lower/upper and diagonal type: unit/non-unit. In this example, CUSPARSE_FILL_MODE_LOWER and CUSPARSE_DIAG_TYPE_NON_UNIT are used.


Hi @malmasri,

Thanks for your answer, now it makes senses to have [1,2,3,4] as the answer if I am considering only the lower diagonal. So that means that this example is already considering that A is the LU decomposition. Since that is the case, now I have the question of how to get the LU decomposition, because the cuSparse documentation says that cusparsecsrilu02 is depreciated and will be removed in the next major release.


Hi @Jhair_Acosta,

  1. Can you please share your use case for incomplete LU factorization? How much do you use this functionality in your computation? This information will help us develop the feature in the next releases; so we’d appreciate it if you could give us some details.
  2. We haven’t made a final decision on how to support this functionality in the CUDA 13 timeframe. Sometimes we mark features as deprecated to get feedback from the community, and your comments are valuable.
  3. For direct sparse solvers, please have a look at Nvidia cuDSS (NVIDIA cuDSS (Preview): A high-performance CUDA Library for Direct Sparse Solvers — NVIDIA cuDSS documentation)


Hi @malmasri,

Thanks for your answers.

We use all the time LU factorization in our program with Sparse matrices. It is to solve power systems, which are inherently sparse, so it will be really helpful to have those functions.

Thanks for your suggestion of cuDSS, I will check that library.