4
votes

I first process a matrix in cublas, I have already sent it to device and I want to process some column vector of the matrix, still use cublas function. I first try using pointer arithmetic operation to offset the device pointer from host, but it seems doesn't work. Is there any way I can process vector in matrix without copying it back to host.

for example: cublasSscal (int n, float alpha, float *x, int incx); is used to scale a vector I have a device pointer point to a column major matrix B, i want scale the third column of B and without copy the vector back to host, how to do it?

1
you should post some code which troubles youAnycorn

1 Answers

3
votes

m is the number of rows, ldB is the leading dimension of B.

cublasSscal (m, alpha, B + 2*ldB, 1); //  indices are 0 based