Search code examples
c++sparse-matrixeigenopenacc

OpenACC - Sparse Matrix Library


I'm using OpenACC for sparse matrix computation in C++. I need to use matrix operations within OpenACC regions.

Are there any sparse matrix libraries compatible with OpenACC?

I'm used to Eigen but it seems that it isn't compatible with OpenACC unless I manually modify the source code, which doesn't sound a good idea...


Solution

  • If you're targeting an NVIDIA GPU, PGI's implementation of OpenACC is interoperable with cuSparse, meaning you can share data between the calls to the library and your OpenACC code. Assuming you're using PGI, examples can be found in $PGI/linux86-64/2016/examples/CUDA-Libraries/cuSPARSE/. Note that cuSPARSE does not have device side routines and must be called from the host. However, OpenACC managed device data can be passed to cuSPARSE routines via the "host_data" directive.

    cuBLAS does have device routines which you can use within OpenACC compute regions. Of course, these are not tuned for Sparse matrix operations.