cuda - cusparse sparse plus dense matrix addition -
is possible add sparse matrix , dense matrix using cusparse? in cublas, i'd treat matrices vectors , use axpy. cusparse have axpy sparse/dense vectors, cannot used matrices because sparse vectors , matrices have different memory structure.
cusparse has dense-to-sparse , sparse-to-dense conversion routines. could:
- convert sparse matrix dense (e.g.
cusparse<t>csr2dense
), add 2cublas<t>geam
, producing dense matrix result - convert dense matrix sparse (e.g.
cusparse<t>dense2csr
), usecusparse<t>csrgeam
produce sparse result
note using cusparse<t>geam
little bit more involved single function call, usage methodology given in the documentation. also, when using cusparse<t>dense2csr
, want use cusparse<t>nnz
storage allocations needed.
Comments
Post a Comment