1.4 CMake variables
Here are some of the commonly used CMake variables.
-
•
CMAKE_Fortran_COMPILER — Name of the Fortran compiler executable. Use a full path if location not automatically detected.
-
•
CMAKE_Fortran_FLAGS — Compilation flags that control the optimization level and other features that the compiler will use.
-
•
LIB_PATHS — List of directories to search in when linking against external libraries (e.g., “/opt/intel/mkl/lib/intel64”)
-
•
Fortran_MIN_FLAGS — Compilation flags only for files that should not be optimized because optimization is not needed. For example, the source file “read_control.f90” only controls how the input file control.in is read - but some compilers spend excessive amounts of time compiling this file if a different optimization level than “-O0” is specified.
-
•
LIBS — List of libraries to link against
(e.g., “mkl_blacs_intelmpi_lp64 mkl_scalapack_lp64”) -
•
USE_MPI — Whether to use MPI parallelization when building FHI-aims. This should always be enabled except for rare debugging purposes. (Default: automatically determined by the compiler)
-
•
USE_SCALAPACK — Whether to use Scalapack’s parallel linear algebra subroutines and the basic linear algebra communications (BLACS) subroutines. It is recommended to always use this option. In particular, large production runs are not possible without it. The Scalapack libraries themselves should be set in LIB_PATHS and LIBS. (Default: automatically determined by LIBS)
-
•
CMAKE_C_COMPILER — C compiler.
-
•
CMAKE_CXX_COMPILER — C++ compiler.
-
•
CMAKE_C_FLAGS — C compiler flags.
-
•
CMAKE_CXX_FLAGS — C++ compiler flags.
-
•
USE_LIBXC — Whether additional subroutines for exchange correlation functionals, provided in the LibXC library, should be used. By default, this is ON, i.e. LibXC will be compiled into the executable. It is advised to always use this. Please respect the open-source license of this tool and cite the authors if you use it.
-
•
USE_SPGLIB — Whether the Spglib library for symmetry handling will be used. By deafult, this is ON, i.e. Spglib will be compiled into the executable. Please respect the open-source license of this tool and cite the authors if you use it.
For all CMake variables, see Sec. H.2.
For a detailed step-by-step cmake tutorial, please visit: https://fhi-aims-club.gitlab.io/tutorials/cmake-tutorial/ or https://aims-git.rz-berlin.mpg.de/aims/FHIaims/-/wikis/CMake\%20Tutorial
1.4.1 MPI parallelization
On current computers, there is never a reason to compile FHI-aims without support for MPI in productions. Nevertheless, for testing purposes, it may sometimes be useful to compile without MPI support. We therefore cover this possibility here, also exemplifying how to manipulate CMake in a slightly more refined way.
In order to force MPI to be disabled, put
set(USE_MPI OFF CACHE BOOL "")
into the initial cache file. In order to force MPI to be enabled, use
set(USE_MPI ON CACHE BOOL "")
instead. If you want to enable/disable MPI support after the first configuration, issue
ccmake ~build
where build is the build directory. Move cursor to the field USE_MPI and hit enter. This toggles its state between ON/OFF. Hit ’c’ to configure, ’g’ to generate the build files, and rebuild the project.