About changing the values of a dense vector while using cuSPARSE (original) (raw)

Hi, I have a function that multiplies a sparser matrix with a dense vector on a loop where the values of the dense vector changes each iteration. To change the values of the dense vector, can I just overwrite the data on the device using memcpy or do I need to malloc and memcpy the new values to a new location and then use cusparseDnVecSetValues?

Thanks!

You can overwrite the data in place without calling cusparseDnVecSetValues. For an example of this, see the cg_example.c, which calls cusparseSpMV in a loop on a vector that’s being modified by other routines (e.g. cublasDscal and cublasDaxpy).

system Closed June 9, 2025, 2:59pm 4

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