im really new with cuda.
im using the cusparse library to perform some matrix-vector operations, but a also need a function do add to sparse matrices. But i cant find one in the cusparse library.
Does anyone know a solution?
Sparse matrix addition isn’t a very common or straightforward operation, except in the simplest case where the structure of both matrices is identical. The most efficient approach will depend a lot of the structure of the two matrices being added.
Most codes that support addition do it by converting the matrices back to dense (or perhaps a block if the format and code supports slicing), performing the addition, then converting the results back to sparse. It is normally a very inefficient operation which is usually best avoided (and it usually can be).
I would expect it to be much, much faster than the alternative sparse addition operation. You can use something like CUBLAS axpy to add the vectors produced by the sparse matrix-vector products.