Last active
July 16, 2020 09:32
-
-
Save aradi/39ab88acfbacc3b2f44d1e41e4da15e7 to your computer and use it in GitHub Desktop.
DFTB+ custom cmake config for developers
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Get host name to enable host dependent settings | |
site_name(host_name) | |
# | |
# Overriding (pre-populating) options in config.cmake | |
# | |
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Build type (Release|Debug)") | |
option(WITH_API "Whether API should be built" FALSE) | |
option(WITH_MPI "Whether MPI should be used" FALSE) | |
option(WITH_SOCKETS "Whether socket communication should allowed for" FALSE) | |
option(WITH_DFTD3 "Whether the DFTD3 library should be included" FALSE) | |
option(WITH_TRANSPORT "Whether transport via libNEGF should be enabled" FALSE) | |
if(NOT WITH_MPI) | |
option(WITH_ARPACK "Whether the ARPACK library should be included" FALSE) | |
else() | |
option(WITH_ARPACK "Whether the ARPACK library should be included" FALSE) | |
endif() | |
option(WITH_PLUMED "Whether PLUMED support should be compiled in" TRUE) | |
# | |
# Overriding (pre-populating) options of the toolchain file | |
# | |
if("${host_name}" STREQUAL "core604") | |
# Checking for the toolchain as multiple toolchains are possible on this machine | |
if(NOT DEFINED ENV{DFTBPLUS_TOOLCHAIN} OR ENV{DFTBPLUS_TOOLCHAIN} STREQUAL "") | |
message(FATAL_ERROR "The custom cmake file contains toolchain dependent options and requires " | |
"therefore an explicit toolchain selection via the DFTBPLUS_TOOLCHAIN environment variable") | |
endif() | |
if("${DFTBPLUS_TOOLCHAIN}" STREQUAL "gnu") | |
set(TEST_OMP_THREADS "1" CACHE STRING "Number of threads to use for each test") | |
set(TEST_MPI_PROCS "1" CACHE STRING "Number of mpi processes to use for each test") | |
if(WITH_MPI AND NOT WITH_OPENMP) | |
set(TEST_RUNNER_TEMPLATE | |
"env OMP_NUM_THREADS=\${TEST_OMP_THREADS} mpiexec --bind-to hwthread -n \${TEST_MPI_PROCS}" | |
CACHE STRING "How to run the tests") | |
endif() | |
set(SCALAPACK_LIBRARIES "scalapack" CACHE STRING "Scalapack libraries to link") | |
set(SCALAPACK_LIBRARY_DIRS "$ENV{HOME}/opt/scalapack/2.0.2-gnu8-omp3.1/lib" | |
CACHE STRING "Directories where Scalapack libraries can be found") | |
set(ARPACK_LIBRARY_DIRS "$ENV{HOME}/opt/arpack-ng/3.7.0-gnu8/lib" | |
CACHE STRING "Directories where Arpack libraries can be found") | |
if(WITH_MPI) | |
set(LAPACK_LIBRARY_DIRS "$ENV{HOME}/opt/lapack/3.8.0-gnu8/lib" | |
CACHE STRING "Paths to scan when looking for the LAPACK/BLAS libraries") | |
else() | |
set(LAPACK_LIBRARY_DIRS "$ENV{HOME}/opt/openblas/0.3.6-gnu8/lib/" CACHE STRING | |
"Paths to scan when looking for the LAPACK/BLAS libraries") | |
endif() | |
set(ELSI_ROOT "$ENV{HOME}/opt/elsi/2.5-gnu8-omp3.1" CACHE STRING | |
"Root directory of the ELSI installation") | |
set(PEXSI_EXTERNAL_LIBRARY_DIRS "$ENV{HOME}/opt/gcc/8.3/lib64" CACHE STRING | |
"Directories with PEXSI libraries") | |
# We only use the C-inteface of plumed, which should be only MPI but not compiler dependent | |
if(WITH_MPI) | |
set(PLUMED_LIBRARY_DIRS "$ENV{HOME}/opt/plumed/2.5.3-gnu8-ompi3.1/lib" CACHE STRING | |
"Directories to scan for PLUMED libraries") | |
else() | |
set(PLUMED_LIBRARY_DIRS "$ENV{HOME}/opt/plumed/2.5.3-gnu8-serial/lib" CACHE STRING | |
"Directories to scan for PLUMED libraries") | |
endif() | |
elseif("${DFTBPLUS_TOOLCHAIN}" STREQUAL "intel") | |
set(ARPACK_LIBRARY_DIRS "$ENV{HOME}//opt/arpack-ng/3.7.0-intel19/lib" | |
CACHE STRING "Directories where Arpack libraries can be found") | |
set(ELSI_ROOT "$ENV{HOME}/opt/elsi/2.5-intel19-mpich3.3" CACHE STRING | |
"Root directory of the ELSI installation") | |
# We only use the C-inteface of plumed, which should be only MPI but not compiler dependent | |
if(WITH_MPI) | |
set(PLUMED_LIBRARY_DIRS "$ENV{HOME}/opt/plumed/2.5.3-nag6.2-mpich3.3/lib" CACHE STRING | |
"Directories to scan for PLUMED libraries") | |
else() | |
set(PLUMED_LIBRARY_DIRS "$ENV{HOME}/opt/plumed/2.5.3-gnu8-serial/lib" CACHE STRING | |
"Directories to scan for PLUMED libraries") | |
endif() | |
elseif("${DFTBPLUS_TOOLCHAIN}" STREQUAL "nag") | |
# NAG seems to have problems with OpenMP parallelisation in DEBUG mode | |
if("${CMAKE_BUILD_TYPE}" STREQUAL "Debug") | |
option(WITH_OMP "Whether OpenMP thread parallisation should be enabled" FALSE) | |
endif() | |
set(SCALAPACK_LIBRARY_DIRS "$ENV{HOME}/opt/scalapack/2.0.2-nag62-mpich3.3/lib" | |
CACHE STRING "Directories where Scalapack libraries can be found") | |
#set(SCALAPACK_LIBRARY_DIRS "$ENV{HOME}/opt/scalapack/2.0.2-nag62-omp4.0/lib" | |
# CACHE STRING "Directories where Scalapack libraries can be found") | |
set(SCALAPACK_LIBRARIES "libscalapack.a" CACHE STRING "Scalapack library") | |
set(LAPACK_LIBRARY_DIRS | |
"$ENV{HOME}/opt/lapack/3.8.0-nag62/lib" CACHE STRING | |
"Directories where Lapack/Blas libraries can be found") | |
set(LAPACK_LIBRARIES "liblapack.a;libblas.a" CACHE STRING "Lapack/Blas library") | |
set(ELSI_ROOT "$ENV{HOME}/opt/elsi/2.5-nag62-mpich3.3" CACHE STRING | |
"Root directory of the ELSI installation") | |
#set(ELSI_ROOT "$ENV{HOME}/opt/elsi/nag62-omp4.0" CACHE STRING | |
# "Root directory of the ELSI installation") | |
set(PEXSI_EXTERNAL_LIBRARY_DIRS "/usr/lib/gcc/x86_64-linux-gnu/7" CACHE STRING | |
"Directories with external PEXSI libraries") | |
# We only use the C-inteface of plumed, which should be only MPI but not compiler dependent | |
if(WITH_MPI) | |
set(PLUMED_LIBRARY_DIRS "$ENV{HOME}/opt/plumed/2.5.3-nag6.2-mpich3.3/lib" CACHE STRING | |
"Directories to scan for PLUMED libraries") | |
else() | |
set(PLUMED_LIBRARY_DIRS "$ENV{HOME}/opt/plumed/2.5.3-gnu8-serial/lib" CACHE STRING | |
"Directories to scan for PLUMED libraries") | |
endif() | |
elseif("${DFTBPLUS_TOOLCHAIN}" STREQUAL "pgi") | |
set(ARPACK_LIBRARIES "arpack_pgi" CACHE STRING "Arpack library") | |
set(ARPACK_LIBRARY_DIRS "$ENV{HOME}/local/opt/arpack/lib" | |
CACHE STRING "Directories where Arpack libraries can be found") | |
set(PGI_LIBDIR "$ENV{HOME}/local/opt/pgi/18.10/linux86-64/18.10/lib" CACHE STRING | |
"Directory containing PGI libraries") | |
set(SCALAPACK_LIBRARY_DIRS "${PGI_LIBDIR}/scalapack/scalapack-2.0.2/openmpi-2.1.2/lib" | |
CACHE STRING "Directories where Scalapack libraries can be found") | |
set(LAPACK_LIBRARY_DIRS "${PGI_LIBDIR}" CACHE STRING | |
"Directories where LAPACK and BLAS libraries can be found") | |
else() | |
message(FATAL_ERROR "Uknown toolchain '${DFTBPLUS_TOOLCHAIN}'") | |
endif() | |
elseif("${host_name}" STREQUAL "noys") | |
set(PLUMED_LIBRARY_DIRS "$ENV{HOME}/opt/plumed/2.5.3/lib" CACHE STRING | |
"Directories to scan for PLUMED libraries") | |
#set(Fortran_FLAGS "-funroll-loops" CACHE STRING "Flags for Fortran compiler") | |
elseif("${host_name}" STREQUAL "dpdevel.bccms.uni-bremen.de") | |
set(LAPACK_LIBRARIES "openblas" CACHE STRING "LAPACK library") | |
else() | |
message(FATAL_ERROR "Unknown host '${host_name}'") | |
endif() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment