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 the elsi_set_build_dm_method routine.
  • The CMake infrastructure for ELPA has been expanded, to allow automatic setting of the CMake variable ELPA_API_VERSION based on either the version of internal ELPA chosen, or via querying the elpa_version.h file in an externally installed version of ELPA. This querying is accomplished via a CMake finder script, FindExternalELPA.cmake. The ELPA_API_VERSION has also been added to the Fortran template file elsi_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 call setup_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.h header file, as well as elpa_configured_options.h (if available).
  • The FindExternalELPA.cmake script is run via find_package(ExternalELPA) in CMakeLists.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 call find_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

Merge request reports

Loading