Sunday, July 12, 2020

ARPACK sparse eigenvalues and GPU

I am trying to learn how to find eigenvalues and eigenvectors of a sparse matrix. A good example problem are electronic orbitals of the hydrogen atom. This paper gives a good introduction:


https://www.mdpi.com/2218-2004/6/2/22/pdf
The structure of the matrix is like this:


A CUDA kernel that implements the matrix vector product looks like this: 

I use ARPACK++ with its reverse communication interface to compute the matrix vector products on the an RTX 2060 GPU.
 The results are similar to the benchmark results listed in the paper:
The radial component of the wavefunction of the ground state looks like this:


The source code is available on github:
 Note that the C++ and CUDA code is generated from Common Lisp source https://github.com/plops/cl-cpp-generator2/blob/master/example/27_sparse_eigen_hydrogen/gen00.lisp.