Accelerating linear solvers for large-scale Stokes problems with C++ metaprogramming.
Denis Demidov, Lin Mu, Bin Wang · arXiv (Cornell University) · 2020
Ability to solve large sparse linear systems of equations is very important in modern numerical methods. Creating a solver with a user-friendly interface that can work in many specific scenarios is a challenging task. We describe the C ++ programming techniques that can help in creating flexible and extensible programming interfaces for linear solvers. The approach is based on policy-based design and partial template specialization, and is implemented in the open source AMGCL library. Convenience for the user and efficiency is demonstrated on the example of accelerating a large-scale Stokes problem solution with a Schur pressure correction preconditioner. The user may select algorithmic components of the solver by adjusting template parameters without any change to the codebase. It is also possible to switch to block values, or use mixed precision solution, which results in up to 4 times speedup, and reduces the memory footprint of the algorithm by about 50%.