Update to support ELPA 2025, new options to build the density matrix, and better GPU handling
This MR supersedes that in !381 (closed). Please see the thread in that MR for a full discussion of the changes that have gone into this MR. This MR does the following things:
- Introduces better handling of how to build the density matrix, via the refactoring and extension of the
elsi_build_dm_edm_{real|complx}routines. ELSI will attempt to use the best method to build the density matrix, depending on the runtime conditions. Additionally users can specify which method they wish to use for building the density matrix, via theelsi_set_build_dm_methodroutine. - The CMake infrastructure for ELPA has been expanded, to allow automatic setting of the CMake variable
ELPA_API_VERSIONbased on either the version of internal ELPA chosen, or via querying theelpa_version.hfile in an externally installed version of ELPA. This querying is accomplished via a CMake finder script,FindExternalELPA.cmake. TheELPA_API_VERSIONhas also been added to the Fortran template fileelsi_version.f90.in, to allow for use in ELSI. It is used in determining whether the ELPA_PXGEMM method to build the density matrix is possible at the current ELPA API level, and whether to callsetup_gpu()in ELPA (both only possible in ELPA API >= 20250131). - The CMake finder script also sets a lot of other CMake variables from searching for the ELPA pkg-config file, and
elpa_constants.hheader file, as well aselpa_configured_options.h(if available). - The
FindExternalELPA.cmakescript is run viafind_package(ExternalELPA)inCMakeLists.txt, only if ELSI is the top level project. If it is a sub-project, such as when used by electronic structure codes, it is the responsibility of the electronic structure code to callfind_package(ExternalELPA)to e.g. avoid the parent project repeating the search for ELPA if it is otherwise already done by them. - The CMake minimum version has been bumped to 3.6 to facilitate some features in
FindExternalELPA.cmake. - The manual has been updated with these new features.
- CMakeLists.txt for SCOTCH has been updated to fix compilation problems.
This MR fixes #79 (closed) and that issue can be closed. I believe #70 (closed) can also be closed too.
It should also be noted that the ELPA_AT_A method should be available in the upcoming ELPA version 2025.06.002, and now not only in the internal ELPA 2020, thanks to the efforts of the ELPA team, in particular Petr Karpov (@pekarp).
Edited by James Green