I am using cusp for sparse matrix multiplication. From the resultant matrix i need the max value without copying the matrix from device memory to host memory. I am planning to wrap the resultant matrix in thrust device pointer and then use the function thrust::max_element to get max element. The matrices are in coo format. If C is resultant sparse matrix then
C.row_indices[] : contains row number
C.column_indices[]: contains column number
C.values[]: contain actual value
So basically i need highest value from C.values array.
Using
thrust::device_ptr<int> dev_ptr = C.values;
is giving error
error: no instance of constructor "thrust::device_ptr<T>::device_ptr [with T=int]" matches the argument list
argument types are: (cusp::array1d<float, cusp::host_memory>)
How can i wrap my resultant matrix in order to use it in thrust library ?
If my device matrix definition is like this:
Then try this: