CSR matrices in CUDA.jl

I can create CSC matrices on the GPU, e.g. via cu(sprand(10,10,0.1)). How do I create CSR matrices? How do I convert a CSC into a CSR matrix on the CPU or GPU?

I want to use csreigvsi, which requires CSR storage structure.

Call the CuSparseMatrixCSR constructor. Have a look at the CUDA.jl test suite (test/cusparse.jl and test/cusparse/*), there’s plenty of examples there.

1 Like

A CSR matrix can be constructed from a sparse matrix A via CUSPARSE.CuSparseMatrixCSR(A). The element type of A will be conserved. The element type of the CSR matrix on the GPU can be directly specified via e.g. CUSPARSE.CuSparseMatrixCSR{Float32}(A).