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?
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).