Do vector description arguments for cusparseSpSV_bufferSize() and cusparseSpSV_analysis() need underlying buffers?

I am working on some code that uses the old cusparseXcsrsv2 API which was deprecated in CUDA 11 and removed in CUDA 12. The old API does not need any data on the vectors for calculating the buffer size and doing the analysis. Therefore it was used in a setup function which does not know about the actual RHS(s) at all. With the old API it was straightforward to reuse the buffer and analysis for multiple RHS.

Is this still possible with the generic API? Could I for example create cusparseConstDnVecDescr_t objects with a nullptr for the buffer and then later use cusparseSpVecSetValues() to change the buffer or just use different cusparseConstDnVecDescr_t handles with cusparseSpSV_solve()? I.e. is there a guarantee that cusparseSpSV_bufferSize() and cusparseSpSV_analysis() wont try to dereference the buffer pointers of the vector descriptions?

Hi [paleonix],
You can provide different vectors or change the vector values for cusparseSpSV_solve. The only restriction for any cusparseSpSV routine is not to provide a vector with nullptr.

1 Like

@malmasri Thank you for the quick answer. While this allows to somewhat work around my issue, it is quite clunky as I will need to allocate some additional buffers which wont be used at all.

It would be nice to have a more elegant solution for this relatively common (I would think) usage pattern in the future (e.g. explicitly allowing “empty” vector descriptions for setup steps).

It would also be good to better document if/how one can change the vector descriptors between calls to _bufferSize(), _analysis() and _solve(). Maybe a spsv_csr_reuse sample for the CUDALibrarySamples? Should I open an issue at the Github Repo for that?

Hi @paleonix,
We already plan to improve the SpSV usage and documentation in future releases. One of the improvements is to allow users to provide empty vectors for the setup routines.
For the CUDALibrarySamples, it will be also updated to reflect the new features of cusparseSpSV.


1 Like

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