CUDA 12 - Sparse Triangular Matrix Solver

Why does the new API require RHS and solution vectors for cusparseSpSV_analysis? And why does the new API cusparseSpSV_solver use objects instead of simple pointer arrays for matrix, RHS and solution vectors?

How can output (solution vector) from a cusparseSpSV_solver function be used as the RHS vector of another sequential cusparseSpSV_solver? Before this new API, you could simply pass the raw data (double*) between the sparse solvers. Why the change and how can I modify the cusparseConstDnVecDescr_t object such that its data can be the cusparseDnVecDescr_t from the previous solver function?

This issue arises due to my attempt to implement an L/U BiCGStab solver written in the old API here

Hi @michael.burnett.0017,
Q1:RHS and Solution vectors in the analysis?
Including the RHS and solution vector in the buffer_size and analysis steps is part of the generic API design approach that attempts to unify the parameter list for the routines of the same computation. For cusparseSpSV, cusparseSpSV_bufferSize() and cusparseSpSV_analysis() routines accept NULL for vecX and vecY.

Q2/3: Pass the solution to another sequential solver/Modify a vector

Option 1: the dense vector descriptor is a wrapper around your explicit array. You can access and modify the values of the explicit array between computations if needed. You can have more than one dense vector descriptor for the same array (e.g., const and non-const). Passing a const dense vector descriptor guarantees that the APIs do not modify their inputs. See the example in cuda-samples/Samples/4_CUDA_Libraries/conjugateGradientPrecond at master · NVIDIA/cuda-samples · GitHub

Option 2: You can use cusparseDnVecGetValues and cusparseDnSetValues to extract, modify the explicit array, and pass it to the next solver

Please let me know if you need more clarification

Hi @michael.burnett.0017
Out of curiosity, can you please provide the scope and more details about the problem you working on?


Your previous response validated my assumptions. I will wrap the same data array with cusparseConstDnVecDescr_t and cusparseDnVecDescr_t, each belonging to two separate cusparseSpSV_solver functions.

The link in my original post brings you to an L/U preconditioned BiCGStab solver implemented in your pre-12.0 API. I’m simply trying to implement something similar in the new API.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.