Search code examples
cudaopenclsparse-matrixcsrcusp-library

Converting from COO to Compressed sparse matrix


I wanted CSR files preferably from matrix market for my OpenCL library, I searched a lot for CSR generators in C but didn't get any. I find matrix market formats comfortable since they have defined the functions for read and write. I'm also curious how CUSP library in CUDA C is able to read COO matrix from an .mtx file and can convert it to CSR format. Thanks in advance


Solution

  • You can see the code for reading matrices in cusp::io.

    Before you go reinventing the wheel, you might want to take a look at ViennaCL, which already include OpenCL CSR matrix types, an spMV implementation, and a number of iterative solvers built on that spMV implementation.