0
votes

I am trying to compute A^TA using cuSparse. A is a large but sparse matrix. The proper function to use based on the documentation is cusparseDcsrgemm2. However, this is one of the few cuSparse operations that doesn't support an optional built-in transpose for the input matrix. There's a line in the documentation that said

Only the NN version is supported. For other modes, the user has to transpose A or B explicitly.

The problem is I couldn't find a function in cuSparse that can perform a transpose. I know I can transpose in CPU and copy it to the GPU but that will slow down the application. Am I missing something? What is the right way to use cuSparse to compute A^TA?

1
@RobertCrovella you are right... csc is the transpose of csr. If you write an answer I will accept it, thanks! - user3667089

1 Answers

2
votes

For matrices that are in CSR (or CSC) format:

The CSR sparse representation of a matrix has identical format/memory layout as the CSC sparse representation of its transpose.

Therefore, if we use the cusparse provided function to convert a CSR format matrix into a CSC format, that resultant CSC-format matrix is actually the same as the CSR representation of the transpose of the original matrix. Therefore this CSR-to-CSC conversion routine could be used to find the transpose of a CSR format sparse matrix. (It can similarly be used to find the transpose of a CSC format sparse matrix.)