Cmake starting point for shared/common.

This commit is contained in:
Pierre Kestener 2022-03-09 23:55:52 +01:00 committed by Marc Sarraute
parent f0a29e90d7
commit 336ba35fa9
120 changed files with 8594 additions and 5 deletions

926
CMakeLists.txt Normal file
View File

@ -0,0 +1,926 @@
# using 3.18 to have nice lapack imported target
cmake_minimum_required(VERSION 3.18)
#
# User resources to help writing CMake for fortran projects:
# - book: CMake CookBook + https://github.com/dev-cafe/cmake-cookbook
# - https://cliutils.gitlab.io/modern-cmake/
# - https://enccs.github.io/cmake-workshop/cxx-fortran/
# - https://github.com/scivision/fortran2018-examples
# - MKL + pkg-config : https://www.intel.com/content/www/us/en/developer/articles/technical/intel-math-kernel-library-intel-mkl-and-pkg-config-tool.html?wapkw=mkl%20pkgconfig
#
# Allow find_package() to use <PackageName>_ROOT variables,
# either cmake variable or environment variables
# see https://cmake.org/cmake/help/latest/policy/CMP0074.html
#
if(NOT CMAKE_VERSION VERSION_LESS 3.12)
cmake_policy(SET CMP0074 NEW)
endif()
project(abinit
LANGUAGES C CXX Fortran
VERSION 9.9.0
HOMEPAGE_URL https://www.abinit.org/
DESCRIPTION "ABINIT is an atomic-scale simulation software suite.")
#
# Export compile command to json (for editors like emacs, clion, vim, etc...).
# It allows nice code editing features provided by LSP (Language Server Protocol)
#
set(CMAKE_EXPORT_COMPILE_COMMANDS on)
#
# default local cmake macro repository (located in abinit top level sources)
#
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake/Modules")
#
# Enforce user to use a build directory outside of source tree
#
include(prevent_build_in_source)
prevent_build_in_source()
#
# Set default compile optimization flag
#
if (NOT CMAKE_BUILD_TYPE AND NOT CMAKE_CONFIGURATION_TYPES)
set(DEFAULT_BUILD_TYPE "RelWithDebInfo")
message(STATUS "Setting build type to '${DEFAULT_BUILD_TYPE}' as none was specified.")
set(CMAKE_BUILD_TYPE "${DEFAULT_BUILD_TYPE}" CACHE STRING
"Choose the type of build, options are: Debug, Release, RelWithDebInfo and MinSizeRel." FORCE)
# Set the possible values of build type for cmake-gui
set_property(CACHE CMAKE_BUILD_TYPE PROPERTY STRINGS
"Debug" "Release" "MinSizeRel" "RelWithDebInfo")
endif ()
#
# Use CPM project manager for external dependencies.
# See https://github.com/TheLartians/CPM.cmake for more info
#
#include(cmake/CPM.cmake)
#
# Mixing Fortran and C
#
include(FortranCInterface)
FortranCInterface_VERIFY()
FortranCInterface_HEADER(
fc_mangle.h
MACRO_NAMESPACE "FC_"
)
string(TOLOWER ${CMAKE_BUILD_TYPE} build_type)
if (build_type STREQUAL debug)
set(DEBUG_MODE 1)
endif()
# output dir for libraries
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/lib
CACHE
PATH "Single output directory for building all libraries.")
#------------------------------------------------------------------------------#
#
# Additional compiler flags, compiler specific
#
#------------------------------------------------------------------------------#
include(compiler_setup)
#------------------------------------------------------------------------------#
#
# Top level Options
#
#------------------------------------------------------------------------------#
include(options)
#------------------------------------------------------------------------------#
#
# Check external dependencies
#
#------------------------------------------------------------------------------#
#
# BLAS / LAPACK setup
#
# this is controlled by cmake var BLA_VENDOR
# available values slightly depends on cmake version
# currently in cmake 3.18, valid values are
#
# Goto
# OpenBLAS
# FLAME
# ATLAS PhiPACK
# CXML
# DXML
# SunPerf
# SCSL
# SGIMATH
# IBMESSL
# Intel10_32 (intel mkl v10 32 bit)
# Intel10_64lp (intel mkl v10+ 64 bit, threaded code, lp64 model)
# Intel10_64lp_seq (intel mkl v10+ 64 bit, sequential code, lp64 model)
# Intel10_64ilp (intel mkl v10+ 64 bit, threaded code, ilp64 model)
# Intel10_64ilp_seq (intel mkl v10+ 64 bit, sequential code, ilp64 model)
# Intel10_64_dyn (intel mkl v10+ 64 bit, single dynamic library)
# Intel (obsolete versions of mkl 32 and 64 bit)
# ACML
# ACML_MP
# ACML_GPU
# Apple
# NAS
# Arm
# Arm_mp
# Arm_ilp64
# Arm_ilp64_mp
# Generic
#
# NOTE:
# - if variable BLA_VENDOR is not set, all vendors are considered.
# - if multiple implementation are available on your system, the first to be detected,
# will be considered
#
# Recommended value for MKL : Intel10_32
find_package(BLAS)
find_package(LAPACK)
#
# Select FFT flavor
# available flavors are: FFTW3, MKL_DFTI, GOEDECKER, PFFT
#
set(ABINIT_FFT_FLAVOR "FFTW3" CACHE STRING
"Possible FFT flavors are: FFTW3, MKL_DFTI, GOEDECKER or PFFT")
set_property(CACHE ABINIT_FFT_FLAVOR PROPERTY STRINGS FFTW3 MKL_DFTI GOEDECKER PFFT)
#
# Select SCALAPACK flavor
# available flavors are: NETLIB, MKL
#
# Important notes regarding MKL:
#
# If ABINIT_SCALAPACK_FLAVOR is MKL then scalapack/mkl
#
# User must provide env variable MKL_ROOT if SCALAPACK/MKL
# is desired.
#
# Other variables of interest that are used to initialize
# MKL_BLAS_FLAVOR_DEFAULT and MKL_SCALAPACK_FLAVOR_DEFAULT
# - MKL_XX_BIT (32bit or 64bit)
# - MKL_THREADING_TYPE (omp or seq)
#
# User can override directly MKL_BLAS_FLAVOR and MKL_SCALAPACK_FLAVOR
#
set(ABINIT_SCALAPACK_FLAVOR "NETLIB" CACHE STRING
"Possible SCALAPACK flavors are: NETLIB or MKL")
set_property(CACHE ABINIT_SCALAPACK_FLAVOR PROPERTY STRINGS NETLIB MKL)
#####################################################################
# checking for optional external dependencies :
# - MPI (OpenMPI, IntelMPI, MPICH, etc...)
# - OpenMP
# - MKL (Intel classic or newest OneAPI/MKL ?)
# - Scalapack (MKL or Netlib)
# - Libxc
#
# For each external dependency, you can :
# - instruct cmake to search for a particular directory
# using either env variable or cmake variable <PackageName>_ROOT
# - (recommended) set env variable PKG_CONFIG_PATH to specify a list
# of directories containing pkgconfig files (extension .pc)
# - (preferred) whenever possible, if dependency provides a cmake script
# to detect it, just set env variable CMAKE_PREFIX_PATH
#
# On a supercomputer, most of the time, the modules environment will
# set either PKG_CONFIG_PATH and CMAKE_PREFIX_PATH
#####################################################################
# Enable MODULE mode (via pkg-config) to find packages
# see https://cmake.org/cmake/help/latest/command/find_package.html
find_package(PkgConfig REQUIRED)
#
# MPI
#
set(MPI_DETERMINE_LIBRARY_VERSION TRUE)
find_package(MPI COMPONENTS Fortran C CXX)
if(MPI_FOUND)
add_compile_definitions(HAVE_MPI)
endif()
# determine mpi vendor (MPI_VENDOR)
# valid values are : OpenMPI, MPICH or IntelMPI
include(get_mpi_vendor)
get_mpi_vendor()
if (NOT DEFINED MPI_VERSION AND DEFINED MPI_Fortran_VERSION)
set(MPI_VERSION ${MPI_Fortran_VERSION})
set(MPI_VERSION_MAJOR ${MPI_Fortran_VERSION_MAJOR})
set(MPI_VERSION_MINOR ${MPI_Fortran_VERSION_MINOR})
endif()
if (MPI_FOUND)
# try to detect if our MPI implementation is cuda-aware
# 1. If using OpenMPI, then try to parse output of ompi_info
# 2. If using MPICH, TODO
# 3. Other MPI impl, TODO
if (ABINIT_ENABLE_GPU_CUDA)
if (MPI_VENDOR STREQUAL "OpenMPI")
find_program(OMPI_INFO
NAMES ompi_info
HINTS ${MPI_CXX_LIBRARIES}/../bin)
# Full command line to probe if cuda support in MPI implementation is enabled
# ompi_info --parsable --all | grep mpi_built_with_cuda_support:value
if (OMPI_INFO)
execute_process(COMMAND ${OMPI_INFO}
OUTPUT_VARIABLE _output)
if ( (_output MATCHES "smcuda") )
message(STATUS "Found OpenMPI with CUDA-aware support available.")
set(HAVE_GPU_MPI 1)
else()
message(WARNING "OpenMPI found, but it is not built with CUDA support.")
endif()
endif(OMPI_INFO)
endif()
if (MPI_VENDOR STREQUAL "MPICH")
# TODO
endif()
if (MPI_VENDOR STREQUAL "IntelMPI")
# TODO
endif()
# unconditionally set HAVE_GPU_MPI if the user say so
# this may be need because our detection above is not bullet proof
if (ABINIT_ENFORCE_CUDA_AWARE_MPI)
set(HAVE_GPU_MPI 1)
endif()
endif(ABINIT_ENABLE_GPU_CUDA)
endif(MPI_FOUND)
#
# OpenMP
#
find_package(OpenMP)
# check for OpenMP collapse clause support
if(OpenMP_FOUND)
set(HAVE_OPENMP 1)
try_compile(HAVE_OMP_COLLAPSE_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_omp_collapse.F90
LINK_LIBRARIES OpenMP::OpenMP_Fortran)
if(HAVE_OMP_COLLAPSE_BOOL)
set(HAVE_OMP_COLLAPSE 1)
endif()
endif()
#
# Kokkos : https://github.com/kokkos/kokkos
#
include(build_or_find_kokkos)
#
# YAKL : https://github.com/mrnorman/YAKL
#
include(build_or_find_yakl)
#
# Scalapack setup
#
if (ABINIT_SCALAPACK_ENABLED)
# setup abinit to use either netlib or mkl scalapack
include(scalapack_setup)
endif()
#
# ELPA setup
#
if (ABINIT_ELPA_ENABLED)
pkg_check_modules(ABINIT_ELPA QUIET IMPORTED_TARGET elpa)
if(ABINIT_ELPA_FOUND)
message("ELPA found via pkg-config")
set(ELPA_FOUND TRUE)
add_library(abinit::elpa ALIAS PkgConfig::ABINIT_ELPA)
endif()
endif()
#
# Libxc
# 1. prefer using pkg-config,
# 2. use cmake target file if not found with pkg-config
#
pkg_check_modules(ABINIT_LIBXC QUIET IMPORTED_TARGET libxc)
if(ABINIT_LIBXC_FOUND)
message("Libxc found via pkg-config")
set(Libxc_FOUND TRUE)
#set(Libxc_VERSION ${LibxcPkg_VERSION})
#set(Libxc_INCLUDE_DIRS ${LibxcPkg_INCLUDE_DIRS})
add_library(abinit::libxc ALIAS PkgConfig::ABINIT_LIBXC)
else()
find_package(Libxc REQUIRED)
message("Libxc found via cmake target")
endif()
if(Libxc_FOUND)
add_compile_definitions(HAVE_LIBXC)
set(HAVE_LIBXC 1)
endif()
#
# FFT FLAVOR :
#
if(ABINIT_FFT_FLAVOR STREQUAL "FFTW3")
# use regular fftw3 library
pkg_check_modules(ABINIT_FFTW3 QUIET IMPORTED_TARGET fftw3 fftw3f)
if(ABINIT_FFTW3_FOUND)
message("Selected fft flavor is FFTW3")
add_library(abinit::fft ALIAS PkgConfig::ABINIT_FFTW3)
set(HAVE_FFTW3 1)
else()
message(WARNING "Please adjust environment variable PKG_CONFIG_PATH to setup path to")
message(WARNING "fftw3.pc or select another fft flavor.")
message(FATAL_ERROR "fft flavor FFTW3 can't be found")
endif()
# TODO : search for fftw3_threads and create imported target
# set(HAVE_FFTW3_THREADS 1)
# TODO : search for fftw3_mpi and create imported target
# set(HAVE_FFTW3_MPI 1)
elseif(ABINIT_FFT_FLAVOR STREQUAL "MKL_DFTI")
# Note: OneMKL (version >= 2021.3) provides a MKLConfig.cmake, usually available
# by setting env variable CMAKE_PREFIX_PATH to ${MKLROOT}/lib/cmake
find_package(MKL)
if(MKL_FOUND)
message("Selected fft flavor is MKL_DFTI")
# TODO : create imported target for mkl_intel_ilp64 / mkl_intel
add_library(abinit::fft ALIAS MKL::MKL)
else()
message(WARNING "Please check your env variable CMAKE_PREFIX_PATH to contain path to")
message(WARNING "MKLConfig.cmake (located into your intel OneAPI install path) or selected another flavor")
message(FATAL_ERROR "MKL is not found, and thus MKL_DFTI fft flavor can't be set")
endif()
elseif(ABINIT_FFT_FLAVOR STREQUAL "PFFT")
pkg_check_modules(ABINIT_PFFT QUIET IMPORTED_TARGET pfft)
if(ABINIT_PFFT_FOUND)
message("pfft found via pkg-config")
add_library(abinit::fft ALIAS PkgConfig::ABINIT_PFFT)
set(HAVE_PFFT 1)
else()
message(FATAL_ERROR "pfft NOT FOUND, selected another flavor or adjust env variable PKG_CONFIG_PATH")
endif()
message("Selected fft flavor is PFFT")
elseif(ABINIT_FFT_FLAVOR STREQUAL "GOEDECKER")
message("Selected fft flavor is GOEDECKER (internal implementation, no link flags required).")
# WARNING: abinit::fft alias is not defined
endif()
#
# LEVMAR : use LevMar with cmake build-system
# see : https://github.com/pkestene/levmar-cmake
#
find_package(levmar)
if(levmar_FOUND)
add_library(abinit::levmar ALIAS levmar::levmar)
set(HAVE_LEVMAR 1)
else()
message("levmar NOT FOUND")
endif()
#
# LIBPSML : TODO
#
pkg_check_modules(ABINIT_LIBPSML QUIET IMPORTED_TARGET libpsml)
if(ABINIT_LIBPSML_FOUND)
message("libpsml found via pkg-config")
add_library(abinit::libpsml ALIAS PkgConfig::ABINIT_LIBPSML)
set(HAVE_LIBPSML 1)
else()
message("libpsml NOT FOUND")
endif()
#
# HDF5
#
# HDF5 is not really used for now apparently
if (ABINIT_ENABLE_PARALLEL_HDF5)
set(HDF5_PREFER_PARALLEL TRUE)
endif()
find_package(HDF5)
if(HDF5_FOUND)
message("HDF5 found via find_package")
add_library(abinit::hdf5 ALIAS HDF5::HDF5)
set(HAVE_HDF5 1)
if(HDF5_IS_PARALLEL)
set(HAVE_HDF5_MPI 1)
endif()
endif(HDF5_FOUND)
#
# NetCDF_C / NetCDF_Fortran
#
pkg_check_modules(ABINIT_NETCDF QUIET IMPORTED_TARGET netcdf)
if(ABINIT_NETCDF_FOUND)
message("netcdf found via pkg-config")
add_library(abinit::netcdf ALIAS PkgConfig::ABINIT_NETCDF)
else()
message("netcdf NOT FOUND")
endif()
pkg_check_modules(ABINIT_NETCDF_FORTRAN QUIET IMPORTED_TARGET GLOBAL netcdf-fortran)
if(ABINIT_NETCDF_FORTRAN_FOUND)
message("netcdf-fortran found via pkg-config : ${ABINIT_NETCDF_FORTRAN_PREFIX}")
# kind of fix to make sure path PREFIX/include (where netcdf.mod is located)
# is append in include dirs used in abinit::netcdf-fortran
pkg_get_variable(ABINIT_NETCDF_FORTRAN_PREFIX netcdf-fortran prefix)
get_target_property(ABINIT_NETCDF_FORTRAN_INC_TMP PkgConfig::ABINIT_NETCDF_FORTRAN INTERFACE_INCLUDE_DIRECTORIES)
list(APPEND ABINIT_NETCDF_FORTRAN_INC_TMP "${ABINIT_NETCDF_FORTRAN_PREFIX}/include")
set_target_properties(PkgConfig::ABINIT_NETCDF_FORTRAN PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${ABINIT_NETCDF_FORTRAN_INC_TMP}")
add_library(abinit::netcdf-fortran ALIAS PkgConfig::ABINIT_NETCDF_FORTRAN)
else()
message("netcdf-fortran NOT FOUND")
endif()
if (MPI_FOUND)
pkg_check_modules(ABINIT_NETCDF_MPI QUIET IMPORTED_TARGET netcdf-mpi)
if(ABINIT_NETCDF_MPI_FOUND)
message("netcdf-mpi found via pkg-config")
add_library(abinit::netcdf-mpi ALIAS PkgConfig::ABINIT_NETCDF_MPI)
#set(HAVE_NETCDF_MPI 1) => see generate_config.h
else()
message("netcdf-mpi NOT FOUND")
endif()
endif()
#
# PAPI
#
pkg_check_modules(ABINIT_PAPI QUIET IMPORTED_TARGET papi)
if(ABINIT_PAPI_FOUND)
# check if f90papi.h is available
# note : can't use check_include_file macro here, because f90papi.h contains
# actually fortran code
find_path(PAPI_INCLUDE_F90PAPI NAMES f90papi.h
HINTS ${ABINIT_PAPI_INCLUDE_DIRS})
if (PAPI_INCLUDE_F90PAPI-NOTFOUND)
message("f90papi.h not found")
else()
set(HAVE_F90PAPI_H 1)
endif()
# check if papi.h is available
include(CheckIncludeFile)
set(CMAKE_REQUIRED_INCLUDES ${ABINIT_PAPI_INCLUDEDIR})
check_include_file(papi.h HAVE_PAPI_H_BOOL)
set(CMAKE_REQUIRED_INCLUDES)
if(HAVE_PAPI_H_BOOL)
set(HAVE_PAPI_H 1)
endif()
add_library(abinit::papi ALIAS PkgConfig::ABINIT_PAPI)
message("papi found via pkg-config")
else()
message("papi NOT FOUND")
endif()
#
# TRIQS : TODO improve
# to help cmake detect TRIQS:
# - set env var or cmake var TRIQS_ROOT to the root path of triqs install directory
# - set env var CMAKE_PREFIX_PATH (usually by a modulefile on a supercomputer)
#
find_package(TRIQS)
if(TRIQS_FOUND)
add_library(abinit::triqs ALIAS triqs)
set(HAVE_TRIQS 1)
# NOT sure about this, is TRIQS 3.x compatible with 2.0 ?
# (TODO : check with someone who knows triqs)
# Besides, it looks like currently abiniti is not compatible with triqs 3.x,
# some porting is needed
# if (TRIQS_VERSION_MAJOR VERSION_EQUAL "3")
# set(DO_BUILD_67_TRIQS_EXT ON)
# set(HAVE_TRIQS_v3 1)
# set(HAVE_TRIQS_v2_0 1)
# endif()
if (TRIQS_VERSION_MAJOR VERSION_EQUAL "2" AND TRIQS_VERSION_MINOR VERSION_EQUAL "0")
set(DO_BUILD_67_TRIQS_EXT ON)
set(HAVE_TRIQS_v2_0 1)
endif()
if (TRIQS_VERSION_MAJOR VERSION_EQUAL "1" AND TRIQS_VERSION_MINOR VERSION_EQUAL "4")
set(DO_BUILD_67_TRIQS_EXT ON)
set(HAVE_TRIQS_v1_4 1)
endif()
#get_property(TRIQS_COMPILE_DEFINITIONS TARGET triqs PROPERTY INTERFACE_COMPILE_DEFINITIONS)
#get_property(TRIQS_COMPILE_FEATURES TARGET triqs PROPERTY INTERFACE_COMPILE_FEATURES)
#get_property(TRIQS_COMPILE_OPTIONS TARGET triqs PROPERTY INTERFACE_COMPILE_OPTIONS)
get_property(TRIQS_INCLUDE_DIRECTORIES TARGET triqs PROPERTY INTERFACE_INCLUDE_DIRECTORIES)
get_property(TRIQS_LINK_LIBRARIES TARGET triqs PROPERTY INTERFACE_LINK_LIBRARIES)
else()
message("triqs NOT FOUND")
endif()
#
# WANNIER
#
include(build_or_find_wannier90)
#
# libxml2
#
pkg_check_modules(ABINIT_XML2 QUIET IMPORTED_TARGET libxml-2.0)
if(ABINIT_XML2_FOUND)
message("xml2 found via pkg-config")
add_library(abinit::xml2 ALIAS PkgConfig::ABINIT_XML2)
set(HAVE_XML 1)
else()
message("xml2 NOT FOUND")
endif()
#
# XMLF90
#
pkg_check_modules(ABINIT_XMLF90 QUIET IMPORTED_TARGET xmlf90)
if(ABINIT_XMLF90_FOUND)
message("xmlf90 found via pkg-config")
add_library(abinit::xmlf90 ALIAS PkgConfig::ABINIT_XMLF90)
set(HAVE_XMLF90 1)
else()
message("xmlf90 NOT FOUND")
endif()
#
# AtomPAW
#
pkg_check_modules(ABINIT_ATOMPAW QUIET IMPORTED_TARGET atompaw)
if(ABINIT_ATOMPAW_FOUND)
message("atompaw found via pkg-config")
add_library(abinit::atompaw ALIAS PkgConfig::ABINIT_ATOMPAW)
set(HAVE_ATOMPAW 1)
else()
message("atompaw NOT FOUND")
endif()
#
# BigDFT
#
pkg_check_modules(ABINIT_BIGDFT QUIET IMPORTED_TARGET bigdft)
if(ABINIT_BIGDFT_FOUND)
message("bigdft found via pkg-config")
add_library(abinit::bigdft ALIAS PkgConfig::ABINIT_BIGDFT)
set(HAVE_BIGDFT 1)
else()
message("bigdft NOT FOUND")
endif()
#
# Generate config.h
#
include(generate_config_h)
##################### PRINT CONFIGURE STATUS ######################
message("//===================================================")
message("// ${PROJECT_NAME} build configuration:")
message("// ${PROJECT_NAME} version : ${PROJECT_VERSION}")
message("//===================================================")
message(" CMake version : ${CMAKE_VERSION}")
if (NOT CMAKE_BUILD_TYPE)
message(" CMake build type : NOT SET !")
else()
message(" CMake build type : ${CMAKE_BUILD_TYPE}")
endif()
message(" CMake install prefix : ${CMAKE_INSTALL_PREFIX}")
message(" CMake system processor : ${CMAKE_SYSTEM_PROCESSOR}")
message(" CMake system name (OS) : ${CMAKE_SYSTEM_NAME}")
message("")
message(" Fortran compiler Id : ${CMAKE_Fortran_COMPILER_ID}")
message(" Fortran compiler version : ${CMAKE_Fortran_COMPILER_VERSION}")
message(" Fortran compiler exe : ${CMAKE_Fortran_COMPILER}")
message(" Fortran flags : ${CMAKE_Fortran_FLAGS}")
message(" Fortran compiler wrapper : ${CMAKE_Fortran_COMPILER_WRAPPER}")
message("")
message(STATUS "MPI config:")
message(" MPI found : ${MPI_FOUND}")
message(" MPI standard version : ${MPI_Fortran_VERSION}")
# note : make sure you correctly your C, C++ and Fortran compiler
# through variable CC, CXX and FC
message(" MPI_VENDOR : ${MPI_VENDOR}")
message(" MPI library version : ${MPI_Fortran_LIBRARY_VERSION_STRING}")
message(" MPI fortran compiler : ${MPI_Fortran_COMPILER}")
message(" MPI headers : ${MPI_Fortran_INCLUDE_DIRS}")
message(" MPI libraries : ${MPI_Fortran_LIBRARIES}")
#message(" MPI link flags : ${MPI_Fortran_LINK_FLAGS}")
message("")
message(STATUS "OpenMP config :")
message(" OpenMP found : ${OpenMP_FOUND}")
message(" OpenMP version : ${OpenMP_Fortran_VERSION}")
message("")
message(STATUS "Kokkos config :")
message(" Kokkos wanted : ${ABINIT_KOKKOS_WANTED}")
if(ABINIT_KOKKOS_WANTED)
message(" ABINIT_KOKKOS_BUILD : ${ABINIT_KOKKOS_BUILD}")
if (ABINIT_KOKKOS_BUILD)
message(" ABINIT_KOKKOS_BACKEND : ${ABINIT_KOKKOS_BACKEND}")
message(" Kokkos_ENABLE_HWLOC : ${Kokkos_ENABLE_HWLOC}")
message(" Kokkos_ENABLE_OPENMP : ${Kokkos_ENABLE_OPENMP}")
message(" Kokkos_ENABLE_CUDA : ${Kokkos_ENABLE_CUDA}")
else()
message(" Using installed Kokkos : ${Kokkos_DIR}")
message(" Kokkos version : ${Kokkos_VERSION}")
message(" Kokkos_CXX_COMPILER : ${Kokkos_CXX_COMPILER}")
message(" Kokkos_CXX_COMPILER_ID : ${Kokkos_CXX_COMPILER_ID}")
message(" Kokkos_CXX_STANDARD : ${Kokkos_CXX_STANDARD}")
message(" Kokkos_OPTIONS : ${Kokkos_OPTIONS}")
message(" Kokkos_TPLS : ${Kokkos_TPLS}")
message(" Kokkos_DIRS : ${Kokkos_DIR}")
endif()
message(" CMAKE_CXX_STANDARD : ${CMAKE_CXX_STANDARD}")
endif()
message("")
message(STATUS "Yakl config :")
message(" YAKL wanted : ${ABINIT_YAKL_WANTED}")
if(ABINIT_YAKL_WANTED)
message(" YAKL_ARCH : ${YAKL_ARCH}")
endif()
message("")
message(STATUS "BLAS config:")
message(" BLA_VENDOR : ${BLA_VENDOR}")
if (BLAS_FOUND)
message(" BLAS_LINKER_FLAGS : ${BLAS_LINKER_FLAGS}")
message(" BLAS_LIBRARIES : ${BLAS_LIBRARIES}")
else()
message(" BLAS not found ! Please recheck your environment variables.")
endif()
message("")
message(STATUS "LAPACK config:")
message(" BLA_VENDOR : ${BLA_VENDOR}")
if (LAPACK_FOUND)
message(" LAPACK_LINKER_FLAGS : ${LAPACK_LINKER_FLAGS}")
message(" LAPACK_LIBRARIES : ${LAPACK_LIBRARIES}")
else()
message(" LAPACK not found ! Please recheck your environment variables.")
endif()
message("")
message(STATUS "ScaLapack config:")
message(" ABINIT_SCALAPACK_ENABLED : ${ABINIT_SCALAPACK_ENABLED}")
if(ABINIT_SCALAPACK_ENABLED)
message(" ABINIT_SCALAPACK_FLAVOR : ${ABINIT_SCALAPACK_FLAVOR}")
if(ABINIT_SCALAPACK_FLAVOR MATCHES "MKL")
message(" MKL found : ${MKL_FOUND}")
message(" MKL_BLAS_FLAVOR : ${MKL_BLAS_FLAVOR}")
message(" MKL_BLAS_FLAVOR_FOUND : ${MKL_BLAS_FLAVOR_FOUND}")
message(" MKL blas headers : ${MKL_BLAS_HEADERS}")
message(" MKL blas libraries : ${MKL_BLAS_LIBRARIES}")
message(" MKL_SCALAPACK_FLAVOR : ${MKL_SCALAPACK_FLAVOR}")
message(" MKL_SCALAPACK_FLAVOR_FOUND : ${MKL_SCALAPACK_FLAVOR_FOUND}")
message(" MKL scalapack headers : ${MKL_SCALAPACK_HEADERS}")
message(" MKL scalapack libraries : ${MKL_SCALAPACK_LIBRARIES}")
elseif(ABINIT_SCALAPACK_FLAVOR MATCHES "NETLIB")
message(" ScaLapack found : ${scalapack_FOUND}")
message(" Scalapack dir : ${scalapack_DIR}")
message(" Scalapack found via pkg-config : ${scalapack_found_using_pkg_config}")
message(" Scalapack found via cmake cfg : ${scalapack_found_using_cmake_target}")
endif()
endif()
message("")
message(STATUS "ELPA config:")
message(" ABINIT_ELPA_ENABLED : ${ABINIT_ELPA_ENABLED}")
if(ABINIT_ELPA_ENABLED)
message(" ELPA found : ${ABINIT_ELPA_FOUND}")
message(" ELPA version : ${ABINIT_ELPA_VERSION}")
message(" ELPA cflags : ${ABINIT_ELPA_CFLAGS}")
message(" ELPA ldflags : ${ABINIT_ELPA_LDFLAGS}")
endif()
message("")
#
# TODO PK : add the possibility to detect a version of libpaw already installed
#
message(STATUS "Libpaw config (only internal version is possible for now):")
message(" Libpaw (abinit) : ${HAVE_LIBPAW_ABINIT}")
message("")
message(STATUS "Libxc config:")
message(" Libxc found : ${Libxc_FOUND}")
message(" Libxc dir : ${Libxc_DIR}")
message(" Libxc version : ${Libxc_VERSION}")
message(" Libxc headers : ${Libxc_INCLUDE_DIRS}")
message(" Libxc libraries : ${Libxc_LIBRARIES}")
message("")
message(STATUS "fftw3 config")
message(" fftw3 found : ${ABINIT_FFTW3_FOUND}")
message(" fftw3 version : ${ABINIT_FFTW3_VERSION}")
message(" fftw3 cflags : ${ABINIT_FFTW3_CFLAGS}")
message(" fftw3 ldflags : ${ABINIT_FFTW3_LDFLAGS}")
message("")
message(STATUS "libpsml config")
message(" libpsml found : ${ABINIT_LIBPSML_FOUND}")
message(" libpsml version : ${ABINIT_LIBPSML_VERSION}")
message(" libpsml cflags : ${ABINIT_LIBPSML_CFLAGS}")
message(" libpsml ldflags : ${ABINIT_LIBPSML_LDFLAGS}")
message("")
message(STATUS "netcdf-c config")
message(" netcdf-c found : ${ABINIT_NETCDF_FOUND}")
message(" netcdf-c prefix : ${ABINIT_NETCDF_PREFIX}")
message(" netcdf-c version : ${ABINIT_NETCDF_VERSION}")
message(" netcdf-c inc dirs : ${ABINIT_NETCDF_INCLUDE_DIRS}")
message(" netcdf-c cflags : ${ABINIT_NETCDF_CFLAGS}")
message(" netcdf-c cflags other : ${ABINIT_NETCDF_CFLAGS_OTHER}")
message(" netcdf-c ldflags : ${ABINIT_NETCDF_LDFLAGS}")
message("")
message(STATUS "netcdf-fortran config")
message(" netcdf-fortran found : ${ABINIT_NETCDF_FORTRAN_FOUND}")
message(" netcdf-fortran prefix : ${ABINIT_NETCDF_FORTRAN_PREFIX}")
message(" netcdf-fortran version : ${ABINIT_NETCDF_FORTRAN_VERSION}")
message(" netcdf-fortran inc dirs : ${ABINIT_NETCDF_FORTRAN_INCLUDE_DIRS}")
message(" netcdf-fortran cflags : ${ABINIT_NETCDF_FORTRAN_CFLAGS}")
message(" netcdf-fortran cflags other : ${ABINIT_NETCDF_FORTRAN_CFLAGS_OTHER}")
message(" netcdf-fortran ldflags : ${ABINIT_NETCDF_FORTRAN_LDFLAGS}")
message(" netcdf C/MPI support : ${HAVE_NETCDF_MPI}")
message(" netcdf fortran/MPI support : ${HAVE_NETCDF_FORTRAN_MPI}")
message("")
message(STATUS "papi config")
message(" papi found : ${ABINIT_PAPI_FOUND}")
message(" papi version : ${ABINIT_PAPI_VERSION}")
message(" papi cflags : ${ABINIT_PAPI_CFLAGS}")
message(" papi ldflags : ${ABINIT_PAPI_LDFLAGS}")
message("")
message(STATUS "pfft config")
message(" pfft found : ${ABINIT_PFFT_FOUND}")
message(" pfft version : ${ABINIT_PFFT_VERSION}")
message(" pfft cflags : ${ABINIT_PFFT_CFLAGS}")
message(" pfft ldflags : ${ABINIT_PFFT_LDFLAGS}")
message("")
message(STATUS "wannier90 config")
if (ABINIT_WANNIER90_WANTED)
message(" wannier90 builtin : ${ABINIT_WANNIER90_BUILTIN}")
message(" wannier90 found : ${ABINIT_WANNIER90_FOUND}")
message(" wannier90 root : ${WANNIER_ROOT}")
message(" wannier90 version : ${ABINIT_WANNIER90_VERSION}")
message(" wannier90 include dir : ${ABINIT_WANNIER90_INCLUDE_DIR}")
message(" wannier90 library : ${ABINIT_WANNIER90_LIBRARY}")
else()
message(" wannier90 not wanted")
endif()
message("")
message(STATUS "triqs config")
message(" triqs found : ${TRIQS_FOUND}")
message(" triqs version : ${TRIQS_VERSION}")
message(" triqs root : ${TRIQS_ROOT}")
message(" triqs python support : ${TRIQS_WITH_PYTHON_SUPPORT}")
#message(" triqs compile definitions : ${TRIQS_COMPILE_DEFINITIONS}")
#message(" triqs compile features : ${TRIQS_COMPILE_FEATURES}")
#message(" triqs compile options : ${TRIQS_COMPILE_OPTIONS}")
message(" triqs include dir : ${TRIQS_INCLUDE_DIRECTORIES}")
message(" triqs link libraries : ${TRIQS_LINK_LIBRARIES}")
message("")
message(STATUS "xmlf90 config")
message(" xmlf90 found : ${ABINIT_XMLF90_FOUND}")
message(" xmlf90 version : ${ABINIT_XMLF90_VERSION}")
message(" xmlf90 cflags : ${ABINIT_XMLF90_CFLAGS}")
message(" xmlf90 ldflags : ${ABINIT_XMLF90_LDFLAGS}")
message("")
message(STATUS "xml-2.0 config")
message(" xml-2.0 found : ${ABINIT_XML2_FOUND}")
message(" xml-2.0 version : ${ABINIT_XML2_VERSION}")
message(" xml-2.0 cflags : ${ABINIT_XML2_CFLAGS}")
message(" xml-2.0 ldflags : ${ABINIT_XML2_LDFLAGS}")
message("")
message(STATUS "AtomPaw config")
message(" AtomPAW found : ${ABINIT_ATOMPAW_FOUND}")
message(" AtomPAW version : ${ABINIT_ATOMPAW_VERSION}")
message(" AtomPAW cflags : ${ABINIT_ATOMPAW_CFLAGS}")
message(" AtomPAW ldflags : ${ABINIT_ATOMPAW_LDFLAGS}")
message("")
message(STATUS "BigDFT config")
message(" BigDFT found : ${ABINIT_BIGDFT_FOUND}")
message(" BigDFT version : ${ABINIT_BIGDFT_VERSION}")
message(" BigDFT cflags : ${ABINIT_BIGDFT_CFLAGS}")
message(" BigDFT ldflags : ${ABINIT_BIGDFT_LDFLAGS}")
message("")
message(STATUS "GPU config")
message(" CUDA enabled : ${ABINIT_ENABLE_GPU_CUDA}")
if (ABINIT_ENABLE_GPU_CUDA)
message(" CUDA compiler ID : ${CMAKE_CUDA_COMPILER_ID}")
message(" CUDA compiler Version : ${CMAKE_CUDA_COMPILER_VERSION}")
message(" C++ Compiler : ${CMAKE_CXX_COMPILER_ID} "
"${CMAKE_CXX_COMPILER_VERSION} "
"${CMAKE_CXX_COMPILER_WRAPPER}")
message(" ${CMAKE_CXX_COMPILER}")
message(" CUDA Compiler : ${CMAKE_CUDA_COMPILER}")
message(" CUDA Compiler exec : ${CUDA_NVCC_EXECUTABLE}")
message(" CUDA Compile flags : ${CMAKE_CUDA_FLAGS}")
message(" CUDA toolkit found : ${CUDAToolkit_FOUND}")
message(" CUDA toolkit version : ${CUDAToolkit_VERSION}")
message(" CUDA toolkit nvcc : ${CUDAToolkit_NVCC_EXECUTABLE}")
endif()
message("")
message(STATUS "ENV{PKG_CONFIG_PATH} was :")
message(" $ENV{PKG_CONFIG_PATH}")
message("")
message(STATUS "ENV{CMAKE_PREFIX_PATH} was :")
message(" $ENV{CMAKE_PREFIX_PATH}")
message("")
add_subdirectory(shared)
add_subdirectory(src)
# --- make git ignore build directory
if(NOT EXISTS ${PROJECT_BINARY_DIR}/.gitignore)
file(WRITE ${PROJECT_BINARY_DIR}/.gitignore "*")
endif()
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/tests)
#
# Robodoc
#
set(ROBODOC_DONE_FILE "robodoc_done")
add_custom_command(OUTPUT ${ROBODOC_DONE_FILE}
COMMAND rm -rf tmp-robodoc robodoc-html
COMMAND mkdir tmp-robodoc
COMMAND cp -rfL ${CMAKE_SOURCE_DIR}/shared/common/src/[0-3]* tmp-robodoc
COMMAND cp -rf ${CMAKE_SOURCE_DIR}/src/[4-9]* tmp-robodoc
COMMAND cp ${CMAKE_SOURCE_DIR}/config/robodoc/robodoc-html.rc tmp-robodoc/robodoc.rc
COMMAND cd tmp-robodoc && rm -f */*.in && rm -f */interfaces* && robodoc > ../robodoc.log 2> ../robodoc.err
COMMAND mv -f tmp-robodoc/www/robodoc robodoc-html
COMMAND ${CMAKE_COMMAND} -E tar "zcf" "robodoc-html-${CMAKE_PROJECT_VERSION}.tar.gz" robodoc-html
COMMAND rm -rf robodoc-html tmp-robodoc
COMMAND cat ${CMAKE_SOURCE_DIR}/doc/developers/robodoc.doc.txt >> robodoc.err
WORKING_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}
COMMENT "Generating documentation with ROBODOC"
)
add_custom_target(robodoc DEPENDS ${ROBODOC_DONE_FILE})
#
# Install
#
include(abinit_install)
#
# Test
#
include(abinit_test)

13
abinit.pc.in Normal file
View File

@ -0,0 +1,13 @@
prefix=@prefix@
exec_prefix=@exec_prefix@
bindir=@bindir@
includedir=@includedir@
libdir=@libdir@
Name: abinit
Description: Atomic-scale simulation software
Version: @VERSION@
URL: https://www.abinit.org/
Requires:
Libs: -L${libdir} -labinit
Cflags: -I${includedir}

25
cmake/CPM.cmake Normal file
View File

@ -0,0 +1,25 @@
#
# source : https://github.com/cpm-cmake/CPM.cmake/blob/master/cmake/get_cpm.cmake
#
set(CPM_DOWNLOAD_VERSION 0.35.5)
if(CPM_SOURCE_CACHE)
# Expand relative path. This is important if the provided path contains a tilde (~)
get_filename_component(CPM_SOURCE_CACHE ${CPM_SOURCE_CACHE} ABSOLUTE)
set(CPM_DOWNLOAD_LOCATION "${CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
elseif(DEFINED ENV{CPM_SOURCE_CACHE})
set(CPM_DOWNLOAD_LOCATION "$ENV{CPM_SOURCE_CACHE}/cpm/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
else()
set(CPM_DOWNLOAD_LOCATION "${CMAKE_BINARY_DIR}/cmake/CPM_${CPM_DOWNLOAD_VERSION}.cmake")
endif()
if(NOT (EXISTS ${CPM_DOWNLOAD_LOCATION}))
message(STATUS "Downloading CPM.cmake to ${CPM_DOWNLOAD_LOCATION}")
file(DOWNLOAD
https://github.com/cpm-cmake/CPM.cmake/releases/download/v${CPM_DOWNLOAD_VERSION}/CPM.cmake
${CPM_DOWNLOAD_LOCATION}
)
endif()
include(${CPM_DOWNLOAD_LOCATION})

View File

@ -0,0 +1,106 @@
#
# This file is borrowed and slightly modified from
# https://github.com/eschnett/MPIwrapper/blob/main/cmake/CheckMPIFeatures.cmake
#
# function CheckMPIFeatures provides helper to check if MPI implementation
# has the runtime ability to probe GPU-awareness
# - cuda-aware (Nvidia GPU),
# - hip-aware (AMD GPU),
# - ze-aware (INTEL GPU)
#
#
# Apparently Intel MPI (as of version 2021.7.0) doesn't provide header mpi-ext.h, too bad.
#
include(CheckCSourceCompiles)
function(CheckMPIFeatures)
if (NOT DEFINED HAVE_MPI_EXT OR NOT DEFINED MPI_HAS_QUERY_CUDA_SUPPORT)
list(JOIN MPI_COMPILE_FLAGS " " CMAKE_REQUIRED_FLAGS)
#set(CMAKE_REQUIRED_INCLUDES ${MPI_INCLUDE_PATH})
#set(CMAKE_REQUIRED_LIBRARIES ${MPI_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES MPI::MPI_C)
# We cannot use check_include_file here as <mpi.h> needs to be
# included before <mpi-ext.h>, and check_include_file doesn't
# support this.
check_c_source_compiles(
"
#include <mpi.h>
#include <mpi-ext.h>
int main() {
return 0;
}
"
HAVE_MPI_EXT)
if(NOT HAVE_MPI_EXT)
set(HAVE_MPI_EXT 0)
else()
set(HAVE_MPI_EXT 1)
endif()
list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_MPI_EXT=${HAVE_MPI_EXT})
check_c_source_compiles(
"
#include <mpi.h>
#if HAVE_MPI_EXT
#include <mpi-ext.h>
#endif
int main() {
int result = MPIX_Query_cuda_support();
return 0;
}
"
MPI_HAS_QUERY_CUDA_SUPPORT)
if(NOT MPI_HAS_QUERY_CUDA_SUPPORT)
set(MPI_HAS_QUERY_CUDA_SUPPORT 0)
else()
set(MPI_HAS_QUERY_CUDA_SUPPORT 1)
endif()
check_c_source_compiles(
"
#include <mpi.h>
#if HAVE_MPI_EXT
#include <mpi-ext.h>
#endif
int main() {
int result = MPIX_Query_hip_support();
return 0;
}
"
MPI_HAS_QUERY_HIP_SUPPORT)
if(NOT MPI_HAS_QUERY_HIP_SUPPORT)
set(MPI_HAS_QUERY_HIP_SUPPORT 0)
else()
set(MPI_HAS_QUERY_HIP_SUPPORT 1)
endif()
check_c_source_compiles(
"
#include <mpi.h>
#if HAVE_MPI_EXT
#include <mpi-ext.h>
#endif
int main() {
int result = MPIX_Query_ze_support();
return 0;
}
"
MPI_HAS_QUERY_ZE_SUPPORT)
if(NOT MPI_HAS_QUERY_ZE_SUPPORT)
set(MPI_HAS_QUERY_ZE_SUPPORT 0)
else()
set(MPI_HAS_QUERY_ZE_SUPPORT 1)
endif()
list(REMOVE_ITEM CMAKE_REQUIRED_DEFINITIONS -DHAVE_MPI_EXT)
endif()
endfunction()
CheckMPIFeatures()

72
cmake/FindWANNIER.cmake Normal file
View File

@ -0,0 +1,72 @@
# FindWANNIER.cmake
# -----------------
#
# Try to find wannier library (use env variable WANNIER_ROOT as a hint).
#
# Note a recent version of wannier (>= mid 2022) should a package-config file;
# when using a old version of wannier, use find_package(WANNIER) instead.
#
# Recommendation:
# if you use module-environment, just make sure variable WANNIER_ROOT is set to
# top-level directory where wannier was install.
#
# Result Variables
# ----------------
#
# This module defines the following variables::
#
# WANNIER_FOUND - True if WANNIER was found
# WANNIER_INCLUDE_DIRS - include directories for WANNIER
# WANNIER_LIBRARIES - link against this library to use WANNIER
#
# The module will also define two cache variables::
#
# WANNIER_INCLUDE_DIR - the WANNIER include directory
# WANNIER_LIBRARY - the path to the WANNIER library
#
if(NOT WANNIER_ROOT)
if (DEFINED ENV{WANNIER_ROOT})
set(WANNIER_ROOT $ENV{WANNIER_ROOT})
message(STATUS "Env variable WANNIER_ROOT was defined : $ENV{WANNIER_ROOT}")
else()
message(STATUS "Env variable WANNIER_ROOT not defined...")
endif()
endif()
find_path (WANNIER_INCLUDE_DIR
NAMES w90_hamiltonian.mod
HINTS ${WANNIER_ROOT})
mark_as_advanced (WANNIER_INCLUDE_DIR)
message(STATUS "WANNIER_INCLUDE_DIR : ${WANNIER_INCLUDE_DIR}")
find_library (WANNIER_LIBRARY
NAMES wannier
HINTS ${WANNIER_ROOT})
mark_as_advanced (WANNIER_LIBRARY)
message(STATUS "WANNIER_LIBRARY : ${WANNIER_LIBRARY}")
# handle the QUIETLY and REQUIRED arguments and set WANNIER_FOUND to TRUE if
# all listed variables are TRUE
include (FindPackageHandleStandardArgs)
find_package_handle_standard_args (WANNIER
REQUIRED_VARS WANNIER_LIBRARY WANNIER_INCLUDE_DIR)
if (WANNIER_FOUND)
set (WANNIER_INCLUDE_DIRS ${WANNIER_INCLUDE_DIR})
else (WANNIER_FOUND)
message("WANNIER nor found")
endif (WANNIER_FOUND)
if(WANNIER_FOUND AND NOT TARGET abinit::wannier)
add_library(abinit::wannier SHARED IMPORTED)
set_target_properties(abinit::wannier PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${WANNIER_INCLUDE_DIR}"
IMPORTED_LOCATION "${WANNIER_LIBRARY}")
endif()
set(ABINIT_WANNIER_FOUND ${WANNIER_FOUND})
set(ABINIT_WANNIER_INCLUDE_DIR ${WANNIER_INCLUDE_DIR})
set(ABINIT_WANNIER_LIBRARY ${WANNIER_LIBRARY})

View File

@ -0,0 +1,5 @@
@PACKAGE_INIT@
include(${CMAKE_CURRENT_LIST_DIR}/@targets_export_name@.cmake)
check_required_components(@PROJECT_NAME@ @PROJECT_NAME@_lib)

118
cmake/abinit_install.cmake Normal file
View File

@ -0,0 +1,118 @@
# gnu compatibility,
# see https://cmake.org/cmake/help/latest/module/GNUInstallDirs.html
include(GNUInstallDirs)
################################# EXPORT CONFIG #################################
include(CMakePackageConfigHelpers)
# setup some variables
set(version_config ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake)
set(project_config_src ${PROJECT_SOURCE_DIR}/cmake/${PROJECT_NAME}-config.cmake.in)
set(project_config_dst ${PROJECT_BINARY_DIR}/${PROJECT_NAME}-config.cmake)
set(targets_export_name ${PROJECT_NAME}-targets)
# important variables
set(INSTALL_BINDIR ${CMAKE_INSTALL_BINDIR} CACHE STRING
"Installation directory for executables, relative to ${CMAKE_INSTALL_PREFIX}.")
set(INSTALL_LIBDIR ${CMAKE_INSTALL_LIBDIR} CACHE STRING
"Installation directory for libraries, relative to ${CMAKE_INSTALL_PREFIX}.")
set(INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR} CACHE STRING
"Installation directory for include files, relative to ${CMAKE_INSTALL_PREFIX}.")
set(INSTALL_PKGCONFIG_DIR ${CMAKE_INSTALL_LIBDIR}/pkgconfig CACHE PATH
"Installation directory for pkgconfig (.pc) files, relative to ${CMAKE_INSTALL_PREFIX}.")
set(INSTALL_CMAKE_DIR ${CMAKE_INSTALL_LIBDIR}/cmake CACHE STRING
"Installation directory for cmake files, relative to ${CMAKE_INSTALL_PREFIX}.")
# Generate the version, config and target files into the build directory.
write_basic_package_version_file(
${version_config}
VERSION ${PROJECT_VERSION}
COMPATIBILITY AnyNewerVersion)
# Generate cmake my_package-config.cmake file
configure_package_config_file(
${project_config_src}
${project_config_dst}
INSTALL_DESTINATION ${INSTALL_CMAKE_DIR})
# Use a namespace because CMake provides better diagnostics
# for namespaced imported targets.
export(
TARGETS abinit_lib
NAMESPACE abinit::
FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake)
export(
TARGETS 39_libpaw 33_xc_lowlevel 28_numeric_noabirule 27_toolbox_oop 18_timing 17_yaml_out 16_hideleave 14_hidewrite 12_hide_mpi 11_memory_mpi 10_defs 02_clib
NAMESPACE abinit::
APPEND FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake)
if (ABINIT_ENABLE_GPU_CUDA)
export(
TARGETS 17_gpu_toolbox
NAMESPACE abinit::
APPEND FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake)
endif()
if (ABINIT_ENABLE_GPU_CUDA AND ABINIT_YAKL_BUILD)
export(
TARGETS yakl
NAMESPACE abinit::
APPEND FILE ${PROJECT_BINARY_DIR}/${targets_export_name}.cmake)
endif()
# macro helper to generate pkg-config file abinit.pc
include(generate_pkgconfig)
generate_pkgconfig(abinit)
# install executables and libabinit
# archive => static libraries
# runtime => shared libraries
install(
TARGETS abinit abitk aim anaddb atdep band2eps conducti cut3d dummy_tests fftprof
fold2Bloch ioprof lapackprof macroave mrgddb mrgdv mrggkk mrgscr multibinit
optic testtransposer ujdet vdw_kernelgen
abinit_lib 39_libpaw 33_xc_lowlevel 28_numeric_noabirule 27_toolbox_oop 18_timing 17_yaml_out 16_hideleave 14_hidewrite 12_hide_mpi 11_memory_mpi 10_defs 02_clib
EXPORT ${targets_export_name}
ARCHIVE DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT bin
)
if (ABINIT_ENABLE_GPU_CUDA)
install(
TARGETS 17_gpu_toolbox
EXPORT ${targets_export_name}
ARCHIVE DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT bin
)
endif()
if (ABINIT_ENABLE_GPU_CUDA AND ABINIT_YAKL_BUILD)
install(
TARGETS yakl
EXPORT ${targets_export_name}
ARCHIVE DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
LIBRARY DESTINATION ${INSTALL_LIBDIR} COMPONENT lib
RUNTIME DESTINATION ${INSTALL_BINDIR} COMPONENT bin
)
endif()
# install cmake config and targets
install(
FILES ${project_config_dst} ${version_config}
DESTINATION ${INSTALL_CMAKE_DIR})
install(
EXPORT ${targets_export_name}
DESTINATION ${INSTALL_CMAKE_DIR}
NAMESPACE abinit::)
# install pkgconfig
install(
FILES ${CMAKE_BINARY_DIR}/${PROJECT_NAME}.pc
DESTINATION "${INSTALL_PKGCONFIG_DIR}")

57
cmake/abinit_test.cmake Normal file
View File

@ -0,0 +1,57 @@
#
# Some test target
#
add_custom_target(check-local)
add_custom_command(
TARGET check-local
POST_BUILD
COMMAND cat ${CMAKE_SOURCE_DIR}/tests/built-in/README)
add_custom_target(test_fast)
add_custom_command(
TARGET test_fast
POST_BUILD
COMMAND cp ${CMAKE_BINARY_DIR}/src/98_main/abinit ${CMAKE_SOURCE_DIR}/tests/built-in/Input/abinit && cd ${CMAKE_SOURCE_DIR}/tests/built-in/Input && export ABI_PSPDIR="${CMAKE_SOURCE_DIR}/tests/Psps_for_tests" && ./abinit testin_fast.abi >& testin_fast.stdout && cat testin_fastt_STATUS && rm -f abinit *DDB *EIG *out* *nc *WFK *abo* *o_* *t_STATUS*
)
add_custom_target(test_v1)
add_custom_command(
TARGET test_v1
POST_BUILD
COMMAND cp ${CMAKE_BINARY_DIR}/src/98_main/abinit ${CMAKE_SOURCE_DIR}/tests/built-in/Input/abinit && cd ${CMAKE_SOURCE_DIR}/tests/built-in/Input && export ABI_PSPDIR="${CMAKE_SOURCE_DIR}/tests/Psps_for_tests" && ./abinit testin_v1.abi >& testin_v1.stdout && cat testin_v1t_STATUS && rm -f abinit *DDB *EIG *out* *nc *WFK *abo* *o_* *t_STATUS*
)
add_custom_target(test_v5)
add_custom_command(
TARGET test_v5
POST_BUILD
COMMAND cp ${CMAKE_BINARY_DIR}/src/98_main/abinit ${CMAKE_SOURCE_DIR}/tests/built-in/Input/abinit && cd ${CMAKE_SOURCE_DIR}/tests/built-in/Input && export ABI_PSPDIR="${CMAKE_SOURCE_DIR}/tests/Psps_for_tests" && ./abinit testin_v5.abi >& testin_v5.stdout && cat testin_v5t_STATUS && rm -f abinit *DDB *EIG *out* *nc *WFK *abo* *o_* *t_STATUS*
)
if (TARGET abinit::libbigdft)
add_custom_target(test_bigdft)
add_custom_command(
TARGET test_bigdft
POST_BUILD
COMMAND cp ${CMAKE_BINARY_DIR}/src/98_main/abinit ${CMAKE_SOURCE_DIR}/tests/built-in/Input/abinit && cd ${CMAKE_SOURCE_DIR}/tests/built-in/Input && export ABI_PSPDIR="${CMAKE_SOURCE_DIR}/tests/Psps_for_tests" && ./abinit testin_bigdft.abi >& testin_bigdft.stdout && cat testin_bigdftt_STATUS && rm -f abinit *DDB *EIG *out* *nc *WFK *abo* *o_* *t_STATUS*)
endif()
if (TARGET abinit::libxc)
add_custom_target(test_libxc)
add_custom_command(
TARGET test_libxc
POST_BUILD
COMMAND cp ${CMAKE_BINARY_DIR}/src/98_main/abinit ${CMAKE_SOURCE_DIR}/tests/built-in/Input/abinit && cd ${CMAKE_SOURCE_DIR}/tests/built-in/Input && export ABI_PSPDIR="${CMAKE_SOURCE_DIR}/tests/Psps_for_tests" && ./abinit testin_libxc.abi >& testin_libxc.stdout && cat testin_libxct_STATUS && rm -f abinit *DDB *EIG *out* *nc *WFK *abo* *o_* *t_STATUS*)
endif()
if (TARGET abinit::wannier)
add_custom_target(test_wannier90)
add_custom_command(
TARGET test_wannier90
POST_BUILD
COMMAND cp ${CMAKE_BINARY_DIR}/src/98_main/abinit ${CMAKE_SOURCE_DIR}/tests/built-in/Input/abinit && cd ${CMAKE_SOURCE_DIR}/tests/built-in/Input && export ABI_PSPDIR="${CMAKE_SOURCE_DIR}/tests/Psps_for_tests" && ./abinit testin_wannier90.abi >& testin_wannier90.stdout && cat testin_wannier90t_STATUS && rm -f abinit *DDB *EIG *out* *nc *WFK *DEN *chk *eig *mmn *amn *abo* *o_* *t_STATUS*)
endif()
add_custom_target(tests_in DEPENDS
test_fast test_v1 test_v5 test_libxc test_wannier90)

View File

@ -0,0 +1,213 @@
# Two alternatives:
# 1. If ABINIT_KOKKOS_BUILD is ON, we download kokkos sources and build them using FetchContent (which actually uses add_subdirectory)
# 2. If ABINIT_KOKKOS_BUILD is OFF (default), we don't build kokkos, but use find_package for setup (you must have kokkos already installed)
# NOTE about required C++ standard
# we better chose to set the minimum C++ standard level if not already done:
# - when building kokkos < 4.0.00, it defaults to c++-14
# - when building kokkos >= 4.0.00, it defaults to c++-17
# - when using installed kokkos, we set C++ standard according to kokkos version
#
# Do we want to build kokkos (https://github.com/kokkos/kokkos) ?
#
option(ABINIT_KOKKOS_BUILD "Turn ON if you want to build kokkos (default: OFF)" OFF)
#
# Option to enable / disable kokkos detection
#
option(ABINIT_KOKKOS_WANTED "Turn ON if you want to use kokkos (default: OFF)" OFF)
#
# Option to use git (instead of tarball release) for downloading kokkos and kokkos-fortran-interop
#
option(ABINIT_KOKKOS_USE_GIT "Turn ON if you want to use git to download Kokkos sources (default: OFF)" OFF)
#
# Options to specify target device backend
#
# set default backend
set(ABINIT_KOKKOS_BACKEND "Undefined" CACHE STRING
"Kokkos backend device")
# Set the possible values for kokkos backend device
set_property(CACHE ABINIT_KOKKOS_BACKEND PROPERTY STRINGS
"OpenMP" "Cuda" "HIP" "Undefined")
if(ABINIT_KOKKOS_WANTED)
# check if user requested a build of kokkos
# use carefully, it may strongly increase build time
if(ABINIT_KOKKOS_BUILD)
message("[abinit / kokkos] Building kokkos from source")
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/external)
# Kokkos default build options
# set install path
list (APPEND ABINIT_KOKKOS_CMAKE_ARGS
-DCMAKE_INSTALL_PREFIX=${KOKKOS_INSTALL_DIR})
# use predefined cmake args
# can be override on the command line
if (ABINIT_KOKKOS_BACKEND MATCHES "Cuda")
if (NOT ABINIT_ENABLE_GPU_CUDA)
message(FATAL_ERROR "[abinit / kokkos] You can't use Kokkos::Cuda backend if ABINIT_ENABLE_GPU_CUDA is OFF")
endif()
if ((NOT DEFINED Kokkos_ENABLE_HWLOC) OR (NOT Kokkos_ENABLE_HWLOC))
set(Kokkos_ENABLE_HWLOC ON CACHE BOOL "")
endif()
if ((NOT DEFINED Kokkos_ENABLE_OPENMP) OR (NOT Kokkos_ENABLE_OPENMP))
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "")
endif()
if ((NOT DEFINED Kokkos_ENABLE_CUDA) OR (NOT Kokkos_ENABLE_CUDA))
set(Kokkos_ENABLE_CUDA ON CACHE BOOL "")
endif()
if ((NOT DEFINED Kokkos_ENABLE_CUDA_LAMBDA) OR (NOT Kokkos_ENABLE_CUDA_LAMBDA))
set(Kokkos_ENABLE_CUDA_LAMBDA ON CACHE BOOL "")
endif()
if ((NOT DEFINED Kokkos_ENABLE_CUDA_CONSTEXPR) OR (NOT Kokkos_ENABLE_CUDA_CONSTEXPR))
set(Kokkos_ENABLE_CUDA_CONSTEXPR ON CACHE BOOL "")
endif()
# Note : cuda architecture will probed by kokkos cmake configure
elseif(ABINIT_KOKKOS_BACKEND MATCHES "HIP")
message(FATAL_ERROR "[abinit / kokkos] HIP backend to supported yet")
# uncomment the following lines when HIP will be supported
# if (NOT ABINIT_ENABLE_GPU_HIP)
# message(FATAL_ERROR "[abinit / kokkos] You can't use Kokkos::HIP backend if ABINIT_ENABLE_GPU_HIP is OFF")
# endif()
# if ((NOT DEFINED Kokkos_ENABLE_HWLOC) OR (NOT Kokkos_ENABLE_HWLOC))
# set(Kokkos_ENABLE_HWLOC ON CACHE BOOL "")
# endif()
# if ((NOT DEFINED Kokkos_ENABLE_OPENMP) OR (NOT Kokkos_ENABLE_OPENMP))
# set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "")
# endif()
# if ((NOT DEFINED Kokkos_ENABLE_HIP) OR (NOT Kokkos_ENABLE_HIP))
# set(Kokkos_ENABLE_HIP ON CACHE BOOL "")
# endif()
elseif(ABINIT_KOKKOS_BACKEND MATCHES "OpenMP")
if (ABINIT_ENABLE_GPU_CUDA)
message(WARNING "[abinit / kokkos] ABINIT_ENABLE_GPU_CUDA is ON, you should consider setting ABINIT_KOKKOS_BACKEND=Cuda")
endif()
if ((NOT DEFINED Kokkos_ENABLE_HWLOC) OR (NOT Kokkos_ENABLE_HWLOC))
set(Kokkos_ENABLE_HWLOC ON CACHE BOOL "")
endif()
if ((NOT DEFINED Kokkos_ENABLE_OPENMP) OR (NOT Kokkos_ENABLE_OPENMP))
set(Kokkos_ENABLE_OPENMP ON CACHE BOOL "")
endif()
elseif(ABINIT_KOKKOS_BACKEND MATCHES "Undefined")
message(FATAL_ERROR "[abinit / kokkos] You must chose a valid ABINIT_KOKKOS_BACKED !")
endif()
# we set c++ standard to c++-14 as kokkos < 4.0.00 requires at least c++-14
# if later, we chose to upgrade to kokkos >= 4.0.00, we need to set it to c++-17
if (NOT "${CMAKE_CXX_STANDARD}")
set(CMAKE_CXX_STANDARD 14)
endif()
#find_package(Git REQUIRED)
include (FetchContent)
if (ABINIT_KOKKOS_USE_GIT)
FetchContent_Declare( kokkos_external
GIT_REPOSITORY https://github.com/kokkos/kokkos.git
GIT_TAG 3.7.01
)
else()
FetchContent_Declare( kokkos_external
URL https://github.com/kokkos/kokkos/archive/refs/tags/3.7.01.tar.gz
)
endif()
# Import kokkos targets (download, and call add_subdirectory)
FetchContent_MakeAvailable(kokkos_external)
if(TARGET Kokkos::kokkos)
message("[abinit / kokkos] Kokkos found (using FetchContent)")
set(ABINIT_KOKKOS_FOUND True)
set(HAVE_KOKKOS 1)
else()
message("[abinit / kokkos] we shouldn't be here. We've just integrated kokkos build into abinit build !")
endif()
set(ABINIT_KOKKOS_BUILTIN TRUE)
else()
#
# check if already installed kokkos exists
#
find_package(Kokkos 3.6.01 REQUIRED)
if(TARGET Kokkos::kokkos)
# set default c++ standard according to Kokkos version
# Kokkos >= 4.0.00 requires c++-17
if (NOT "${CMAKE_CXX_STANDARD}")
if ( ${Kokkos_VERSION} VERSION_LESS 4.0.00)
set(CMAKE_CXX_STANDARD 14)
else()
set(CMAKE_CXX_STANDARD 17)
endif()
endif()
# kokkos_check is defined in KokkosConfigCommon.cmake
kokkos_check( DEVICES "OpenMP" RETURN_VALUE KOKKOS_DEVICE_ENABLE_OPENMP)
kokkos_check( DEVICES "Cuda" RETURN_VALUE KOKKOS_DEVICE_ENABLE_CUDA)
kokkos_check( DEVICES "HIP" RETURN_VALUE KOKKOS_DEVICE_ENABLE_HIP)
kokkos_check( TPLS "HWLOC" RETURN_VALUE Kokkos_TPLS_HWLOC_ENABLED)
if(ABINIT_ENABLE_GPU_CUDA)
set(ABINIT_KOKKOS_BACKEND "Cuda")
kokkos_check( OPTIONS CUDA_LAMBDA RETURN_VALUE Kokkos_CUDA_LAMBDA_ENABLED)
kokkos_check( OPTIONS CUDA_CONSTEXPR RETURN_VALUE Kokkos_CUDA_CONSTEXPR_ENABLED)
kokkos_check( OPTIONS CUDA_UVM RETURN_VALUE Kokkos_CUDA_UVM_ENABLED)
elseif(ABINIT_ENABLE_GPU_HIP)
set(ABINIT_KOKKOS_BACKEND "HIP")
elseif(KOKKOS_DEVICE_ENABLE_OPENMP)
set(ABINIT_KOKKOS_BACKEND "OpenMP")
endif()
message("[abinit / kokkos] Kokkos found via find_package; default backend is ${ABINIT_KOKKOS_BACKEND}")
set(ABINIT_KOKKOS_FOUND True)
set(HAVE_KOKKOS 1)
else()
message(FATAL_ERROR "[abinit / kokkos] Kokkos is required but not found by find_package. Please adjust your env variable CMAKE_PREFIX_PATH (or Kokkos_ROOT) to where Kokkos is installed on your machine !")
endif()
endif()
else(ABINIT_KOKKOS_WANTED)
message(NOTICE "[abinit / kokkos] kokkos is not wanted")
endif(ABINIT_KOKKOS_WANTED)

View File

@ -0,0 +1,123 @@
# recent version of wannier has pkg-config support for detection
# see PR : https://github.com/wannier-developers/wannier90/pull/406
#
# 1. If user set ABINIT_WANNIER90_BUILD, we download wannier sources and build them
# 2. Don't build wannier, but check if WANNIER_ROOT is defined and use find_package for setup
# 3. just detect libwannier using pkg-config
#
#
# Does abinit builds libwannier (https://github.com/wannier-developers/wannier90) ?
#
option(ABINIT_WANNIER90_BUILD "Turn ON if you want to build libwannier90 (default: OFF)" OFF)
option(ABINIT_WANNIER90_BUILD_FORCE "Enforce building libwannier90 ? (default: OFF)" OFF)
#
# Option to enable / disable wannier90 detection
#
option(ABINIT_WANNIER90_WANTED "Turn OFF if you don't want libwannier90 (default: ON)" ON)
if(ABINIT_WANNIER90_WANTED)
# check if user requested a build of libwannier90
# use carefully, it may strongly increase build time
if(ABINIT_WANNIER90_BUILD)
message("[abinit / wannier] Building wannier from source")
set(WANNIER90_EXTERNAL wannier90_external)
#set(WANNIER90_SRC_DIR ${PROJECT_BINARY_DIR}/external/wannier90)
set(WANNIER90_INSTALL_DIR ${PROJECT_BINARY_DIR}/external/Install/${WANNIER90_EXTERNAL})
set(WANNIER90_INC_DIR ${WANNIER90_INSTALL_DIR}/include)
set(WANNIER90_LIB_DIR ${WANNIER90_INSTALL_DIR}/lib)
if (ABINIT_WANNIER90_BUILD_FORCE)
set(ABINIT_WANNIER90_BUILD_FORCE_BOOL True)
else()
set(ABINIT_WANNIER90_BUILD_FORCE_BOOL False)
endif()
include (ExternalProject)
find_program(MAKE_EXE NAMES gmake nmake make)
find_package(Git REQUIRED)
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/external)
macro(select_make_inc)
message("[abinit / wannier] build wannier90, run select_make_inc macro")
if(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
set(wannier_make_inc make.inc.gfort)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "G95")
set(wannier_make_inc make.inc.g95)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
set(wannier_make_inc make.inc.ifort)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "NAG")
set(wannier_make_inc make.inc.nag)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "PGI" OR
CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC")
set(wannier_make_inc make.inc.pgf90)
else()
message(FATAL_ERROR "[abinit / wannier] CompilerID not supported")
endif()
endmacro()
select_make_inc()
# TODO : provide a URL with a tarball, in case git is down
ExternalProject_Add (${WANNIER90_EXTERNAL}
GIT_REPOSITORY https://github.com/wannier-developers/wannier90.git
GIT_TAG d141f9f84dcd3ac54729b9e5874dabd451684237
CONFIGURE_COMMAND ${CMAKE_COMMAND} -E copy config/${wannier_make_inc} make.inc
BUILD_COMMAND ${MAKE_EXE} all pkgconfig PREFIX=${WANNIER90_INSTALL_DIR}
BUILD_IN_SOURCE True
INSTALL_COMMAND ${MAKE_EXE} install PREFIX=${WANNIER90_INSTALL_DIR}
LOG_CONFIGURE 1
LOG_BUILD 1
LOG_INSTALL 1
BUILD_ALWAYS 0
)
# create alias abinit::wannier through find_package
set(WANNIER_ROOT ${WANNIER90_INSTALL_DIR})
find_package(WANNIER)
if(WANNIER_FOUND)
message("[abinit / wannier] Wannier found via find_package")
set(ABINIT_WANNIER90_FOUND True)
set(HAVE_WANNIER90 1)
# alias abinit::wannier is already defined inside find_package(WANNIER)
else()
message("[abinit / wannier] we shouldn't be here. We just build wannier library, and find_package should have succeeded !")
endif()
set(ABINIT_WANNIER90_BUILTIN TRUE)
elseif (DEFINED WANNIER_ROOT OR DEFINED ENV{WANNIER_ROOT})
find_package(WANNIER)
if(WANNIER_FOUND)
message("[abinit / wannier] Wannier found via find_package")
set(ABINIT_WANNIER90_FOUND True)
set(HAVE_WANNIER90 1)
# alias abinit::wannier is already defined inside find_package(WANNIER)
endif()
else()
# regular detection through PKG_CONFIG_PATH
pkg_check_modules(ABINIT_WANNIER90 QUIET IMPORTED_TARGET wannier)
if(ABINIT_WANNIER90_FOUND)
add_library(abinit::wannier ALIAS PkgConfig::ABINIT_WANNIER90)
set(HAVE_WANNIER90 1)
message("[abinit / wannier] wannier FOUND via pkg-config")
endif()
endif()
else(ABINIT_WANNIER90_WANTED)
message("[abinit / wannier] libwannier90 is not wanted")
endif(ABINIT_WANNIER90_WANTED)

View File

@ -0,0 +1,129 @@
# currently YAKL must be used together with kokkos (im might change in the near future)
# currently abinit can only be used with YAKL_ARCH=Cuda; all other values are not yet supported
# ######################################################################################
# IMPORTANT NOTE: (January 2023):
# ######################################################################################
# We currently don't use official yakl sources, but the fork https://github.com/pkestene/yakl
# with the branch 'fix/install_target'
# A pull request has been made to official repository (https://github.com/mrnorman/YAKL), but
# until it has been merged we need to use the fork.
#
# Does abinit builds yakl ?
#
option(ABINIT_YAKL_BUILD "Turn ON if you want to build yakl (default: OFF)" OFF)
#
# Option to enable / disable yakl detection
#
option(ABINIT_YAKL_WANTED "Turn ON if you want to use yakl (default: OFF)" OFF)
# cross-check that kokkos is also enabled (yakl cannot be use with kokkos in abinit for now)
if(ABINIT_YAKL_WANTED AND (NOT ABINIT_KOKKOS_WANTED))
message(FATAL_ERROR "You must also enable Kokkos to use YAKL")
endif()
#
# if yakl is wanted
# 1. we cross-check that yakl will use the same target architecture (Cuda, Hip, Sycl, etc...)
# as kokkos
# 2. either we build yakl or we try to find yakl from environment
#
if(ABINIT_YAKL_WANTED)
set(HAVE_YAKL 1)
if (${ABINIT_KOKKOS_BACKEND} STREQUAL "Cuda")
set(YAKL_ARCH_REQUIRED "CUDA")
#elseif({ABINIT_KOKKOS_BACKEND} STREQUAL "HIP")
# set(YAKL_ARCH_REQUIRED "HIP")
#elseif({ABINIT_KOKKOS_BACKEND} STREQUAL "SYCL")
# set(YAKL_ARCH_REQUIRED "SYCL")
elseif({ABINIT_KOKKOS_BACKEND} STREQUAL "OpenMP")
set(YAKL_ARCH_REQUIRED "OPENMP")
else()
message(FATAL_ERROR "Unknown or unsupported backend for YAKL: ${YAKL_ARCH_REQUIRED}")
endif()
# check if user requested a build of yakl
# use carefully, it may strongly increase build time
if(ABINIT_YAKL_BUILD)
message("[abinit / yakl] Building yakl from source")
add_compile_definitions(YAKL_ARCH=${YAKL_ARCH_REQUIRED})
if ((YAKL_ARCH_REQUIRED STREQUAL "CUDA") OR
(YAKL_ARCH_REQUIRED STREQUAL "HIP") OR
(YAKL_ARCH_REQUIRED STREQUAL "SYCL") )
set(YAKL_MANAGED_MEMORY True)
endif()
find_package(MPI COMPONENTS Fortran C CXX)
if (MPI_FOUND)
set(YAKL_HAVE_MPI True)
endif()
set(YAKL_ARCH ${YAKL_ARCH_REQUIRED})
message("[abinit / YAKL] Building yakl from source for YAKL_ARCH=${YAKL_ARCH}")
set_property(DIRECTORY PROPERTY EP_BASE ${CMAKE_BINARY_DIR}/external)
#
# Yakl doesn't provide releases yet, so just use latest commit (end of Sept. 2022)
#
include (FetchContent)
FetchContent_Declare(
yakl_external
#GIT_REPOSITORY https://github.com/pkestene/YAKL.git
#GIT_TAG 67f5b71a3654c8db6600e243af0a8a9d5592444f
GIT_REPOSITORY https://github.com/mrnorman/YAKL.git
GIT_TAG e5ae8cbc1eadb5badab77e2a194a9d38f39f5df6
)
# Import yakl targets (download, and call add_subdirectory)
FetchContent_MakeAvailable(yakl_external)
# library alias
add_library(abinit::yakl ALIAS yakl_fortran_interface)
else(ABINIT_YAKL_BUILD)
#
# yakl is wanted, but we don't build it, so it must be found it in environment
#
# detect yakl from environment.
# yakl-config.cmake must define YAKL_ARCH variable
find_package(yakl REQUIRED)
if(TARGET yakl::yakl)
if (NOT DEFINED YAKL_ARCH)
message(FATAL_ERROR "YAKL_ARCH is not defined. Please check you installed yakl correctly.")
endif()
if (${YAKL_ARCH_REQUIRED} STREQUAL "${YAKL_ARCH}")
message(STATUS "Kokkos and YAKL target architecture match !")
else()
message(FATAL_ERROR "Kokkos and YAKL target architecture don't match !")
endif()
message("[abinit / yakl] Yakl found via find_package with YAKL_ARCH=${YAKL_ARCH}")
set(ABINIT_YAKL_FOUND True)
set(HAVE_YAKL 1)
# library alias
add_library(abinit::yakl ALIAS yakl::yakl_fortran_interface)
else()
message(FATAL_ERROR "[abinit / yakl] yakl is required but not found by find_package. Please adjust your env variable CMAKE_PREFIX_PATH (or yakl_ROOT) to where yakl is installed on your machine !")
endif()
endif(ABINIT_YAKL_BUILD)
endif(ABINIT_YAKL_WANTED)

349
cmake/compiler_setup.cmake Normal file
View File

@ -0,0 +1,349 @@
#set(CMAKE_POSITION_INDEPENDENT_CODE ON)
##################################################################
# Fortran
##################################################################
# full list of compilers supported by cmake :
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
if(CMAKE_Fortran_COMPILER_ID MATCHES "Absoft")
# TODO
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "ARMClang")
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-finit-real=nan;-Wimplicit>")
elseif (ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-finit-real=nan;-Wimplicit;-Wall;-Wextra>")
elseif (ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-finit-real=nan;-Wimplicit;-Wall;-Wextra>")
endif()
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Clang")
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-finit-real=nan;-Wimplicit>")
elseif (ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-finit-real=nan;-Wimplicit;-Wall;-Wextra>")
elseif (ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-finit-real=nan;-Wimplicit;-Wall;-Wextra>")
endif()
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "Flang")
# TODO
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "GNU")
if (CMAKE_Fortran_COMPILER_VERSION VERSION_GREATER_EQUAL 10)
add_compile_options(
"$<$<COMPILE_LANGUAGE:Fortran>:-ffree-line-length-none;-fallow-argument-mismatch>"
)
else()
add_compile_options(
"$<$<COMPILE_LANGUAGE:Fortran>:-ffree-line-length-none>"
)
endif()
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-Werror=array-bounds;-finit-real=nan;-Wimplicit-interface;-Wno-maybe-uninitialized;-Wtabs>"
)
elseif(ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-Werror=array-bounds;-finit-real=nan;-Wimplicit-interface;-Wno-maybe-uninitialized;-Wtabs;-ffpe-trap=invalid,zero,overflow;-Wall;-Wextra>")
elseif(ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-fbacktrace;-Werror=array-bounds;-finit-real=nan;-Wimplicit-interface;-Wno-maybe-uninitialized;-Wtabs;-ffpe-trap=invalid,zero,overflow;-Wall;-Wextra;-fcheck=all;-pedantic>")
endif()
# release / optim flags
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized>"
)
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "^Intel")
add_compile_options(
"$<$<COMPILE_LANGUAGE:Fortran>:-traceback;-heap-arrays>"
)
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-check uninit;-debug all;-fp-model source;-ftrapuv;-traceback>")
elseif (ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-check uninit;-debug all;-fp-model source;-ftrapuv;-traceback;-fp-stack-check;-implicitnone;-init=snan;-warn all>")
elseif (ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-check uninit;-debug all;-fp-model source;-ftrapuv;-traceback-fp-stack-check;-implicitnone;-init=snan;-warn all;-check all;-WB>")
endif()
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "NAG")
# https://www.nag.co.uk/nagware/np/r70_doc/manual/compiler_2_4.html#OPTIONS
add_compile_options(
"$<$<COMPILE_LANGUAGE:Fortran>:-f2018;-C;-colour;-gline;-u>"
)
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-mtrace=verbose;-nan>")
elseif (ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-mtrace=verbose;-nan;-info>")
elseif (ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-mtrace=verbose;-nan;-info;-C>")
endif()
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "NVHPC") # NVFORTRAN
# TODO : improve
add_compile_options(
"$<$<COMPILE_LANGUAGE:Fortran>:-Mextend;-Mpreprocess;-Mfree;-tp=px;-traceback;-Minfo=mp,accel,par,pfo>")
# debug flags
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-traceback>")
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "PGI")
# TODO
elseif(CMAKE_Fortran_COMPILER_ID MATCHES "XL")
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-qnooptimize;-qextcheck;-qflag=i:i;-qfloat=nans;-qinitauto=7FBFFFFF>")
elseif (ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-qnooptimize;-qextcheck;-qflag=i:i;-qfloat=nans;-qinitauto=7FBFFFFF;-qflttrap=overflow:underflow:zerodivide:invalid:enable;-qsigtrap>")
elseif (ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:Fortran>,$<CONFIG:Debug>>:-qnooptimize;-qextcheck;-qflag=i:i;-qfloat=nans;-qinitauto=7FBFFFFF;-qflttrap=overflow:underflow:zerodivide:invalid:enable;-qsigtrap;-C;-qcheck>")
endif()
endif()
##################################################################
# C
##################################################################
# full list of compilers supported by cmake :
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
if(CMAKE_C_COMPILER_ID MATCHES "Clang")
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O2;-mtune=native;-mcpu=native>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O3;-mtune=native;-mcpu=native;-ffp-contract=fast>"
)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "ARMClang")
# TODO
elseif(CMAKE_C_COMPILER_ID MATCHES "GNU")
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug>>:-g3;-ggdb>"
)
elseif (ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug>>:-g3;-ggdb;-Wall;-Wextra>"
)
elseif (ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Debug>>:-g3;-ggdb;-Wall;-Wextra>"
)
endif()
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized;-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized;-O2;-mtune=native;-march=native>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized;-O3;-mtune=native;-march=native>"
)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "^Intel")
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O3>"
)
endif()
elseif(CMAKE_C_COMPILER_ID MATCHES "NVHPC") # NVC
# TODO
elseif(CMAKE_C_COMPILER_ID MATCHES "PGI")
# TODO
elseif(CMAKE_C_COMPILER_ID MATCHES "XL")
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O2;-qarch=auto;-qtune=auto;-qstrict;-qspill=2000>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O3;-qarch=auto;-qtune=auto;-qstrict;-qspill=2000>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:C>,$<CONFIG:Release>>:-O4;-qarch=auto;-qtune=auto;-qstrict;-qspill=2000>"
)
endif()
endif()
##################################################################
# CXX
##################################################################
# full list of compilers supported by cmake :
# https://cmake.org/cmake/help/latest/variable/CMAKE_LANG_COMPILER_ID.html
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O2;-mtune=native;-mcpu=native>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O3;-mtune=native;-mcpu=native;-ffp-contract=fast>"
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "ARMClang")
# TODO
elseif(CMAKE_CXX_COMPILER_ID MATCHES "GNU")
# debug flags
if (ABI_DEBUG_FLAVOR MATCHES "enhanced")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:-g3;-ggdb>"
)
elseif (ABI_DEBUG_FLAVOR MATCHES "paranoid")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:-g3;-ggdb;-Wall;-Wextra>"
)
elseif (ABI_DEBUG_FLAVOR MATCHES "naughty")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Debug>>:-g3;-ggdb;-Wall;-Wextra>"
)
endif()
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized;-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized;-O2;-mtune=native;-march=native>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-fno-backtrace;-Wno-maybe-uninitialized;-O3;-mtune=native;-march=native>"
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "^Intel")
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O2>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O3>"
)
endif()
elseif(CMAKE_CXX_COMPILER_ID MATCHES "NVHPC") # NVC++
# TODO
elseif(CMAKE_CXX_COMPILER_ID MATCHES "PGI")
# TODO
elseif(CMAKE_CXX_COMPILER_ID MATCHES "XL")
# release / optim flags
if (ABI_OPTIM_FLAVOR MATCHES "safe")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O2;-qarch=auto;-qtune=auto;-qstrict;-qspill=2000;-qessl>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "standard")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O3;-qarch=auto;-qtune=auto;-qstrict;-qspill=2000;-qessl>"
)
elseif (ABI_OPTIM_FLAVOR MATCHES "aggressive")
add_compile_options(
"$<$<AND:$<COMPILE_LANGUAGE:CXX>,$<CONFIG:Release>>:-O4;-qarch=auto;-qtune=auto;-qstrict;-qspill=2000;-qessl>"
)
endif()
endif()

View File

@ -0,0 +1,637 @@
set(BUILD_WITH_CMAKE 1)
set(ABINIT_VERSION ${PROJECT_VERSION})
set(ABINIT_VERSION_BASE ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR})
set(ABINIT_VERSION_MAJOR ${PROJECT_VERSION_MAJOR})
set(ABINIT_VERSION_MINOR ${PROJECT_VERSION_MINOR})
set(ABINIT_VERSION_MICRO ${PROJECT_VERSION_PATCH})
string(TIMESTAMP ABINIT_VERSION_BUILD "%Y%m%d")
#
# get compiler ID for C language
#
if (${CMAKE_C_COMPILER_ID} STREQUAL "ARMCC")
set(CC_ARM 1)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "GNU")
set(CC_GNU 1)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "XL")
set(CC_IBM 1)
endif()
if ((${CMAKE_C_COMPILER_ID} STREQUAL "XLClang") OR
(${CMAKE_C_COMPILER_ID} STREQUAL "IBMClang"))
set(CC_IBMLLVM 1)
endif()
if ((${CMAKE_C_COMPILER_ID} STREQUAL "Intel") OR
(${CMAKE_C_COMPILER_ID} STREQUAL "IntelLLVM"))
set(CC_INTEL 1)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "Clang")
set(CC_LLVM 1)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "PGI")
set(CC_PGI 1)
endif()
if (${CMAKE_C_COMPILER_ID} STREQUAL "NVHPC")
set(CC_NVHPC 1)
endif()
#
# get compiler ID for CXX language
#
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "ARMCC")
set(CXX_ARM 1)
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "GNU")
set(CXX_GNU 1)
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "XL")
set(CXX_IBM 1)
endif()
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "XLClang") OR
(${CMAKE_CXX_COMPILER_ID} STREQUAL "IBMClang"))
set(CXX_IBMLLVM 1)
endif()
if ((${CMAKE_CXX_COMPILER_ID} STREQUAL "Intel") OR
(${CMAKE_CXX_COMPILER_ID} STREQUAL "IntelLLVM"))
set(CXX_INTEL 1)
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "Clang")
set(CXX_LLVM 1)
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "PGI")
set(CXX_PGI 1)
endif()
if (${CMAKE_CXX_COMPILER_ID} STREQUAL "NVHPC")
set(CXX_NVHPC 1)
endif()
#
# get compiler ID for Fortran language
#
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Absoft")
set(FC_ABSOFT 1)
endif()
# TODO
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "Flang")
# EXECUTE_PROCESS(COMMAND ${CMAKE_Fortran_COMPILER} --version 2>/dev/null | head -n 1
# OUTPUT_VARIABLE FC_VERSION)
set(FC_AOCC 1)
endif()
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "ARMCC")
set(FC_ARM 1)
endif()
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "GNU")
set(FC_GNU 1)
endif()
if ((${CMAKE_Fortran_COMPILER_ID} STREQUAL "Intel") OR
(${CMAKE_Fortran_COMPILER_ID} STREQUAL "IntelLLVM"))
set(FC_INTEL 1)
endif()
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NAG")
set(FC_NAG 1)
endif()
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "PGI")
set(FC_PGI 1)
endif()
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "NVHPC")
set(FC_NVHPC 1)
endif()
if (${CMAKE_Fortran_COMPILER_ID} STREQUAL "XL")
set(FC_IBM 1)
endif()
if ((${CMAKE_Fortran_COMPILER_ID} STREQUAL "XLClang") OR
(${CMAKE_Fortran_COMPILER_ID} STREQUAL "IBMClang"))
set(FC_IBMLLVM 1)
endif()
#################################################################
include(CheckTypeSize)
check_type_size(char SIZEOF_CHAR)
check_type_size(double SIZEOF_DOUBLE)
check_type_size(float SIZEOF_FLOAT)
check_type_size(int SIZEOF_INT)
check_type_size(long SIZEOF_LONG)
check_type_size("long double" SIZEOF_LONG_DOUBLE)
check_type_size("long long" SIZEOF_LONG_LONG)
check_type_size(ptrdiff_t SIZEOF_PTRDIFF_T)
check_type_size(short SIZEOF_SHORT)
check_type_size(size_t SIZEOF_SIZE_T)
check_type_size("unsigned int" SIZEOF_UNSIGNED_INT)
check_type_size("unsigned long" SIZEOF_UNSIGNED_LONG)
check_type_size("unsigned long long" SIZEOF_UNSIGNED_LONG_LONG)
include(CheckFunctionExists)
include(CheckLibraryExists)
include(CheckIncludeFile)
include(CheckIncludeFileCXX)
include(CheckIncludeFiles)
include(CheckSymbolExists)
include(CheckFortranSourceRuns)
CHECK_INCLUDE_FILE(dlfcn.h HAVE_DLFCN_H)
CHECK_INCLUDE_FILE(inttypes.h HAVE_INTTYPES_H)
CHECK_INCLUDE_FILE(memory.h HAVE_MEMORY_H)
CHECK_INCLUDE_FILE(stddef.h HAVE_STDDEF_H)
CHECK_INCLUDE_FILE(stdint.h HAVE_STDINT_H)
CHECK_INCLUDE_FILE_CXX(cstdint HAVE_CSTDINT)
CHECK_INCLUDE_FILE(stdio.h HAVE_STDIO_H)
CHECK_INCLUDE_FILE(stdlib.h HAVE_STDLIB_H)
CHECK_INCLUDE_FILE(strings.h HAVE_STRINGS_H)
CHECK_INCLUDE_FILE(string.h HAVE_STRING_H)
CHECK_INCLUDE_FILE(sys/ioctl.h HAVE_SYS_IOCTL_H)
CHECK_INCLUDE_FILE(sys/resource.h HAVE_SYS_RESOURCE_H)
CHECK_INCLUDE_FILE(sys/stat.h HAVE_SYS_STAT_H)
CHECK_INCLUDE_FILE(sys/time.h HAVE_SYS_TIME_H)
CHECK_INCLUDE_FILE(sys/types.h HAVE_SYS_TYPES_H)
CHECK_INCLUDE_FILE(termios.h HAVE_TERMIOS_H)
CHECK_INCLUDE_FILE(time.h HAVE_TIME_H)
CHECK_INCLUDE_FILE(unistd.h HAVE_UNISTD_H)
CHECK_INCLUDE_FILE(errno.h HAVE_ERRNO_H)
#/* Define to 1 if you have the ANSI C header files. */
CHECK_INCLUDE_FILES("stdlib.h;stdarg.h;string.h;float.h" HAVE_STDC_HEADERS)
#
# check fortran compiler features
#
# TODO: I'm really not convinced that all this is really necessary, but for compatibility
# with the old autotools build system, let's check exhaustively all these features support
check_fortran_source_runs(
"program test
integer, parameter :: dp=kind(1.0d0)
integer, parameter :: dpc=kind((1.0_dp,1.0_dp))
type test_type
integer,allocatable :: i(:)
real(dp),allocatable :: r(:,:)
complex(dpc),allocatable :: c(:,:,:)
end type test_type
end program test"
HAVE_FC_ALLOCATABLE_DTARRAYS
SRC_EXT f90)
# check async
try_compile(HAVE_FC_ASYNC_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_fc_async.F90)
if (HAVE_FC_ASYNC_BOOL)
set(HAVE_FC_ASYNC 1)
endif()
# check backtrace
try_compile(HAVE_FC_BACKTRACE_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_fc_backtrace.F90)
if (HAVE_FC_BACKTRACE_BOOL)
set(HAVE_FC_BACKTRACE 1)
endif()
# check command_argument
try_compile(HAVE_FC_COMMAND_ARGUMENT_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_fc_command_argument.F90)
if (HAVE_FC_COMMAND_ARGUMENT_BOOL)
set(HAVE_FC_COMMAND_ARGUMENT 1)
endif()
check_fortran_source_runs(
"program test
implicit none
integer, parameter :: dp=kind(1.0d0)
integer, parameter :: dpc=kind((1.0_dp,1.0_dp))
integer,contiguous,pointer :: i_ptr(:)
real(dp),contiguous,pointer :: r_ptr(:,:)
complex(dpc),contiguous,pointer :: c_ptr(:,:,:)
end program test"
HAVE_FC_CONTIGUOUS
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
end program test"
HAVE_FC_CPUTIME
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
real, dimension(2) :: tarray
real :: result
call etime(tarray, result)
end program test"
HAVE_FC_ETIME
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
integer :: STATUS = 0
call exit(STATUS)
end program test"
HAVE_FC_EXIT
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
call flush(1)
end program test"
HAVE_FC_FLUSH
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
call flush_(1)
end program test"
HAVE_FC_FLUSH_
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
real :: x
x = gamma(1.5)
end program test"
HAVE_FC_GAMMA
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
character(len=255) :: homedir
call getenv(\"HOME\", homedir)
end program test"
HAVE_FC_GETENV
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
end program test"
HAVE_FC_GETPID
SRC_EXT f90)
check_fortran_source_runs(
"program test
use, intrinsic :: ieee_arithmetic
implicit none
real :: val
if (ieee_is_nan(val)) then ! NaN
write(*,*) \"Hello NAN\"
end if
end program test"
HAVE_FC_IEEE_ARITHMETIC
SRC_EXT f90)
check_fortran_source_runs(
"program test
use, intrinsic :: ieee_exceptions
implicit none
type(ieee_status_type) :: status_value
call ieee_get_status(status_value) ! Get the flags
call ieee_set_flag(ieee_all,.false.) ! Set the flags quiet
call ieee_set_status(status_value) ! Restore the flags
end program test"
HAVE_FC_IEEE_EXCEPTIONS
SRC_EXT f90)
# TODO : not sure of the purpose of this one, if does not compile
# since -Werror=line-truncation
# check_fortran_source_runs(
# "program test
# implicit none
# write(*,*) \"aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa\" !142
# end program test"
# HAVE_FC_LONG_LINES
# SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
# define NEWLINE \newline
print *, \"foo1\" NEWLINE print *,\"foo2\"
end program test"
HAVE_FC_MACRO_NEWLINE
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
integer, allocatable :: a(:), b(:)
allocate(a(3))
a = (/1, 2, 3/)
call move_alloc(a, b)
end program test"
HAVE_FC_MOVE_ALLOC
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
integer :: x(3,4)
call test_on_the_fly_shape(x)
contains
subroutine test_on_the_fly_shape(x)
integer, intent(inout) :: x(:,:)
integer :: y(product(shape(x)))
end subroutine test_on_the_fly_shape
end program test"
HAVE_FC_ON_THE_FLY_SHAPE
SRC_EXT f90)
check_fortran_source_runs(
"module foo
type, public :: bar_t
integer :: pub
integer,private :: priv
end type bar_t
end module foo
program test
use foo
type(bar_t) :: data
end program test"
HAVE_FC_PRIVATE
SRC_EXT f90)
check_fortran_source_runs(
"module foo
real,save,protected :: aprot(10)
end module foo
program test
use foo
end program test"
HAVE_FC_PROTECTED
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
integer :: ii,ishft,res
res=shiftl(ii,ishft)
res=shiftr(ii,ishft)
end program test"
HAVE_FC_SHIFTLR
SRC_EXT f90)
check_fortran_source_runs(
"program test
IMPLICIT NONE
INTEGER :: myvalue = 12345, mypos
OPEN(UNIT=11, FILE=\"ustream.demo\", STATUS=\"NEW\", ACCESS=\"STREAM\")
WRITE(11) \"first\"
WRITE(11) \"second\"
INQUIRE(UNIT=11, POS=mypos)
PRINT *, \"Myvalue will be written at position \", mypos
WRITE(11) myvalue
CLOSE(UNIT=11)
end program test"
HAVE_FC_STREAM_IO
SRC_EXT f90)
check_fortran_source_runs(
"program test
implicit none
call system (\"ls -l\")
end program test"
HAVE_FC_SYSTEM
SRC_EXT f90)
# check iso_c_binding
try_compile(HAVE_FC_ISO_C_BINDING_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_fc_iso_c_binding.F90)
if (HAVE_FC_ISO_C_BINDING_BOOL)
set(HAVE_FC_ISO_C_BINDING 1)
endif()
# check iso_c_fortran_env
try_compile(HAVE_FC_ISO_FORTRAN_2008_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_fc_iso_fortran_2008.F90)
if (HAVE_FC_ISO_FORTRAN_2008_BOOL)
set(HAVE_FC_ISO_FORTRAN_2008 1)
endif()
# check integer*16
try_compile(HAVE_FC_INT_QUAD_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_fc_int_quad.F90)
if (HAVE_FC_INT_QUAD_BOOL)
set(HAVE_FC_INT_QUAD 1)
endif()
# check IOMSG
try_compile(HAVE_FC_IOMSG_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_fc_iomsg.F90)
if (HAVE_FC_IOMSG_BOOL)
set(HAVE_FC_IOMSG 1)
endif()
#
# MKL features check
#
if (MKL_FOUND)
try_compile(HAVE_LINALG_MKL_IMATCOPY_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_linalg_mkl_imatcopy.F90
LINK_LIBRARIES MKL::MKL)
if (HAVE_LINALG_MKL_IMATCOPY_BOOL)
set(HAVE_LINALG_MKL_IMATCOPY 1)
endif()
try_compile(HAVE_LINALG_MKL_OMATCOPY_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_linalg_mkl_omatcopy.F90
LINK_LIBRARIES MKL::MKL)
if (HAVE_LINALG_MKL_OMATCOPY_BOOL)
set(HAVE_LINALG_MKL_OMATCOPY 1)
endif()
try_compile(HAVE_LINALG_MKL_OMATADD_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_linalg_mkl_omatadd.F90
LINK_LIBRARIES MKL::MKL)
if (HAVE_LINALG_MKL_OMATADD_BOOL)
set(HAVE_LINALG_MKL_OMATADD 1)
endif()
endif(MKL_FOUND)
#
# MPI features check
#
if (MPI_FOUND)
set(HAVE_MPI 1)
message("[MPI] MPI_Fortran_VERSION_MAJOR = ${MPI_Fortran_VERSION_MAJOR}")
# the following reproduced the behavior existing in m4 macro
# HAVE_MPI2 is used with the meaning MPI standard version (major) is greater if equal to 2
if (MPI_Fortran_VERSION_MAJOR VERSION_GREATER_EQUAL "2")
set(HAVE_MPI2 1)
endif()
if (MPI_Fortran_VERSION_MAJOR VERSION_GREATER_EQUAL "3")
set(HAVE_MPI3 1)
endif()
# check mpi_integer16
try_compile(HAVE_MPI_INTEGER16_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_mpi_integer16.F90
LINK_LIBRARIES MPI::MPI_Fortran)
if (HAVE_MPI_INTEGER16_BOOL)
set(HAVE_MPI_INTEGER16 1)
endif()
try_compile(HAVE_MPI_GET_LIBRARY_VERSION_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_mpi_get_library_version.F90
LINK_LIBRARIES MPI::MPI_Fortran)
if(HAVE_MPI_GET_LIBRARY_VERSION_BOOL)
set(HAVE_MPI_GET_LIBRARY_VERSION 1)
endif()
# check runtime GPU-awareness ability
include(CheckMPIFeatures)
endif()
#
# NetCDF / MPI
#
if (MPI_FOUND)
if (ABINIT_NETCDF_FOUND)
# check NetCDF C / MPI
# message(STATUS "Check netcdf/c/mpi support...")
# try_compile(HAVE_NETCDF_C_MPI_BOOL ${CMAKE_BINARY_DIR}/try_compile ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_netcdf_c_mpi.c
# LINK_LIBRARIES MPI::MPI_C PkgConfig::ABINIT_NETCDF)
# #PkgConfig::ABINIT_NETCDF_MPI)
# if (HAVE_NETCDF_C_MPI_BOOL)
# message("NetCDF C/MPI support checked ok")
# set(HAVE_NETCDF_MPI 1)
# else()
# message("NetCDF C/MPI not supported")
# endif()
message(STATUS "Check netcdf/fortran support...")
if (NOT DEFINED HAVE_NETCDF_FORTRAN_BOOL)
try_compile(HAVE_NETCDF_FORTRAN_BOOL
${CMAKE_BINARY_DIR}/try_compile_netcdf
${CMAKE_SOURCE_DIR}/cmake/try_compile/have_netcdf_fortran.F90
LINK_LIBRARIES PkgConfig::ABINIT_NETCDF_FORTRAN PkgConfig::ABINIT_NETCDF MPI::MPI_Fortran)
endif()
if (HAVE_NETCDF_FORTRAN_BOOL)
message("NetCDF Fortran support checked ok")
set(HAVE_NETCDF 1)
set(HAVE_NETCDF_FORTRAN 1)
else()
message("NetCDF Fortran not supported")
endif()
# check NetCDF fortran / MPI
message(STATUS "Check netcdf/fortran/mpi support...")
if (NOT DEFINED HAVE_NETCDF_FORTRAN_MPI_BOOL)
# try_run(
# HAVE_NETCDF_FORTRAN_MPI_BOOL_RUN
# HAVE_NETCDF_FORTRAN_MPI_BOOL_COMPILE
# ${CMAKE_BINARY_DIR}/try_compile
# ${CMAKE_SOURCE_DIR}/cmake/try_compile/have_netcdf_fortran_mpi.F90
# LINK_LIBRARIES MPI::MPI_Fortran PkgConfig::ABINIT_NETCDF_FORTRAN
# RUN_OUTPUT_VARIABLE HAVE_NETCDF_FORTRAN_MPI_RUN_RES)
try_compile(
HAVE_NETCDF_FORTRAN_MPI_BOOL
${CMAKE_BINARY_DIR}/try_compile_netcdf_mpi
${CMAKE_SOURCE_DIR}/cmake/try_compile/have_netcdf_fortran_mpi.F90
LINK_LIBRARIES MPI::MPI_Fortran PkgConfig::ABINIT_NETCDF_FORTRAN)
endif()
if (HAVE_NETCDF_FORTRAN_BOOL AND HAVE_NETCDF_FORTRAN_MPI_BOOL)
message("NetCDF fortran/MPI support checked ok")
set(HAVE_NETCDF_FORTRAN_MPI 1)
# TO DO : evaluate if we should also set HAVE_NETCDF_MPI here, because actually
# only HAVE_NETCDF_MPI is used e.g m_nctk.F90
set(HAVE_NETCDF_MPI 1)
else()
message("NetCDF fortran/MPI not supported")
endif()
endif()
endif()
# TODO PK : evaluate if this really need to be checked, almost all MPI implementation
# have support for MPI2
set(HAVE_MPI_IALLGATHER 1)
set(HAVE_MPI_IALLREDUCE 1)
set(HAVE_MPI_IALLTOALL 1)
set(HAVE_MPI_IALLTOALLV 1)
set(HAVE_MPI_IBCAST 1)
set(HAVE_MPI_IGATHERV 1)
set(HAVE_MPI_TYPE_CREATE_STRUCT 1)
#
# System
#
if(CMAKE_SYSTEM_NAME STREQUAL Linux)
set(HAVE_OS_LINUX 1)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Darwin)
set(HAVE_OS_MACOSX 1)
endif()
if(CMAKE_SYSTEM_NAME STREQUAL Windows)
set(HAVE_OS_WINDOWS 1)
endif()
# TODO : other OS (FreeBSD, Android, MSYS ?)
#
# GPU features check
#
# check if cublas.h is available
if (TARGET CUDA::cublas)
set(HAVE_CUBLAS_H 1)
endif()
if (TARGET CUDA::cudart)
set(HAVE_CUDA_RUNTIME_API_H 1)
endif()
if (TARGET CUDA::cudafft)
set(HAVE_CUFFT_H 1)
endif()
CHECK_SYMBOL_EXISTS(abort "stdlib.h" HAVE_ABORT)
CHECK_SYMBOL_EXISTS(clock_gettime "time.h" HAVE_CLOCK_GETTIME)
message(" Generating config.h ...")
configure_file(config.h.cmake config.h @ONLY)
message("")

View File

@ -0,0 +1,24 @@
macro(generate_pkgconfig name)
# about pkg-config
# set variables as required by autotools
set (VERSION ${PROJECT_VERSION})
set (prefix ${CMAKE_INSTALL_PREFIX})
set (exec_prefix ${CMAKE_INSTALL_FULL_BINDIR})
set (libdir ${CMAKE_INSTALL_FULL_LIBDIR})
set (includedir ${CMAKE_INSTALL_FULL_INCLUDEDIR})
# actually produce the pkg-config file
configure_file(
${CMAKE_CURRENT_SOURCE_DIR}/${name}.pc.in
${CMAKE_CURRENT_BINARY_DIR}/${name}.pc
@ONLY
)
unset (VERSION)
unset (prefix)
unset (exec_prefix)
unset (libdir)
unset (includedir)
endmacro(generate_pkgconfig)

View File

@ -0,0 +1,17 @@
function(get_mpi_vendor)
execute_process(COMMAND mpirun --version OUTPUT_VARIABLE MPIRUN_OUTPUT)
string(FIND "${MPIRUN_OUTPUT}" "Open MPI" OMPI_POS)
string(FIND "${MPIRUN_OUTPUT}" "MPICH" MPICH_POS)
string(FIND "${MPIRUN_OUTPUT}" "Intel(R) MPI" IMPI_POS)
if(NOT OMPI_POS STREQUAL "-1")
set(MPI_VENDOR "OpenMPI" PARENT_SCOPE)
elseif(NOT MPICH_POS STREQUAL "-1")
set(MPI_VENDOR "MPICH" PARENT_SCOPE)
elseif(NOT IMPI_POS STREQUAL "-1")
set(MPI_VENDOR "IntelMPI" PARENT_SCOPE)
endif()
endfunction()

464
cmake/mkl_setup.cmake Normal file
View File

@ -0,0 +1,464 @@
#
# CMake recipes
# https://github.com/eth-cscs/cmake-recipes
#
# Copyright (c) 2018-2019, ETH Zurich
# BSD 3-Clause License. All rights reserved.
#
# Author: Teodor Nikolov (tnikolov@cscs.ch)
#
# Modified to define variables
# - MKL_SCALAPACK_FLAVOR_DEFAULT
# - MKL_BLAS_FLAVOR_DEFAULT
# according to what is available on execution platform
#
#[=======================================================================[.rst:
mkl_setup
---------
The following conventions are used:
intel / INTEL - Bindings for everything except GNU Fortran
gf / GF - GNU Fortran bindings
seq / SEQ - sequential MKL
omp / OMP - threaded MKL with OpenMP back end
tbb / TBB - threaded MKL with TBB back end
32bit / 32BIT - MKL 32 bit integer interface (used most often)
64bit / 64BIT - MKL 64 bit integer interface
mpich / MPICH - MPICH / IntelMPI BLACS back end
ompi / OMPI - OpenMPI BLACS back end
st / ST - static libraries
dyn / DYN - dynamic libraries
The module attempts to define a target for each MKL configuration. The
configuration will not be available if there are missing library files or a
missing dependency.
MKL Link line advisor:
https://software.intel.com/en-us/articles/intel-mkl-link-line-advisor
Note: Mixing GCC and Intel OpenMP backends is a bad idea.
Search variables
^^^^^^^^^^^^^^^^
``MKLROOT``
Environment variable set to MKL's root directory
``MKL_ROOT``
CMake variable set to MKL's root directory
Example usage
^^^^^^^^^^^^^
To Find MKL:
find_package(MKL REQUIRED)
include(mkl_setup)
To check if target is available:
if (TARGET mkl::scalapack_mpich_intel_32bit_omp_dyn)
...
endif()
To link to an available target (see list below):
target_link_libraries(... mkl::scalapack_mpich_intel_32bit_omp_dyn)
Note: dependencies are handled for you (MPI, OpenMP, ...)
Imported targets
^^^^^^^^^^^^^^^^
MKL (BLAS, LAPACK, FFT) targets:
mkl::mkl_[gf|intel]_[32bit|64bit]_[seq|omp|tbb]_[st|dyn] e.g.
mkl::mkl_intel_32bit_omp_dyn
BLACS targets:
mkl::blacs_[mpich|ompi]_[gf|intel]_[32bit|64bit]_[seq|omp|tbb]_[st|dyn] e.g.
mkl::blacs_intel_mpich_32bit_seq_st
ScaLAPACK targets:
mkl::scalapack_[mpich|ompi]_[gf|intel]_[32bit|64bit]_[seq|omp|tbb]_[st|dyn] e.g.
mkl::scalapack_mpich_intel_64bit_omp_dyn
Result variables
^^^^^^^^^^^^^^^^
MKL_SETUP_DONE
Not supported
^^^^^^^^^^^^^
- F95 interfaces
#]=======================================================================]
cmake_minimum_required(VERSION 3.12)
# check if compatible compiler is found
if(CMAKE_C_COMPILER_LOADED OR
CMAKE_CXX_COMPILER_LOADED OR
CMAKE_Fortran_COMPILER_LOADED)
set(_mkl_compiler_found TRUE)
else()
set(_mkl_compiler_found FALSE)
endif()
# Dependencies
#
find_package(Threads)
find_package(MPI COMPONENTS CXX)
find_package(OpenMP COMPONENTS CXX)
# If MKL_ROOT is not set, set it via the env variable MKLROOT.
#
if(NOT DEFINED MKL_ROOT)
set(MKL_ROOT $ENV{MKLROOT})
endif()
# Determine MKL's library folder
#
set(_mkl_libpath_suffix "lib/intel64")
if(CMAKE_SIZEOF_VOID_P EQUAL 4) # 32 bit
set(_mkl_libpath_suffix "lib/ia32")
endif()
if(WIN32)
list(APPEND _mkl_libpath_suffix "${_mkl_libpath_suffix}_win")
set(_mkl_libname_prefix "")
set(_mkl_shared_lib "_dll.lib")
set(_mkl_static_lib ".lib")
elseif(APPLE)
list(APPEND _mkl_libpath_suffix "${_mkl_libpath_suffix}_mac")
set(_mkl_libname_prefix "lib")
set(_mkl_shared_lib ".dylib")
set(_mkl_static_lib ".a")
else() # LINUX
list(APPEND _mkl_libpath_suffix "${_mkl_libpath_suffix}_lin")
set(_mkl_libname_prefix "lib")
set(_mkl_shared_lib ".so")
set(_mkl_static_lib ".a")
endif()
set(_mkl_search_paths "${MKL_ROOT}"
"${MKL_ROOT}/lib"
"${MKL_ROOT}/mkl"
"${MKL_ROOT}/compiler")
# Functions: finds both static and shared MKL libraries
#
function(__mkl_find_library _varname _libname)
find_library(${_varname}_DYN
NAMES ${_mkl_libname_prefix}${_libname}${_mkl_shared_lib}
HINTS ${_mkl_search_paths}
PATH_SUFFIXES ${_mkl_libpath_suffix})
mark_as_advanced(${_varname}_DYN)
find_library(${_varname}_ST
NAMES ${_mkl_libname_prefix}${_libname}${_mkl_static_lib}
HINTS ${_mkl_search_paths}
PATH_SUFFIXES ${_mkl_libpath_suffix})
mark_as_advanced(${_varname}_ST)
endfunction()
# Find MKL headers
#
find_path(MKL_INCLUDE_DIR mkl.h
HINTS ${MKL_ROOT}/include
${MKL_ROOT}/mkl/include)
mark_as_advanced(MKL_INCLUDE_DIR)
# Group flags for static libraries on Linux (GNU, PGI, ICC -> same linker)
#
if(UNIX AND NOT APPLE)
set(_mkl_linker_pre_flags_ST "-Wl,--start-group")
set(_mkl_linker_post_flags_ST "-Wl,--end-group")
endif()
# Core MKL
#
__mkl_find_library(MKL_CORE_LIB mkl_core)
# Interface
#
__mkl_find_library(MKL_INTERFACE_INTEL_32BIT_LIB mkl_intel_lp64)
__mkl_find_library(MKL_INTERFACE_INTEL_64BIT_LIB mkl_intel_ilp64)
if(NOT APPLE AND CMAKE_Fortran_COMPILER_LOADED
AND CMAKE_Fortran_COMPILER_ID STREQUAL "GNU")
__mkl_find_library(MKL_INTERFACE_GF_32BIT_LIB mkl_gf_lp64)
__mkl_find_library(MKL_INTERFACE_GF_64BIT_LIB mkl_gf_ilp64)
endif()
# Threading
#
__mkl_find_library(MKL_SEQ_LIB mkl_sequential)
if(NOT APPLE AND (CMAKE_C_COMPILER_ID STREQUAL "GNU" OR
CMAKE_CXX_COMPILER_ID STREQUAL "GNU" OR
CMAKE_Fortran_COMPILER_ID STREQUAL "GNU"))
__mkl_find_library(MKL_OMP_LIB mkl_gnu_thread)
else()
__mkl_find_library(MKL_OMP_LIB mkl_intel_thread)
endif()
__mkl_find_library(MKL_TBB_LIB mkl_tbb_thread)
# BLACS
#
if(APPLE)
__mkl_find_library(MKL_BLACS_MPICH_32BIT_LIB mkl_blacs_mpich_lp64)
__mkl_find_library(MKL_BLACS_MPICH_64BIT_LIB mkl_blacs_mpich_ilp64)
else()
__mkl_find_library(MKL_BLACS_MPICH_32BIT_LIB mkl_blacs_intelmpi_lp64)
__mkl_find_library(MKL_BLACS_MPICH_64BIT_LIB mkl_blacs_intelmpi_ilp64)
endif()
__mkl_find_library(MKL_BLACS_OMPI_32BIT_LIB mkl_blacs_openmpi_lp64)
__mkl_find_library(MKL_BLACS_OMPI_64BIT_LIB mkl_blacs_openmpi_ilp64)
# ScaLAPACK
#
__mkl_find_library(MKL_SCALAPACK_32BIT_LIB mkl_scalapack_lp64)
__mkl_find_library(MKL_SCALAPACK_64BIT_LIB mkl_scalapack_ilp64)
# Check if core libs were found
#
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(MKL REQUIRED_VARS MKL_INCLUDE_DIR
Threads_FOUND
_mkl_compiler_found)
# Sequential has no threading dependency. There is currently no TBB module
# shipped with CMake. The dependency is not accounted for.
#
set(_mkl_dep_found_SEQ TRUE)
set(_mkl_dep_found_TBB TRUE)
if (TARGET OpenMP::OpenMP_CXX)
set(_mkl_dep_OMP OpenMP::OpenMP_CXX)
set(_mkl_dep_found_OMP TRUE)
endif()
####################################################
#
# make default values for
# - MKL_BLAS_FLAVOR_DEFAULT
# - MKL_SCALAPACK_FLAVOR_DEFAULT
#
if(NOT DEFINED MKL_XX_BIT)
set(MKL_XX_BIT 32bit)
endif()
if( (NOT MKL_XX_BIT STREQUAL "32bit") AND (NOT MKL_XX_BIT STREQUAL "64bit"))
message(FATAL_ERROR "MKL_XX_BIT invalid value; valid values are 32bit and 64bit")
endif()
if (NOT DEFINED MKL_THREADING_TYPE)
if(OPENMP_FOUND)
set (MKL_THREADING_TYPE "omp")
#elseif(TBB_FOUND)
# set (scalapack_threading "tbb")
else()
set (MKL_THREADING_TYPE "seq")
endif()
endif()
include(get_mpi_vendor)
if(MPI_VENDOR STREQUAL "OpenMPI")
set(mpi_type "ompi")
else()
set(mpi_type "mpich")
endif()
if (CMAKE_Fortran_COMPILER_ID STREQUAL GNU)
set(compiler_type gf)
else()
set(compiler_type intel)
endif()
set(MKL_BLAS_FLAVOR_DEFAULT mkl_${compiler_type}_${MKL_XX_BIT}_${MKL_THREADING_TYPE}_dyn)
set(MKL_SCALAPACK_FLAVOR_DEFAULT scalapack_${mpi_type}_intel_${MKL_XX_BIT}_${MKL_THREADING_TYPE}_dyn)
####################################################
#
# Define all blas, blacs and scalapack
#
foreach(_libtype "ST" "DYN")
set(_mkl_core_lib ${MKL_CORE_LIB_${_libtype}})
foreach(_bits "32BIT" "64BIT")
set(_mkl_scalapack_lib ${MKL_SCALAPACK_${_bits}_LIB_${_libtype}})
foreach(_iface "INTEL" "GF")
set(_mkl_interface_lib ${MKL_INTERFACE_${_iface}_${_bits}_LIB_${_libtype}})
foreach(_threading "SEQ" "OMP" "TBB")
set(_mkl_threading_lib ${MKL_${_threading}_LIB_${_libtype}})
string(TOLOWER "${_iface}_${_bits}_${_threading}_${_libtype}" _tgt_config)
set(_mkl_tgt mkl::mkl_${_tgt_config})
if(MKL_FOUND
AND _mkl_interface_lib
AND _mkl_threading_lib
AND _mkl_core_lib
AND _mkl_dep_found_${_threading}
AND NOT TARGET ${_mkl_tgt})
set(_mkl_libs "${_mkl_linker_pre_flags_${_threading}}"
"${_mkl_interface_lib}"
"${_mkl_threading_lib}"
"${_mkl_core_lib}"
"${_mkl_linker_post_flags_${_threading}}"
"${_mkl_dep_${_threading}}"
"Threads::Threads")
add_library(${_mkl_tgt} INTERFACE IMPORTED)
set_target_properties(${_mkl_tgt} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${_mkl_libs}")
message("Create target for ${_mkl_tgt}")
endif()
foreach(_mpi_impl "MPICH" "OMPI")
set(_mkl_blacs_lib ${MKL_BLACS_${_mpi_impl}_${_bits}_LIB_${_libtype}})
string(TOLOWER "${_mpi_impl}_${_iface}_${_bits}_${_threading}_${_libtype}" _tgt_config)
set(_blacs_tgt mkl::blacs_${_tgt_config})
set(_scalapack_tgt mkl::scalapack_${_tgt_config})
if(_mkl_blacs_lib
AND TARGET ${_mkl_tgt}
AND TARGET MPI::MPI_CXX
AND NOT TARGET ${_blacs_tgt})
set(_blacs_libs "${_mkl_linker_pre_flags_${_libtype}}"
"${_mkl_interface_lib}"
"${_mkl_threading_lib}"
"${_mkl_core_lib}"
"${_mkl_blacs_lib}"
"${_mkl_linker_post_flags_${_libtype}}"
"MPI::MPI_CXX"
"${_mkl_dep_${_threading}}"
"Threads::Threads")
add_library(${_blacs_tgt} INTERFACE IMPORTED)
set_target_properties(${_blacs_tgt} PROPERTIES
INTERFACE_INCLUDE_DIRECTORIES "${MKL_INCLUDE_DIR}"
INTERFACE_LINK_LIBRARIES "${_blacs_libs}")
message("Create target for ${_blacs_tgt}")
endif()
if(_mkl_scalapack_lib
AND TARGET ${_blacs_tgt}
AND NOT TARGET ${_scalapack_tgt})
set(_scalapack_libs "${_mkl_scalapack_lib}"
"${_blacs_tgt}")
add_library(${_scalapack_tgt} INTERFACE IMPORTED)
set_target_properties(${_scalapack_tgt} PROPERTIES
INTERFACE_LINK_LIBRARIES "${_scalapack_libs}")
message("Create target for ${_scalapack_tgt}")
endif()
endforeach()
endforeach()
endforeach()
endforeach()
endforeach()
#
# check MKL_SCALAPACK_FLAVOR / MKL_BLAS_FLAVOR
#
if (NOT DEFINED MKL_SCALAPACK_FLAVOR)
set(MKL_SCALAPACK_FLAVOR "${MKL_SCALAPACK_FLAVOR_DEFAULT}" CACHE STRING "MKL_SCALAPACK_FLAVOR, default : ${MKL_SCALAPACK_FLAVOR_DEFAULT}")
message("[mkl_setup] setting MKL_SCALAPACK_FLAVOR to default value : ${MKL_SCALAPACK_FLAVOR_DEFAULT}")
else()
message("[mkl_setup] MKL_SCALAPACK_FLAVOR already defined, value is ${MKL_SCALAPACK_FLAVOR}")
endif()
# list of valid value for MKL_SCALAPACK_FLAVOR
# used to cross-check that MKL_SCALAPACK_FLAVOR has a valid value
set_property(CACHE MKL_SCALAPACK_FLAVOR PROPERTY
STRINGS
scalapack_mpich_intel_32bit_seq_st
scalapack_ompi_intel_32bit_seq_st
scalapack_mpich_intel_32bit_omp_st
scalapack_ompi_intel_32bit_omp_st
scalapack_mpich_intel_32bit_tbb_st
scalapack_ompi_intel_32bit_tbb_st
scalapack_mpich_intel_64bit_seq_st
scalapack_ompi_intel_64bit_seq_st
scalapack_mpich_intel_64bit_omp_st
scalapack_ompi_intel_64bit_omp_st
scalapack_mpich_intel_64bit_tbb_st
scalapack_ompi_intel_64bit_tbb_st
scalapack_mpich_intel_32bit_seq_dyn
scalapack_ompi_intel_32bit_seq_dyn
scalapack_mpich_intel_32bit_omp_dyn
scalapack_ompi_intel_32bit_omp_dyn
scalapack_mpich_intel_32bit_tbb_dyn
scalapack_ompi_intel_32bit_tbb_dyn
scalapack_mpich_intel_64bit_seq_dyn
scalapack_ompi_intel_64bit_seq_dyn
scalapack_mpich_intel_64bit_omp_dyn
scalapack_ompi_intel_64bit_omp_dyn
scalapack_mpich_intel_64bit_tbb_dyn
scalapack_ompi_intel_64bit_tbb_dyn)
# cross-check that mkl/scalapack target actually exists
if(TARGET mkl::${MKL_SCALAPACK_FLAVOR})
set(MKL_SCALAPACK_FLAVOR_FOUND TRUE)
else()
set(MKL_SCALAPACK_FLAVOR_FOUND FALSE)
message(FATAL_ERROR "Warning: MKL_SCALAPACK_FLAVOR = ${MKL_SCALAPACK_FLAVOR} not found")
endif()
# set MKL_BLAS_FLAVOR according to MKL_SCALAPACK_FLAVOR
if (NOT DEFINED MKL_BLAS_FLAVOR)
set(MKL_BLAS_FLAVOR "${MKL_BLAS_FLAVOR_DEFAULT}" CACHE STRING "MKL_BLAS_FLAVOR, default : ${MKL_BLAS_FLAVOR_DEFAULT}")
endif()
# list of valid value for MKL_SCALAPACK_FLAVOR
set_property(CACHE MKL_BLAS_FLAVOR PROPERTY
STRINGS
mkl_intel_32bit_seq_st
mkl_intel_32bit_omp_st
mkl_intel_32bit_tbb_st
mkl_gf_32bit_seq_st
mkl_gf_32bit_omp_st
mkl_gf_32bit_tbb_st
mkl_intel_64bit_seq_st
mkl_intel_64bit_omp_st
mkl_intel_64bit_tbb_st
mkl_gf_64bit_seq_st
mkl_gf_64bit_omp_st
mkl_gf_64bit_tbb_st
mkl_intel_32bit_seq_dyn
mkl_intel_32bit_omp_dyn
mkl_intel_32bit_tbb_dyn
mkl_gf_32bit_seq_dyn
mkl_gf_32bit_omp_dyn
mkl_gf_32bit_tbb_dyn
mkl_intel_64bit_seq_dyn
mkl_intel_64bit_omp_dyn
mkl_intel_64bit_tbb_dyn
mkl_gf_64bit_seq_dyn
mkl_gf_64bit_omp_dyn
mkl_gf_64bit_tbb_dyn)
# cross-check that mkl/scalapack target actually exists
if(TARGET mkl::${MKL_BLAS_FLAVOR})
set(MKL_BLAS_FLAVOR_FOUND TRUE)
else()
set(MKL_BLAS_FLAVOR_FOUND FALSE)
message("Warning: MKL_BLAS_FLAVOR = ${MKL_BLAS_FLAVOR} not found")
endif()
# get properties for print summary (see below)
get_target_property(MKL_BLAS_HEADERS mkl::${MKL_BLAS_FLAVOR} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(MKL_BLAS_LIBRARIES mkl::${MKL_BLAS_FLAVOR} INTERFACE_LINK_LIBRARIES)
get_target_property(MKL_SCALAPACK_HEADERS mkl::${MKL_SCALAPACK_FLAVOR} INTERFACE_INCLUDE_DIRECTORIES)
get_target_property(MKL_SCALAPACK_LIBRARIES mkl::${MKL_SCALAPACK_FLAVOR} INTERFACE_LINK_LIBRARIES)
# usually MKL_SCALAPACK_HEADERS is empty
if (${MKL_SCALAPACK_HEADERS} STREQUAL "MKL_SCALAPACK_HEADERS-NOTFOUND")
set(MKL_SCALAPACK_HEADERS "")
endif()

153
cmake/options.cmake Normal file
View File

@ -0,0 +1,153 @@
#
# Does abinit use scalapack ?
#
option(ABINIT_SCALAPACK_ENABLED "Turn ON if you want abinit to use scalapack (default: OFF)" OFF)
#
# Does abinit use ELPA (https://elpa.mpcdf.mpg.de/) ?
#
option(ABINIT_ELPA_ENABLED "Turn ON if you want abinit to use ELPA (default: OFF)" OFF)
#
# Other options
#
option(ABINIT_DO_DEBUG_CONTRACT "Do you want to activate design-by-contract debugging tests (default OFF)." OFF)
if (ABINIT_DO_DEBUG_CONTRACT)
set(DEBUG_CONTRACT 1)
endif()
option(ABINIT_DO_DEBUG_VERBOSE "Turn on verbose debug messages in the source code (default OFF)." OFF)
if (ABINIT_DO_DEBUG_VERBOSE)
set(DEBUG_VERBOSE 1)
endif()
option(ABINIT_DO_DEBUG_VERBOSE_GPU "Turn on verbose debug messages in the GPU source code (default OFF)." OFF)
if (ABINIT_DO_DEBUG_VERBOSE_GPU)
set(DEBUG_VERBOSE_GPU 1)
endif()
option(ABINIT_DO_MEM_PROFILING "Turn on memory profiling (default OFF)." OFF)
if (ABINIT_DO_MEM_PROFILING)
set(HAVE_MEM_PROFILING 1)
endif()
option(ABINIT_AVX_SAFE_MODE "Disable vectorization in problematic procedures (default: OFF" OFF)
if (ABINIT_AVX_SAVE_MODE)
set(HAVE_AVX_SAFE_MODE 1)
endif()
option(ABINIT_ENABLE_CCLOCK "Use C clock for timings (default: OFF)" OFF)
if(ABINIT_ENABLE_CCLOCK)
set(HAVE_CCLOCK 1)
endif()
option(ABINIT_ENABLE_CRPA_OPTIM "Enable optimize cRPA calculations for ifort <= 17.0 (default: no)" OFF)
if(ABINIT_ENABLE_CRPA_OPTIM)
set(HAVE_CRPA_OPTIM 1)
endif()
option(ABINIT_ENABLE_LONG_LINES "Enable to have long lines in fortran source code (default: no)" OFF)
if(ABINIT_ENABLE_LONG_LINES)
set(HAVE_FC_LONG_LINES 1)
endif()
option(ABINIT_ENABLE_MPI_IO "Enable to have MPI I/O support (default: no)" OFF)
if(ABINIT_ENABLE_MPI_IO)
set(HAVE_MPI_IO 1)
endif()
option(ABINIT_ENABLE_MPI_IO_DEFAULT "Enable to use MPI I/O as default I/O library (default: no)" OFF)
if(ABINIT_ENABLE_MPI_IO_DEFAULT)
set(HAVE_MPI_IO_DEFAULT 1)
endif()
option(ABINIT_ENABLE_MPI_INPLACE "Enable the use of MPI_IN_PLACE (default: no)" OFF)
if(ABINIT_ENABLE_MPI_INPLACE)
set(HAVE_MPI2_INPLACE 1)
endif()
option(ABINIT_ENABLE_PARALLEL_HDF5 "Enable the use of parallel HDF5 (default: no)" OFF)
option(ABINIT_ENABLE_NETCDF_DEFAULT "Use this option if you want to use NetCDF as default I/O library (default: no)" OFF)
if(ABINIT_ENABLE_NETCDF_DEFAULT)
set(HAVE_NETCDF_DEFAULT 1)
endif()
option(ABINIT_ENABLE_GW_DPC "Enable GW computing with double precision (default OFF)" OFF)
if(ABINIT_ENABLE_GW_DPC)
set(HAVE_GW_DPC 1)
endif()
option(ABINIT_ENABLE_LIBTETRA "Enable internal support for libtetra (default ON)" ON)
if(ABINIT_ENABLE_LIBTETRA)
set(HAVE_LIBTETRA_ABINIT 1)
endif()
option(ABINIT_ENABLE_PYTHON_INVOCATION "Enable python invocation (default OFF)" OFF)
if(ABINIT_ENABLE_PYTHON_INVOCATION)
set(HAVE_PYTHON_INVOCATION 1)
set(DO_BUILD_67_PYTHON_INVOCATION_EXT ON)
endif()
option (ABINIT_ENFORCE_CUDA_AWARE_MPI "Some MPI cuda-aware implementation are not well detected; use this variable to enforce if you that your MPI implementation is Cuda-aware." OFF)
option(ABINIT_ENABLE_GPU_CUDA "Enable GPU build (using Nvidia CUDA backend, default OFF)" OFF)
if(ABINIT_ENABLE_GPU_CUDA)
include(CheckLanguage)
check_language(CUDA)
if (CMAKE_CUDA_COMPILER)
enable_language(CUDA)
# make sure cuda libs are available (cufft, etc..)
# FindCUDAToolkit.cmake is available since cmake 3.17 and is able
# to correctly find cuda library either when using nvcc from cuda toolkit
# or using nvc++ from nvhpc (but only in cmake 3.22.0)
# if you want to use nvc++ you need at least cmake 3.22.0
#
# the following will make target like CUDA::cublas and CUDA::cufft available
message("Using CUDAToolkit macros")
find_package(CUDAToolkit REQUIRED)
endif()
set(HAVE_GPU_CUDA 1)
# enfore the use of double precision, as in many locations double are used
# inconditionally
set(HAVE_GPU_CUDA_DP 1)
set(HAVE_GPU 1)
set(HAVE_GPU_SERIAL 1)
# check nvtx library is available
if (TARGET CUDA::nvToolsExt)
set(HAVE_GPU_CUDA10 1)
set(HAVE_GPU_NVTX_V3 1)
endif()
endif()
if (ABINIT_ENABLE_GPU_CUDA)
set(DO_BUILD_17_GPU_TOOLBOX TRUE)
set(DO_BUILD_46_MANAGE_CUDA TRUE)
else()
set(DO_BUILD_17_GPU_TOOLBOX FALSE)
set(DO_BUILD_46_MANAGE_CUDA FALSE)
endif()
option(ABINIT_ENABLE_LIBPAW_INTERNAL "Enable building libpaw as part of abinit build (default ON)" ON)
if (ABINIT_ENABLE_LIBPAW_INTERNAL)
set(HAVE_LIBPAW_ABINIT 1)
endif()
set(ABI_DEBUG_FLAVOR "basic" CACHE STRING
"Abinit C compiler debug flavor : basic, verbose, enhanced, paranoid, naughty")
set_property(CACHE ABI_DEBUG_FLAVOR PROPERTY STRINGS basic verbose enhanced paranoid naughty)
set(ABI_OPTIM_FLAVOR "safe" CACHE STRING
"Abinit C/Fortran compiler optim flavor : safe, standard, aggressive")
set_property(CACHE ABI_OPTIM_FLAVOR PROPERTY STRINGS safe standard aggressive)

View File

@ -0,0 +1,19 @@
function(prevent_build_in_source)
# make sure the user doesn't play dirty with symlinks
get_filename_component(srcdir "${CMAKE_SOURCE_DIR}" REALPATH)
get_filename_component(bindir "${CMAKE_BINARY_DIR}" REALPATH)
# disallow in-source builds
if("${srcdir}" STREQUAL "${bindir}")
message("######################################################")
message("# ${PROJECT_NAME} should not be configured and built in the source directory")
message("# You must run cmake from a build directory.")
message("# For example:")
message("# mkdir _build ; cd _build")
message("# run cmake from the build directory.")
message("######################################################")
message(FATAL_ERROR "Quitting configuration")
endif()
endfunction(prevent_build_in_source)

View File

@ -0,0 +1,45 @@
# this is a utility to explore all possible properties
# a given target may have
# see https://stackoverflow.com/questions/32183975/how-to-print-all-the-properties-of-a-target-in-cmake
#
# Get all propreties that cmake supports
#
execute_process(COMMAND cmake --help-property-list OUTPUT_VARIABLE CMAKE_PROPERTY_LIST)
#
# Convert command output into a CMake list
#
STRING(REGEX REPLACE ";" "\\\\;" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
STRING(REGEX REPLACE "\n" ";" CMAKE_PROPERTY_LIST "${CMAKE_PROPERTY_LIST}")
#################################################################
#################################################################
#################################################################
function(print_properties)
message ("CMAKE_PROPERTY_LIST = ${CMAKE_PROPERTY_LIST}")
endfunction(print_properties)
#################################################################
#################################################################
#################################################################
function(print_target_properties tgt)
if(NOT TARGET ${tgt})
message("There is no target named '${tgt}'")
return()
endif()
foreach (prop ${CMAKE_PROPERTY_LIST})
string(REPLACE "<CONFIG>" "${CMAKE_BUILD_TYPE}" prop ${prop})
# Fix https://stackoverflow.com/questions/32197663/how-can-i-remove-the-the-location-property-may-not-be-read-from-target-error-i
if(prop STREQUAL "LOCATION" OR prop MATCHES "^LOCATION_" OR prop MATCHES "_LOCATION$")
continue()
endif()
# message ("Checking ${prop}")
get_property(propval TARGET ${tgt} PROPERTY ${prop} SET)
if (propval)
get_target_property(propval ${tgt} ${prop})
message ("${tgt} ${prop} = ${propval}")
endif()
endforeach(prop)
endfunction(print_target_properties)

View File

@ -0,0 +1,93 @@
#
# SCALAPACK : NETLIB or MKL ?
#
# default behavior is to detect Netlib scalapack, unless cmake var USE_MKL_SCALAPACK is TRUE
#
if (ABINIT_SCALAPACK_FLAVOR MATCHES "NETLIB")
#
# SCALAPACK/Netlib
#
# first try the MODULE mode (using pkg-config)
# if not found try CONFIG mode
# output: target library scalapack
# Notes:
# default scalapack library names are scalapack,
# scalapack-openmpi and scalapack-mpich
# e.g. on Ubuntu scalapack possible names are scalapack-openmpi,
# scalapack-mpich
#
# if your scalapack has a different name, you can set variable
# scalapack_name on the cmake configure command line,
# and it will be check first in pkg_search_modules
pkg_search_module(ScalapackPkg QUIET IMPORTED_TARGET ${scalapack_name} scalapack scalapack-openmpi scalapack-mpich)
# On ubuntu 20.04, we must use pkg-config because the cmake config file is ill-formed
# so here the logic is to first try to detect netlib/scalapack throught pkg-config
# if not found, then try with cmake-config
set(scalapack_found_using_pkg_config FALSE)
set(scalapack_found_using_cmake_target FALSE)
if(ScalapackPkg_FOUND)
message("scalapack/netlib found via pkg-config")
set(scalapack_FOUND TRUE)
set(scalapack_found_using_pkg_config TRUE)
add_library(abinit::scalapack ALIAS PkgConfig::ScalapackPkg)
set(USING_SCALAPACK_NETLIB TRUE)
else(ScalapackPkg_FOUND)
message("scalapack/netlib not found via pkg-config")
# if we are here, it means scalapack/netlib was not found by the MODULE mode (pkgconfig)
# let try CONFIG mode
find_package(scalapack CONFIG)
if(scalapack_FOUND)
message("scalapack/netlib found via cmake config")
set(scalapack_found_using_cmake_target TRUE)
else()
message("scalapack/netlib not found. Please adjust variable scalapack_DIR / scalapack_ROOT")
endif()
endif(ScalapackPkg_FOUND)
if(ScalapackPkg_FOUND OR scalapack_FOUND)
set(HAVE_LINALG_SCALAPACK 1)
endif()
elseif(ABINIT_SCALAPACK_FLAVOR MATCHES "MKL")
#
# SCALAPACK / MKL
#
#
# Note : OneAPI MKL (version >= 2022.1.0) provides macro MKLConfig.cmake
#
#set(CMAKE_FIND_DEBUG_MODE TRUE)
find_package(MKL)
#set(CMAKE_FIND_DEBUG_MODE FALSE)
if(MKL_FOUND)
include(mkl_setup)
add_library(abinit::scalapack ALIAS mkl::${MKL_SCALAPACK_FLAVOR})
set(HAVE_LINALG_SCALAPACK 1)
set(HAVE_LINALG_MKL 1)
else(MKL_FOUND)
message("MKL not found ! Please provide environment variable MKL_ROOT.")
endif(MKL_FOUND)
endif()

View File

@ -0,0 +1,7 @@
program have_fc_async
implicit none
INTEGER, ASYNCHRONOUS :: int_array(10)
end program have_fc_async

View File

@ -0,0 +1,5 @@
program have_fc_backtrace
call backtrace()
end program have_fc_backtrace

View File

@ -0,0 +1,15 @@
program have_fc_command_argument
implicit none
integer :: ii
character(len=500) :: arg
call get_command(arg)
do ii=1,command_argument_count()
call get_command_argument(ii, arg)
end do
end program have_fc_command_argument

View File

@ -0,0 +1,8 @@
program have_fc_int_quad
implicit none
integer*16 my_int
integer(kind=16) :: my_int2
end program have_fc_int_quad

View File

@ -0,0 +1,12 @@
program have_fc_int_quad
implicit none
character(len=500) :: errmsg, dummy
open(unit=11, file="iomsg.demo", status="NEW", iomsg=errmsg)
write(11,iomsg=errmsg) "first"
read(11, iomsg=errmsg) dummy
close(unit=11, iomsg=errmsg)
end program have_fc_int_quad

View File

@ -0,0 +1,13 @@
program have_fc_iso_c_binding
use, intrinsic :: iso_c_binding
implicit none
integer(kind=c_int32_t) :: data
data = 42
write(*,*) "data=",data
end program have_fc_iso_c_binding

View File

@ -0,0 +1,13 @@
program have_fc_iso_fortran_env
use ISO_FORTRAN_ENV, only : int16,int32,int64
implicit none
integer(kind=int64) :: data
data = 42
write(*,*) "data=",data
end program have_fc_iso_fortran_env

View File

@ -0,0 +1,10 @@
program have_mkl_imatcopy
implicit none
call mkl_simatcopy
call mkl_dimatcopy
call mkl_cimatcopy
call mkl_zimatcopy
end program have_mkl_imatcopy

View File

@ -0,0 +1,10 @@
program have_mkl_omatadd
implicit none
call mkl_somatadd
call mkl_domatadd
call mkl_comatadd
call mkl_zomatadd
end program have_mkl_omatadd

View File

@ -0,0 +1,10 @@
program have_mkl_omatcopy
implicit none
call mkl_somatcopy
call mkl_domatcopy
call mkl_comatcopy
call mkl_zomatcopy
end program have_mkl_omatcopy

View File

@ -0,0 +1,13 @@
program have_fc_mpi_integer16
use mpi
implicit none
character(len=MPI_MAX_LIBRARY_VERSION_STRING) :: info
integer :: ilen, ierr
call mpi_init(ierr)
call mpi_get_library_version(info, ilen, ierr)
call mpi_finalize(ierr)
end program have_fc_mpi_integer16

View File

@ -0,0 +1,9 @@
program have_fc_mpi_integer16
use mpi
implicit none
integer, parameter :: ii = MPI_INTEGER16
end program have_fc_mpi_integer16

View File

@ -0,0 +1,25 @@
#include <mpi.h>
#include <netcdf.h>
#include <stdio.h>
int main(int argc, char* argv[])
{
MPI_Init(NULL,NULL);
MPI_Comm comm = MPI_COMM_WORLD;
MPI_Info info = MPI_INFO_NULL;
int ncid;
int ierr = nc_create_par("conftest.nc", NC_NETCDF4, comm, info, &ncid);
//int ierr = nc_create_par("conftest.nc", NC_CLASSIC_MODEL, comm, info, &ncid);
printf(" nc_create_par : ierr= %d\n",ierr);
MPI_Finalize();
if (ierr == NC_ENOPAR)
printf("Check how your netcdf library was build; apparenly it was not built with parallel I/O features\n");
if(ierr != 0) return 1;
}

View File

@ -0,0 +1,11 @@
program have_netcdf_fortran
use netcdf
implicit none
character(len=*), parameter :: path = "dummy"
integer :: mode, ncerr, ncid
ncerr = nf90_open(path,mode,ncid)
end program have_netcdf_fortran

View File

@ -0,0 +1,26 @@
program have_netcdf_fortran_mpi
use mpi
use netcdf
implicit none
integer :: process_Rank, size_Of_Cluster, ierror
integer :: ierr, ncid
size_Of_Cluster = 1
call MPI_INIT(ierror)
call MPI_COMM_SIZE(MPI_COMM_WORLD, size_Of_Cluster, ierror)
call MPI_COMM_RANK(MPI_COMM_WORLD, process_Rank, ierror)
ierr = nf90_create("conftest.nc", ior(NF90_NETCDF4, NF90_MPIPOSIX), &
ncid, comm=MPI_COMM_WORLD, info=MPI_INFO_NULL)
! DEBUG
!write(*,*) "JMB netcdf-f nfcreate -> ierr= ", ierr
call MPI_FINALIZE(ierror)
if(ierr /= 0) stop 1;
end program have_netcdf_fortran_mpi

View File

@ -0,0 +1,16 @@
program test_omp_collapse
implicit none
integer :: data(100)
integer :: i,j
!$omp parallel do collapse(2)
do j=1,10
do i=1,10
data((i-1)+(j-1)*10) = i+j
end do
end do
!$omp end parallel do
!write(*,*) data(1), data(2), data(3), data(4), data(5)
end program test_omp_collapse

631
config.h.cmake Normal file
View File

@ -0,0 +1,631 @@
#ifndef ABINIT_CONFIG_H
#define ABINIT_CONFIG_H 1
/* config.h. Generated from config.h.cmake by cmake. */
/* Note: all symbols defined here, are listed in alphabetical order. */
/* Just explicitely state we are building with cmake */
#cmakedefine BUILD_WITH_CMAKE 1
#ifdef __INTEL_COMPILER
#define FC_INTEL 1
#endif
#ifdef __NVCOMPILER
#define FC_NVHPC 1
#endif
/* Abinit target description. */
#cmakedefine ABINIT_TARGET "@ABINIT_TARGET@"
/* Abinit whole version number. */
#cmakedefine ABINIT_VERSION "@ABINIT_VERSION@"
/* Abinit base version number. */
#cmakedefine ABINIT_VERSION_BASE "@ABINIT_VERSION_BASE@"
/* Abinit build date. */
#cmakedefine ABINIT_VERSION_BUILD "@ABINIT_VERSION_BUILD@"
/* Abinit major version number. */
#cmakedefine ABINIT_VERSION_MAJOR "@ABINIT_VERSION_MAJOR@"
/* Abinit micro version number (patch level). */
#cmakedefine ABINIT_VERSION_MICRO "@ABINIT_VERSION_MICRO@"
/* Define if building universal (internal helper macro). TODO: is this still necessary ? */
/*#cmakedefine AC_APPLE_UNIVERSAL_BUILD */
/* Define to 1 if you are using the ARM C compiler. */
#cmakedefine CC_ARM 1
/* Define to 1 if you are using the GNU C compiler. */
#cmakedefine CC_GNU 1
/* Define to 1 if you are using the IBM XL C compiler. */
#cmakedefine CC_IBM 1
/* Define to 1 if you are using the Intel C compiler. */
#cmakedefine CC_INTEL 1
/* Define to 1 if you are using the LLVM Clang C compiler. */
#cmakedefine CC_LLVM 1
/* Define to 1 if you are using the Portland Group C compiler. */
#cmakedefine CC_PGI 1
/* Define to 1 if you are using the Nvidia nvhpc compiler. */
#cmakedefine CC_NVHPC 1
/* Define to 1 if you are using the ARM C++ compiler. */
#cmakedefine CXX_ARM 1
/* Define to 1 if you are using the GNU C++ compiler. */
#cmakedefine CXX_GNU 1
/* Define to 1 if you are using the IBM XL C++ compiler. */
#cmakedefine CXX_IBM 1
/* Define to 1 if you are using the Intel C++ compiler. */
#cmakedefine CXX_INTEL 1
/* Define to 1 if you are using the LLVM Clang++ C++ compiler. */
#cmakedefine CXX_LLVM 1
/* Define to 1 if you are using the Portland Group C++ compiler. */
#cmakedefine CXX_PGI 1
/* Define to 1 if you are using the Nvidia nvhpc compiler. */
#cmakedefine CXX_NVHPC 1
/* Define to 1 if you want to activate design-by-contract debugging tests. */
#cmakedefine DEBUG_CONTRACT 1
/* Define to 1 to build debugging instructions in the source code. */
#cmakedefine DEBUG_MODE 1
/* Define to 1 to turn on verbose debug messages in the source code. */
#cmakedefine DEBUG_VERBOSE 1
/* Define to 1 to turn on verbose debug messages in the GPU source code. */
#cmakedefine DEBUG_VERBOSE_GPU 1
/* Define to 1 if you are using the ABSOFT Fortran compiler. */
#cmakedefine FC_ABSOFT 1
/* Define to 1 if you are using the LLVM Flang Fortran AOCC compiler. */
#cmakedefine FC_AOCC 1
/* Define to 1 if you are using the ARM Fortran compiler. */
#cmakedefine FC_ARM 1
/*
* Fortran/C mangles names
* Use cmake macro `FortranCInterface` to adapt autoconf `AC_FC_WRAPPERS`.
*
* Note: fc_mangle.h is generated by cmake macro `FortranCInterface_HEADER`
*/
#include "fc_mangle.h"
/* Define to dummy `main' function (if any) required to link to the Fortran
libraries. */
/* #undef FC_DUMMY_MAIN */
/* Define if F77 and FC dummy `main' functions are identical. */
/* #undef FC_DUMMY_MAIN_EQ_F77 */
/* Define to a macro mangling the given C identifier (in lower and upper
case), which must not contain underscores, for linking with Fortran. */
#define FC_FUNC FC_FUNC_GLOBAL
/* As FC_FUNC, but for C identifiers containing underscores. */
#define FC_FUNC_ FC_FUNC_GLOBAL_
/* Define to 1 if you are using the GNU Fortran compiler. */
#cmakedefine FC_GNU 1
/* Define to 1 if you are using the IBM XL Fortran compiler. */
#cmakedefine FC_IBM 1
/* Define to 1 if you are using the Intel Fortran compiler. */
#cmakedefine FC_INTEL 1
/* Define to 1 if you are using the LLVM Flang Fortran compiler. */
#cmakedefine FC_LLVM 1
/* Define to 1 if you are using the NAGWare Fortran 95 compiler. */
#cmakedefine FC_NAG 1
/* Define to 1 if you are using the Portland Group Fortran compiler. */
#cmakedefine FC_PGI 1
/* Define to 1 if you are using the Nvidia nvhpc compiler. */
#cmakedefine FC_NVHPC 1
/* Define to 1 if you want to enable memory profiling. */
#cmakedefine HAVE_MEM_PROFILING @HAVE_MEM_PROFILING@
/* Define to 1 if you have the ABINIT Common library. */
#cmakedefine HAVE_ABINIT_COMMON
/* Define to 1 if you have the `abort' function. */
#cmakedefine HAVE_ABORT @HAVE_ABORT@
/* Define to 1 if you have the AtomPAW library. */
#cmakedefine HAVE_ATOMPAW @HAVE_ATOMPAW@
/* Define to 1 if you want to disable vectorization in problematic procedures. */
#cmakedefine HAVE_AVX_SAFE_MODE @HAVE_AVX_SAFE_MODE@
/* Define to 1 if you have the BigDFT library. */
#cmakedefine HAVE_BIGDFT @HAVE_BIGDFT@
/* Use C clock for timings. */
#cmakedefine HAVE_CCLOCK @HAVE_CCLOCK@
/* Define to 1 if you have the `clock_gettime' function. */
#cmakedefine HAVE_CLOCK_GETTIME @HAVE_CLOCK_DEFINE@
/* Define to 1 if you want to enable optimize cRPA calculations for ifort <= 17.0. */
#cmakedefine HAVE_CRPA_OPTIM
/* Define to 1 if you have the <cublas.h> header file. */
#cmakedefine HAVE_CUBLAS_H
/* Define to 1 if you have the <cuda_runtime_api.h> header file. */
#cmakedefine HAVE_CUDA_RUNTIME_API_H
/* Define to 1 if you have the <cufft.h> header file. */
#cmakedefine HAVE_CUFFT_H
/* Define to 1 if you have the DFTI library. */
/* #undef HAVE_DFTI */
/*
* TODO: abinit should either
* - include wrapper sources and integrate then into the build system
* - use a more elaborate way to detect/configure fftw as e.g.
* * https://github.com/ecrc/ecrc_cmake/blob/master/modules/find/FindFFTW.cmake
* * https://github.com/InsightSoftwareConsortium/ITK/blob/master/CMake/FindFFTW.cmake
*/
/* Define to 1 if you have the PAPI library. */
#cmakedefine HAVE_PAPI @HAVE_PAPI@
/* Define to 1 if you have the <papi.h> header file. */
#cmakedefine HAVE_PAPI_H @HAVE_PAPI_H@
/* Define to 1 if you have the <f90papi.h> header file. */
#cmakedefine HAVE_F90PAPI_H @HAVE_F90PAPI_H@
/* Define to 1 if you have the TRIQS library. */
#cmakedefine HAVE_TRIQS @HAVE_TRIQS@
/* Define to 1 if you want to activate internal support for TRIQS 1.4. */
#cmakedefine HAVE_TRIQS_v1_4 @HAVE_TRIQS_v1_4@
/* Define to 1 if you want to activate internal support for TRIQS 2.0 (This
option is dominant over the others versions). */
#cmakedefine HAVE_TRIQS_v2_0 @HAVE_TRIQS_v2_0@
/* Define to 1 if you want to activate internal support for TRIQS 3.x (This
option is dominant over the others versions). */
#cmakedefine HAVE_TRIQS_v3 @HAVE_TRIQS_v3@
/* Define to 1 if your Fortran compiler supports allocatable arrays in datatypes. */
#cmakedefine HAVE_FC_ALLOCATABLE_DTARRAYS @HAVE_FC_ALLOCATABLE_DTARRAYS@
/* Define to 1 if your Fortran compiler supports the asynchronous attribute. */
#cmakedefine HAVE_FC_ASYNC @HAVE_FC_ASYNC@
/* Define to 1 if your Fortran compiler supports BACKTRACE. */
#cmakedefine HAVE_FC_BACKTRACE @HAVE_FC_BACKTRACE@
/* Define to 1 if your Fortran compiler supports GET_COMMAND_ARGUMENT. */
#cmakedefine HAVE_FC_COMMAND_ARGUMENT @HAVE_FC_COMMAND_ARGUMENT@
/* Define to 1 if your Fortran compiler supports the contiguous attribute. */
#cmakedefine HAVE_FC_CONTIGUOUS @HAVE_FC_CONTIGUOUS@
/* Define to 1 if your Fortran compiler supports cpu_time(). */
#cmakedefine HAVE_FC_CPUTIME @HAVE_FC_CPUTIME@
/* Define to 1 if your Fortran compiler supports etime(). */
#cmakedefine HAVE_FC_ETIME @HAVE_FC_ETIME@
/* Define to 1 if your Fortran compiler supports exit(). */
#cmakedefine HAVE_FC_EXIT @HAVE_FC_EXIT@
/* Define to 1 if your Fortran compiler supports flush(). */
#cmakedefine HAVE_FC_FLUSH @HAVE_FC_FLUSH@
/* Define to 1 if your Fortran compiler supports flush_(). */
#cmakedefine HAVE_FC_FLUSH_ @HAVE_FC_FLUSH_@
/* Define to 1 if your Fortran compiler supports gamma(). */
#cmakedefine HAVE_FC_GAMMA @HAVE_FC_GAMMA@
/* Define to 1 if your Fortran compiler supports getenv(). */
#cmakedefine HAVE_FC_GETENV @HAVE_FC_GETENV@
/* Define to 1 if your Fortran compiler supports getpid(). */
#cmakedefine HAVE_FC_GETPID @HAVE_FC_GETPID@
/* Define to 1 if your Fortran compiler supports IEEE_ARITHMETIC module. */
#cmakedefine HAVE_FC_IEEE_ARITHMETIC @HAVE_FC_IEEE_ARITHMETIC@
/* Define to 1 if your Fortran compiler supports IEEE_EXCEPTIONS. */
#cmakedefine HAVE_FC_IEEE_EXCEPTIONS @HAVE_FC_IEEE_EXCEPTIONS@
/* Define to 1 if your Fortran compiler provides the iso_c_binding module. */
#cmakedefine HAVE_FC_ISO_C_BINDING @HAVE_FC_ISO_C_BINDING@
/* Define to 1 if your Fortran compiler supports 2008 standard in
ISO_FORTRAN_ENV. */
#cmakedefine HAVE_FC_ISO_FORTRAN_2008 @HAVE_FC_ISO_FORTRAN_2008@
/* Define to 1 if your Fortran compiler accepts quadruple integers. */
#cmakedefine HAVE_FC_INT_QUAD @HAVE_FC_INT_QUAD@
/* Define to 1 if your Fortran compiler supports IOMSG. */
#cmakedefine HAVE_FC_IOMSG @HAVE_FC_IOMSG@
/* Define to 1 if your Fortran compiler supports long lines. */
#cmakedefine HAVE_FC_LONG_LINES @HAVE_FC_LONG_LINES@
/* Define to 1 if your Fortran compiler supports \newline in a macros. */
#cmakedefine HAVE_FC_MACRO_NEWLINE @HAVE_FC_MACRO_NEWLINE@
/* Define to 1 if your Fortran compiler supports MOVE_ALLOC (F2003). */
#cmakedefine HAVE_FC_MOVE_ALLOC @HAVE_FC_MOVE_ALLOC@
/* Define to 1 if your Fortran compiler can shape arrays on-the-fly. */
#cmakedefine HAVE_FC_ON_THE_FLY_SHAPE @HAVE_FC_ON_THE_FLY_SHAPE@
/* Define to 1 if your Fortran compiler supports the private attribute. */
#cmakedefine HAVE_FC_PRIVATE @HAVE_FC_PRIVATE@
/* Define to 1 if your Fortran compiler supports the protected attribute. */
#cmakedefine HAVE_FC_PROTECTED @HAVE_FC_PROTECTED@
/* Define to 1 if your Fortran compiler supports shiftl() and shiftr(). */
#cmakedefine HAVE_FC_SHIFTLR @HAVE_FC_SHIFTLR@
/* Define to 1 if your Fortran compiler supports stream IO. */
#cmakedefine HAVE_FC_STREAM_IO @HAVE_FC_STREAM_IO@
/* Define to 1 if your Fortran compiler supports SYSTEM. */
#cmakedefine HAVE_FC_SYSTEM @HAVE_FC_SYSTEM@
/* Define to 1 if you have the FFTW3 library. */
#cmakedefine HAVE_FFTW3 @HAVE_FFTW3@
/* Define to 1 if you have a MPI-enabled FFTW3 library. */
#cmakedefine HAVE_FFTW3_MPI @HAVE_FFTW3_MPI@
/* Define to 1 if you have a threads-enabled FFTW3 library. */
#cmakedefine HAVE_FFTW3_THREADS @HAVE_FFTW3_THREADS@
/* Define to 1 if your Fortran compiler supports Fortran 2003. */
/* TODO #cmakedefine HAVE_FORTRAN2003 */
/* Define to 1 if you have a GPU library. */
#cmakedefine HAVE_GPU @HAVE_GPU@
/* Define to 1 if you have the Cuda library. */
#cmakedefine HAVE_GPU_CUDA @HAVE_GPU_CUDA@
/* Define to 1 if you have a Cuda version >= 10 (for nvtx v3). */
#cmakedefine HAVE_GPU_CUDA10 @HAVE_GPU_CUDA10@
/* Define to 1 if you have a Cuda version < 4. */
#cmakedefine HAVE_GPU_CUDA3 @HAVE_GPU_CUDA3@
/* Define to 1 if you want to perform double-precision Cuda calculations. */
#cmakedefine HAVE_GPU_CUDA_DP @HAVE_GPU_CUDA_DP@
/* Define to 1 if you want to perform single-precision Cuda calculations. */
#cmakedefine HAVE_GPU_CUDA_SP @HAVE_GPU_CUDA_SP@
/* Define to 1 if Kokkos is enabled */
#cmakedefine HAVE_KOKKOS @HAVE_KOKKOS@
/* Define to 1 if YAKL is enabled */
#cmakedefine HAVE_YAKL @HAVE_YAKL@
/* Define to 1 if MPI_EXT (MPI extensions, i.e. mpi_ext.h) is available */
#cmakedefine HAVE_MPI_EXT @HAVE_MPI_EXT@
/* Define to 1 if MPIX_Query_cuda_support is available via mpi-ext.h */
#cmakedefine MPI_HAS_QUERY_CUDA_SUPPORT @MPI_HAS_QUERY_CUDA_SUPPORT@
/* Define to 1 if MPIX_Query_hip_support is available via mpi-ext.h */
#cmakedefine MPI_HAS_QUERY_HIP_SUPPORT @MPI_HAS_QUERY_HIP_SUPPORT@
/* Define to 1 if MPIX_Query_ze_support is available via mpi-ext.h */
#cmakedefine MPI_HAS_QUERY_ZE_SUPPORT @MPI_HAS_QUERY_ZE_SUPPORT@
/* Define to 1 if you have a MPI-aware GPU library. */
/* TODO #cmakedefine HAVE_GPU_MPI */
/* Define to 1 if you have library nvtx (v3). */
#cmakedefine HAVE_GPU_NVTX_V3 @HAVE_GPU_NVTX_V3@
/* Define to 1 if you have a serial GPU library. */
#cmakedefine HAVE_GPU_SERIAL @HAVE_GPU_SERIAL@
/* Define to 1 if you want to activate support for OpenMP. */
#cmakedefine HAVE_OPENMP @HAVE_OPENMP@
/* Set to 1 if OpenMP has a working implementation of COLLAPSE. */
#cmakedefine HAVE_OMP_COLLAPSE @HAVE_OMP_COLLAPSE@
/* Define to 1 if you have a working MPI installation. */
#cmakedefine HAVE_MPI @HAVE_MPI@
/* Define to 1 if you have a MPI-1 implementation (obsolete, broken). */
#cmakedefine HAVE_MPI1 @HAVE_MPI1@
/* Define to 1 if you have a MPI-2 implementation. */
#cmakedefine HAVE_MPI2 @HAVE_MPI2@
/* Define to 1 if you want to activate support for MPI_IN_PLACE. */
#cmakedefine HAVE_MPI2_INPLACE @HAVE_MPI2_INPLACE@
/* Define to 1 if you have a MPI-3 implementation. */
#cmakedefine HAVE_MPI3 @HAVE_MPI3@
/* Define to 1 if your MPI implementation provides MPI_Get_library_version. */
#cmakedefine HAVE_MPI_GET_LIBRARY_VERSION @HAVE_MPI_GET_LIBRARY_VERSION@
/* Define to 1 if your MPI library supports MPI_IALLGATHER. */
#cmakedefine HAVE_MPI_IALLGATHER @HAVE_MPI_IALLGATHER@
/* Define to 1 if your MPI library supports MPI_IALLREDUCE. */
#cmakedefine HAVE_MPI_IALLREDUCE @HAVE_MPI_IALLREDUCE@
/* Define to 1 if your MPI library supports MPI_IALLTOALL. */
#cmakedefine HAVE_MPI_IALLTOALL @HAVE_MPI_IALLTOALL@
/* Define to 1 if your MPI library supports MPI_IALLTOALLV. */
#cmakedefine HAVE_MPI_IALLTOALLV @HAVE_MPI_IALLTOALLV@
/* Define to 1 if your MPI library supports MPI_IBCAST. */
#cmakedefine HAVE_MPI_IBCAST @HAVE_MPI_IBCAST@
/* Define to 1 if your MPI library supports MPI_IGATHERV. */
#cmakedefine HAVE_MPI_IGATHERV @HAVE_MPI_IGATHERV@
/* Define to 1 if ..... */
#cmakedefine HAVE_MPI_INCLUDED_ONCE @HAVE_MPI_INCLUDED_ONCE@
/* Define to 1 if your MPI library supports MPI_INTEGER16. */
#cmakedefine HAVE_MPI_INTEGER16 @HAVE_MPI_INTEGER16@
/* Define to 1 if you want MPI I/O support. */
#cmakedefine HAVE_MPI_IO @HAVE_MPI_IO@
/* Define to 1 if you want to use MPI I/O as default I/O library
(maintainer-only option). */
#cmakedefine HAVE_MPI_IO_DEFAULT @HAVE_MPI_IO_DEFAULT@
/* Define to 1 if your MPI library supports MPI_TYPE_CREATE_STRUCT. */
#cmakedefine HAVE_MPI_TYPE_CREATE_STRUCT @HAVE_MPI_TYPE_CREATE_STRUCT@
/* Define to 1 if you want to activate possibility to call python scripts
externally by invoking a python interpreter. */
#cmakedefine HAVE_PYTHON_INVOCATION @HAVE_PYTHON_INVOCATION@
/* ====================================================== */
/* Define to 1 if you have the <dlfcn.h> header file. */
#cmakedefine HAVE_DLFCN_H 1
/* Define to 1 if you have the <inttypes.h> header file. */
#cmakedefine HAVE_INTTYPES_H 1
/* Define to 1 if you have the <memory.h> header file. */
#cmakedefine HAVE_MEMORY_H 1
/* Define to 1 if you have the <stdint.h> header file. */
#cmakedefine HAVE_STDINT_H 1
/* Define to 1 if you have the <stddef.h> header file. */
#cmakedefine HAVE_STDDEF_H 1
/* Define to 1 if you have the <cstdint> header file. */
#cmakedefine HAVE_CSTDINT 1
/* Define to 1 if you have the <stdio.h> header file. */
#cmakedefine HAVE_STDIO_H 1
/* Define to 1 if you have the <stdlib.h> header file. */
#cmakedefine HAVE_STDLIB_H 1
/* Define to 1 if you have the <strings.h> header file. */
#cmakedefine HAVE_STRINGS_H 1
/* Define to 1 if you have the <string.h> header file. */
#cmakedefine HAVE_STRING_H 1
/* Define to 1 if you have the <sys/ioctl.h> header file. */
#cmakedefine HAVE_SYS_IOCTL_H 1
/* Define to 1 if you have the <sys/resource.h> header file. */
#cmakedefine HAVE_SYS_RESOURCE_H 1
/* Define to 1 if you have the <sys/stat.h> header file. */
#cmakedefine HAVE_SYS_STAT_H 1
/* Define to 1 if you have the <sys/time.h> header file. */
#cmakedefine HAVE_SYS_TIME_H 1
/* Define to 1 if you have the <sys/types.h> header file. */
#cmakedefine HAVE_SYS_TYPES_H 1
/* Define to 1 if you have the <termios.h> header file. */
#cmakedefine HAVE_TERMIOS_H 1
/* Define to 1 if you have the <time.h> header file. */
#cmakedefine HAVE_TIME_H 1
/* Define to 1 if you have the <unistd.h> header file. */
#cmakedefine HAVE_UNISTD_H 1
/* Define to 1 if you have the <errno.h> header file. */
#cmakedefine HAVE_ERRNO_H 1
/* The size of `char', as computed by sizeof. */
@SIZEOF_CHAR_CODE@
/* The size of `double', as computed by sizeof. */
@SIZEOF_DOUBLE_CODE@
/* The size of `float', as computed by sizeof. */
@SIZEOF_FLOAT_CODE@
/* The size of `int', as computed by sizeof. */
@SIZEOF_INT_CODE@
/* The size of `long', as computed by sizeof. */
@SIZEOF_LONG_CODE@
/* The size of `long double', as computed by sizeof. */
@SIZEOF_LONG_DOUBLE_CODE@
/* The size of `long long', as computed by sizeof. */
@SIZEOF_LONG_LONG_CODE@
/* The size of `ptrdiff_t', as computed by sizeof. */
@SIZEOF_PTRDIFF_T_CODE@
/* The size of `short', as computed by sizeof. */
@SIZEOF_SHORT_CODE@
/* The size of `size_t', as computed by sizeof. */
@SIZEOF_SIZE_T_CODE@
/* The size of `unsigned int', as computed by sizeof. */
@SIZEOF_UNSIGNED_INT_CODE@
/* The size of `unsigned long', as computed by sizeof. */
@SIZEOF_UNSIGNED_LONG_CODE@
/* The size of `unsigned long long', as computed by sizeof. */
@SIZEOF_UNSIGNED_LONG_LONG_CODE@
/* ====================================================== */
/* ================ External Dependencies =============== */
/* ====================================================== */
/* Define to 1 if you have the LibPAW library. */
#cmakedefine HAVE_LIBPAW @HAVE_LIBPAW@
/* Must be defined to 1 to have LibPAW properly working. */
#cmakedefine HAVE_LIBPAW_ABINIT @HAVE_LIBPAW_ABINIT@
/* Define to 1 if you have the LibXC library. */
#cmakedefine HAVE_LIBXC @HAVE_LIBXC@
/* Define to 1 if you have the ASL linear algebra library. */
#cmakedefine HAVE_LINALG_ASL @HAVE_LINALG_ASL@
/* Define to 1 if you have an AXPBY BLAS1 extensions. */
#cmakedefine HAVE_LINALG_AXPBY @HAVE_LINALG_AXPBY@
/* Define to 1 if you have the ELPA linear algebra library. */
#cmakedefine HAVE_LINALG_ELPA @HAVE_LINALG_ELPA@
/* Define to 1 if you have ELPA 2011-13 API support. */
#cmakedefine HAVE_LINALG_ELPA_2013 @HAVE_LINALG_ELPA_2013@
/* Define to 1 if you have ELPA 2014 API support. */
#cmakedefine HAVE_LINALG_ELPA_2014 @HAVE_LINALG_ELPA_2014@
/* Define to 1 if you have ELPA 2015.02 API support. */
#cmakedefine HAVE_LINALG_ELPA_2015_02 @HAVE_LINALG_ELPA_2015_02@
/* Define to 1 if you have ELPA 2015.11 API support. */
#cmakedefine HAVE_LINALG_ELPA_2015_11 @HAVE_LINALG_ELPA_2015_11@
/* Define to 1 if you have ELPA 2016 API support. */
#cmakedefine HAVE_LINALG_ELPA_2016 @HAVE_LINALG_ELPA_2016@
/* Define to 1 if you have ELPA 2017 API support. */
#cmakedefine HAVE_LINALG_ELPA_2017 @HAVE_LINALG_ELPA_2017@
/* Define to 1 if you have the ELPA Fortran 2008 API support. */
#cmakedefine HAVE_LINALG_ELPA_FORTRAN2008 @HAVE_LINALG_ELPA_FORTRAN2008@
/* Define to 1 if you have the ESSL linear algebra library. */
#cmakedefine HAVE_LINALG_ESSL @HAVE_LINALG_ESSL@
/* Define to 1 if you have GEMM3M BLAS3 extensions. */
#cmakedefine HAVE_LINALG_GEMM3M @HAVE_LINALG_GEMM3M@
/* Define to 1 if you have GEMMT BLAS3 extensions. */
#cmakedefine HAVE_LINALG_GEMMT @HAVE_LINALG_GEMMT@
/* Define to 1 if you have the MAGMA linear algebra library. */
#cmakedefine HAVE_LINALG_MAGMA @HAVE_LINALG_MAGMA@
/* Define to 1 if you have MAGMA >=1.5 API support */
#cmakedefine HAVE_LINALG_MAGMA_15 @HAVE_LINALG_MAGMA_15@
/* Define to 1 if you have MKL imatcopy extensions. */
#cmakedefine HAVE_LINALG_MKL_IMATCOPY @HAVE_LINALG_MKL_IMATCOPY@
/* Define to 1 if you have MKL omatadd extensions. */
#cmakedefine HAVE_LINALG_MKL_OMATADD @HAVE_LINALG_MKL_OMATADD@
/* Define to 1 if you have MKL omatcopy extensions. */
#cmakedefine HAVE_LINALG_MKL_OMATCOPY @HAVE_LINALG_MKL_OMATCOPY@
/* Define to 1 if you have mkl_*threads extensions. */
#cmakedefine HAVE_LINALG_MKL_THREADS @HAVE_LINALG_MKL_THREADS@
/* Define to 1 if you have the PLASMA linear algebra library. */
#cmakedefine HAVE_LINALG_PLASMA @HAVE_LINALG_PLASMA@
/* Define to 1 if you have the ScaLAPACK linear algebra library. */
#cmakedefine HAVE_LINALG_SCALAPACK @HAVE_LINALG_SCALAPACK@
/* Define to 1 if you want to activate workaround for bugged ZDOTC and ZDOTU. */
#cmakedefine HAVE_LINALG_ZDOTC_BUG @HAVE_LINALG_ZDOTC_BUG@
/* Define to 1 if you want to activate workaround for bugged ZDOTC and ZDOTU. */
#cmakedefine HAVE_LINALG_ZDOTU_BUG @HAVE_LINALG_ZDOTU_BUG@
/* Define to 1 if you want to activate internal support for libtetra(hedron)
in ABINIT. */
#cmakedefine HAVE_LIBTETRA_ABINIT @HAVE_LIBTETRA_ABINIT@
#cmakedefine HAVE_FFTW3 @HAVE_FFTW3@
#cmakedefine HAVE_FFTW3_MPI @HAVE_FFTW3_MPI@
#cmakedefine HAVE_FFTW3_THREADS @HAVE_FFTW3_THREADS@
#cmakedefine HAVE_PFFT @HAVE_PFFT@
#cmakedefine HAVE_LEVMAR @HAVE_LEVMAR@
#cmakedefine HAVE_LIBPSML @HAVE_LIBPSML@
#cmakedefine HAVE_HDF5 @HAVE_HDF5@
#cmakedefine HAVE_HDF5_MPI @HAVE_HDF5_MPI@
#cmakedefine HAVE_NETCDF @HAVE_NETCDF@
#cmakedefine HAVE_NETCDF_DEFAULT @HAVE_NETCDF_DEFAULT@
#cmakedefine HAVE_NETCDF_FORTRAN @HAVE_NETCDF_FORTRAN@
#cmakedefine HAVE_NETCDF_FORTRAN_MPI @HAVE_NETCDF_FORTRAN_MPI@
#cmakedefine HAVE_NETCDF_MPI @HAVE_NETCDF_MPI@
/* Define to 1 if you have the Wannier90 library. */
#cmakedefine HAVE_WANNIER90 @HAVE_WANNIER90@
/* Define to 1 if you want to use LibXML2-based XML I/O. */
#cmakedefine HAVE_XML @HAVE_XML@
/* Define to 1 if you have the XMLF90 library. */
#cmakedefine HAVE_XMLF90 @HAVE_XMLF90@
#endif

View File

@ -389,7 +389,7 @@ AC_DEFUN([ABI_INIT_HEADER],[
AH_BOTTOM([/* *** BEGIN sanity checks *** */
/* MPI options */
#if defined HAVE_MPI
#if defined HAVE_MPI
/* Check that one MPI level is actually defined */
#if ! defined HAVE_MPI1 && ! defined HAVE_MPI2 && ! defined HAVE_MPI3
@ -418,7 +418,7 @@ AC_DEFUN([ABI_INIT_HEADER],[
#else /* HAVE_MPI */
/* Check that no MPI level is defined */
#if defined HAVE_MPI1 || defined HAVE_MPI2 || HAVE_MPI3
#if defined HAVE_MPI1 || defined HAVE_MPI2 || defined HAVE_MPI3
#error "HAVE_MPI1, HAVE_MPI2, and HAVE_MPI3, must be undefined"
#endif
@ -481,7 +481,7 @@ AC_DEFUN([ABI_INIT_INSTALL_DIRS],[
AC_DEFUN([ABI_INIT_TARGET],[
dnl Clean-up operating system name
[abi_target_os=`echo ${target_os} | sed -e 's/-.*//'`]
ABINIT_TARGET="${target_cpu}_${abi_target_os}_${abi_fc_vendor}${abi_fc_version}"
AC_DEFINE_UNQUOTED(ABINIT_TARGET,"${ABINIT_TARGET}",
[Abinit target description.])

2
shared/CMakeLists.txt Normal file
View File

@ -0,0 +1,2 @@
add_subdirectory(common)
#add_subdirectory(libpaw)

View File

@ -0,0 +1 @@
add_subdirectory(src)

View File

@ -0,0 +1,47 @@
#
# 02_clib
#
add_library(02_clib STATIC
calling_levmar.c
cclock.c
etime.c
sockets.c
fsi_posix.c
gnu_tools.c
mallinfo.c
md5.c
md5.h
rlimit.c
xexit.c
xmalloc.c
xmalloc.h
m_fsockets.F90
m_clib.F90)
set_target_properties(02_clib
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(02_clib
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(02_clib
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(02_clib
PRIVATE
HAVE_CONFIG_H)
if(levmar_FOUND)
target_link_libraries(02_clib
PUBLIC
abinit::levmar)
endif()
add_library(abinit::02_clib ALIAS 02_clib)

View File

@ -0,0 +1,28 @@
#
# 10_defs
#
add_library(10_defs STATIC
defs_basis.F90
defs_datatypes.F90)
set_target_properties(10_defs
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(10_defs
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(10_defs
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(10_defs
PRIVATE
HAVE_CONFIG_H)
add_library(abinit::10_defs ALIAS 10_defs)

View File

@ -0,0 +1,33 @@
#
# 11_memory_mpi
#
add_library(11_memory_mpi STATIC
m_profiling_abi.F90)
set_target_properties(11_memory_mpi
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(11_memory_mpi
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(11_memory_mpi
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(11_memory_mpi
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(11_memory_mpi
PRIVATE
abinit::02_clib
abinit::10_defs
MPI::MPI_Fortran)
add_library(abinit::11_memory_mpi ALIAS 11_memory_mpi)

View File

@ -0,0 +1,86 @@
#
# 12_hide_mpi
#
set(12_hide_mpi_SRC
m_xmpi.F90
m_xomp.F90
xmpi_allgather.finc
xmpi_iallgather.finc
xmpi_allgatherv.finc
xmpi_gather.finc
xmpi_gatherv.finc
xmpi_bcast.finc
xmpi_min.finc
xmpi_sum_master.finc
xmpi_exch.finc
xmpi_recv.finc
xmpi_irecv.finc
xmpi_sum.finc
xmpi_ibcast.finc
xmpi_isum.finc
xmpi_alltoall.finc
xmpi_ialltoall.finc
xmpi_alltoallv.finc
xmpi_ialltoallv.finc
xmpi_max.finc
xmpi_send.finc
xmpi_isend.finc
xmpi_scatterv.finc
xmpi_land_lor.finc)
if (ABINIT_ENABLE_GPU_CUDA AND ABINIT_KOKKOS_WANTED)
LIST(APPEND 12_hide_mpi_SRC
kokkos-utils.cpp m_kokkos_utils.F90)
endif()
add_library(12_hide_mpi STATIC
${12_hide_mpi_SRC})
set_target_properties(12_hide_mpi
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(12_hide_mpi
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(12_hide_mpi
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(12_hide_mpi
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(12_hide_mpi
PUBLIC
abinit::02_clib
abinit::10_defs
abinit::11_memory_mpi
MPI::MPI_Fortran)
if(OpenMP_FOUND)
target_link_libraries(12_hide_mpi
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
if(ABINIT_ENABLE_GPU_CUDA AND ABINIT_KOKKOS_WANTED)
target_link_libraries(12_hide_mpi
PUBLIC
Kokkos::kokkos
)
endif()
if(ABINIT_ENABLE_GPU_CUDA AND ABINIT_YAKL_WANTED)
target_link_libraries(12_hide_mpi
PRIVATE
abinit::yakl
)
endif()
add_library(abinit::12_hide_mpi ALIAS 12_hide_mpi)

View File

@ -0,0 +1,52 @@
#
# 14_hidewrite
#
# generate m_build_info.F90
include(${CMAKE_CURRENT_SOURCE_DIR}/generate_build_info.cmake)
generate_build_info()
# TODO : refactor, there is currently no systematic way to
# to override compilation flags; we should write a cmake macro
# to todo that using set/get_target_properties for property
# "COMPILE_FLAGS"
configure_file(m_optim_dumper.F90.cmake.in m_optim_dumper.F90 @ONLY)
add_library(14_hidewrite STATIC
m_abicore.F90
m_cppopts_dumper.F90
m_fstrings.F90
m_io_tools.F90
m_specialmsg.F90
# generated sources
${CMAKE_CURRENT_BINARY_DIR}/m_build_info.F90
${CMAKE_CURRENT_BINARY_DIR}/m_optim_dumper.F90)
set_target_properties(14_hidewrite
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(14_hidewrite
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(14_hidewrite
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(14_hidewrite
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(14_hidewrite
PUBLIC
abinit::10_defs
abinit::11_memory_mpi
abinit::12_hide_mpi
MPI::MPI_Fortran)
add_library(abinit::14_hidewrite ALIAS 14_hidewrite)

View File

@ -0,0 +1,20 @@
macro(generate_build_info)
set(TARGET_CPU ${CMAKE_HOST_SYSTEM_PROCESSOR})
cmake_host_system_information(RESULT TARGET_CPU_LONG QUERY PROCESSOR_DESCRIPTION)
cmake_host_system_information(RESULT OS_NAME QUERY OS_NAME)
set(abi_target_os ${OS_NAME})
set(abi_cc_vendor ${CMAKE_C_COMPILER_ID})
set(abi_cc_version ${CMAKE_C_COMPILER_VERSION})
set(abi_cxx_vendor ${CMAKE_CXX_COMPILER_ID})
set(abi_cxx_version ${CMAKE_CXX_COMPILER_VERSION})
set(abi_fc_vendor ${CMAKE_Fortran_COMPILER_ID})
set(abi_fc_version ${CMAKE_Fortran_COMPILER_VERSION})
set(ABINIT_TARGET ${TARGET_CPU}_${abi_target_os}_${abi_fc_vendor}_${abi_fc_version})
message(STATUS "Generating m_build_info.F90...")
configure_file(m_build_info.F90.cmake.in m_build_info.F90 @ONLY)
endmacro()

View File

@ -0,0 +1,202 @@
!{\src2tex{textfont=tt}}
!!****m* ABINIT/m_build_info
!! NAME
!! m_build_info
!!
!! FUNCTION
!! This module contains information about this particular version of ABINIT
!! and its build parameters (useful for debugging).
!!
!! COPYRIGHT
!! Copyright (C) 2005-2022 ABINIT group (Yann Pouillon, Matteo Giantomassi)
!! This file is distributed under the terms of the
!! GNU General Public License, see ~abinit/COPYING
!! or http://www.gnu.org/copyleft/gpl.txt .
!!
!! SOURCE
#if defined HAVE_CONFIG_H
#include "config.h"
#endif
module m_build_info
implicit none
! Try to prevent problems with the length of the argument
! (should not exceed the line length of 132 character).
! So, always start the string to be replaced at the beginning of a line.
! Parameters set-up by Autoconf
character(len=8),parameter :: abinit_version = &
& "@CMAKE_PROJECT_VERSION@"
character(len=*),parameter :: build_target = &
& "@ABINIT_TARGET@"
! More info on current version
character(len=*),parameter :: version_major = &
& "@CMAKE_PROJECT_VERSION_MAJOR@"
character(len=*),parameter :: version_minor = &
& "@CMAKE_PROJECT_VERSION_MINOR@"
character(len=*),parameter :: version_micro = &
& "@CMAKE_PROJECT_VERSION_PATCH@"
character(len=*),parameter :: version_build = &
& "@ABINIT_VERSION_BUILD@"
! Info on compilers. Try to prevent problems with the length of the argument
! (should not exceed the line length of 132 character).
character(len=*),parameter :: cc_info = &
& "@abi_cc_vendor@@abi_cc_version@"
character(len=*),parameter :: cxx_info = &
& "@abi_cxx_vendor@@abi_cxx_version@"
character(len=*),parameter :: fc_info = &
& "@abi_fc_vendor@@abi_fc_version@"
character(len=*),parameter :: cc_flags = &
& "@CMAKE_C_FLAGS@"
character(len=*),parameter :: cxx_flags = &
& "@CMAKE_CXX_FLAGS@"
!! TODO : would be much better to use get_target_property on abinit exe
!! to retrieve the relevant info
character(len=*),parameter :: fc_flags = &
& "TODO@CMAKE_Fortran_FLAGS@"
character(len=*),parameter :: fc_ldflags = &
& "TODO@CMAKE_Fortran_FLAGS@"
! Info on optimizations
character(len=*),parameter :: with_debug_flavor = &
& "@ABI_DEBUG_FLAVOR@"
character(len=*),parameter :: with_optim_flavor = &
& "@ABI_OPTIM_FLAVOR@"
character(len=*),parameter :: cpu_info = &
& "@TARGET_CPU_LONG@"
! Info on MPI
character(len=*),parameter :: with_mpi = &
& "@HAVE_MPI@"
character(len=*),parameter :: enable_mpi_io = &
& "@HAVE_MPI_IO@"
! Info on openMP
character(len=*),parameter :: enable_openmp = &
& "@HAVE_OPENMP@"
! Info on GPU
character(len=*),parameter :: with_gpu = &
& "@HAVE_GPU@"
! Info on external dependencies
character(len=*),parameter :: linalg_flavor = &
& "TODO"
character(len=*),parameter :: scalapack_enabled = &
& "@ABINIT_SCALAPACK_ENABLED@"
character(len=*),parameter :: scalapack_flavor = &
& "@ABINIT_SCALAPACK_FLAVOR@"
character(len=*),parameter :: fft_flavor = &
& "@ABINIT_FFT_FLAVOR@"
character(len=*),parameter :: with_hdf5 = &
& "@HAVE_HDF5@"
character(len=*),parameter :: with_netcdf = &
& "@HAVE_NETCDF@"
character(len=*),parameter :: with_netcdf_fortran = &
& "@HAVE_NETCDF_FORTRAN@"
character(len=*),parameter :: with_libxc = &
& "@HAVE_LIBXC@"
character(len=*),parameter :: with_wannier90 = &
& "@HAVE_WANNIER90@"
! Info on experimental features
character(len=*),parameter :: enable_exports = &
& "TODO@enable_exports@"
character(len=*),parameter :: enable_gw_dpc = &
& "@HAVE_GW_DPC@"
contains !===========================================================
!!***
!!****f* ABINIT/m_build_info/dump_config
!! NAME
!! dump_config
!!
!! FUNCTION
!! Reports a printout of the information stored in m_build_info,
!! useful for error messages and debugging.
!!
!! INPUTS
!! my_unit= Fortran unit number
!!
!! OUTPUT
!! Only printing
!!
!! PARENTS
!! Will be filled automatically by the parent script
!!
!! CHILDREN
!! Will be filled automatically by the parent script
!!
!! SOURCE
subroutine dump_config(my_unit)
implicit none
!Arguments ------------------------------------
integer,intent(in) :: my_unit
!Local variables-------------------------------
! *********************************************************************
! TODO: things that might be added through preprocessing options, e.g.
! date and time of compilation
write(my_unit,*)
write(my_unit,'(1x,a)') repeat('+',78)
write(my_unit,*)
write(my_unit,'(a)' )' === Build Information === '
write(my_unit,'(2a)')' Version : ',trim(abinit_version)
write(my_unit,'(2a)')' Build target : ',trim(build_target)
write(my_unit,'(2a)')' Build date : ',trim(version_build)
write(my_unit,*)
write(my_unit,'(a)' )' === Compiler Suite === '
write(my_unit,'(2a)')' C compiler : ',trim(cc_info)
write(my_unit,'(2a)')' C++ compiler : ',trim(cxx_info)
write(my_unit,'(2a)')' Fortran compiler : ',trim(fc_info)
write(my_unit,'(2a)')' CFLAGS : ',trim(cc_flags)
write(my_unit,'(2a)')' CXXFLAGS : ',trim(cxx_flags)
write(my_unit,'(2a)')' FCFLAGS : ',trim(fc_flags)
write(my_unit,'(2a)')' FC_LDFLAGS : ',trim(fc_ldflags)
write(my_unit,*)
write(my_unit,'(a) ')' === Optimizations === '
write(my_unit,'(2a)')' Debug level : ',trim(with_debug_flavor)
write(my_unit,'(2a)')' Optimization level : ',trim(with_optim_flavor)
write(my_unit,'(2a)')' Architecture : ',trim(cpu_info)
write(my_unit,*)
write(my_unit,'(a) ')' === Multicore === '
write(my_unit,'(2a)')' Parallel build : ',trim(with_mpi)
write(my_unit,'(2a)')' Parallel I/O : ',trim(enable_mpi_io)
write(my_unit,'(2a)')' openMP support : ',trim(enable_openmp)
write(my_unit,'(2a)')' GPU support : ',trim(with_gpu)
write(my_unit,*)
write(my_unit,'(a) ')' === Connectors / Fallbacks === '
write(my_unit,'(2a)')' LINALG flavor : ',trim(linalg_flavor)
write(my_unit,'(2a)')' SCALAPACK enabled : ',trim(scalapack_enabled)
write(my_unit,'(2a)')' SCALAPACK flavor : ',trim(scalapack_flavor)
write(my_unit,'(2a)')' FFT flavor : ',trim(fft_flavor)
write(my_unit,'(2a)')' HDF5 : ',trim(with_hdf5)
write(my_unit,'(2a)')' NetCDF : ',trim(with_netcdf)
write(my_unit,'(2a)')' NetCDF Fortran : ',trim(with_netcdf_fortran)
write(my_unit,'(2a)')' LibXC : ',trim(with_libxc)
write(my_unit,'(2a)')' Wannier90 : ',trim(with_wannier90)
write(my_unit,*)
write(my_unit,'(a)' )' === Experimental features === '
write(my_unit,'(2a)')' Exports : ',trim(enable_exports)
write(my_unit,'(2a)')' GW double-precision : ',trim(enable_gw_dpc)
write(my_unit,*)
write(my_unit,'(1x,a)') repeat('+',78)
write(my_unit,*)
end subroutine dump_config
!!***
end module m_build_info
!!***

View File

@ -0,0 +1,83 @@
!{\src2tex{textfont=tt}}
!!****m* ABINIT/m_optim_dumper
!! NAME
!! m_optim_dumper
!!
!! FUNCTION
!! This module contains information about the optimizations set at
!! configure-time when building ABINIT (useful for debugging).
!!
!! COPYRIGHT
!! Copyright (C) 2010-2022 ABINIT group (Yann Pouillon)
!! This file is distributed under the terms of the
!! GNU General Public License, see ~abinit/COPYING
!! or http://www.gnu.org/copyleft/gpl.txt .
!!
!! SOURCE
#if defined HAVE_CONFIG_H
#include "config.h"
#endif
module m_optim_dumper
implicit none
public :: dump_optim
contains !===========================================================
!!***
!!****f* ABINIT/m_optim_dumper/dump_optim
!! NAME
!! dump_optim
!!
!! FUNCTION
!! Reports a printout of the optimizations set at configure-time,
!! useful for error messages and debugging.
!!
!! COPYRIGHT
!! Copyright (C) 2010-2022 ABINIT group (Yann Pouillon)
!! This file is distributed under the terms of the
!! GNU General Public License, see ~abinit/COPYING
!! or http://www.gnu.org/copyleft/gpl.txt .
!!
!! INPUTS
!! my_unit= Fortran unit number (optional, default is std_out)
!!
!! OUTPUT
!! Only printing
!!
!! PARENTS
!! Will be filled automatically by the parent script
!!
!! CHILDREN
!! Will be filled automatically by the parent script
!!
!! SOURCE
subroutine dump_optim(my_unit)
use defs_basis
implicit none
!Arguments ------------------------------------
integer,intent(in) :: my_unit
!Local variables-------------------------------
! *************************************************************************
write(my_unit,"(a,1x,a)") ch10,repeat("+",78)
! write(my_unit,"(1x,a,a,3x,a,a,a)") "Default optimizations:",ch10, &
!& "@fcflags_opt_default@",ch10,ch10@config.optim@
write(my_unit,"(1x,a,a,3x,a,a,a)") "Default optimizations:",ch10, &
& "@CMAKE_Fortran_FLAGS@",ch10,ch10
write(my_unit,"(1x,a,a)") repeat("+",78),ch10
end subroutine dump_optim
end module m_optim_dumper
!!***

View File

@ -0,0 +1,41 @@
#
# 16_hideleave
#
add_library(16_hideleave STATIC
m_xieee.F90
m_errors.F90
)
set_target_properties(16_hideleave
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(16_hideleave
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${NetCDF_MOD_INC}
)
target_include_directories(16_hideleave
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(16_hideleave
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(16_hideleave
PUBLIC
abinit::10_defs
abinit::11_memory_mpi
abinit::12_hide_mpi
abinit::14_hidewrite
abinit::netcdf-fortran
abinit::netcdf
MPI::MPI_Fortran
)
add_library(abinit::16_hideleave ALIAS 16_hideleave)

View File

@ -0,0 +1,49 @@
#
# 17_gpu_toolbox
#
add_library(17_gpu_toolbox STATIC
abi_gpu_header_common.h
dev_spec.cu
gpu_linalg.cu
m_gpu_detect.F90
m_gpu_toolbox.F90
m_initcuda.F90
m_nvtx.F90
timing_cuda.cu
)
set_target_properties(17_gpu_toolbox
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(17_gpu_toolbox
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs)
target_include_directories(17_gpu_toolbox
PUBLIC
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules;${CMAKE_CURRENT_SOURCE_DIR}>"
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(17_gpu_toolbox
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(17_gpu_toolbox
PUBLIC
abinit::10_defs
abinit::14_hidewrite
)
if(ABINIT_ENABLE_GPU_CUDA)
target_link_libraries(17_gpu_toolbox
PUBLIC
CUDA::cublas
CUDA::cusolver
CUDA::nvToolsExt
)
endif()
add_library(abinit::17_gpu_toolbox ALIAS 17_gpu_toolbox)

View File

@ -0,0 +1,48 @@
#
# 17_libtetra_ext
#
add_library(17_libtetra_ext STATIC
libtetra.h
libtetrabz.F90
libtetrabz_common.F90
libtetrabz_dbldelta_mod.F90
libtetrabz_dblstep_mod.F90
libtetrabz_dos_mod.F90
libtetrabz_fermigr_mod.F90
libtetrabz_occ_mod.F90
libtetrabz_polcmplx_mod.F90
libtetrabz_polstat_mod.F90
m_simtet.F90
m_krank.F90
m_tetrahedron.F90
)
set_target_properties(17_libtetra_ext
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(17_libtetra_ext
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(17_libtetra_ext
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(17_libtetra_ext
PUBLIC
abinit::14_hidewrite
abinit::16_hideleave
)
if(OpenMP_FOUND)
target_link_libraries(17_libtetra_ext
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::17_libtetra_ext ALIAS 17_libtetra_ext)

View File

@ -0,0 +1,37 @@
#
# 17_yaml_out
#
add_library(17_yaml_out STATIC
c_pair_list.c
m_type_pair_list.F90
m_pair_list.F90
m_stream_string.F90
m_yaml.F90
)
set_target_properties(17_yaml_out
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(17_yaml_out
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(17_yaml_out
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(17_yaml_out
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(17_yaml_out
PUBLIC
abinit::16_hideleave
)
add_library(abinit::17_yaml_out ALIAS 17_yaml_out)

View File

@ -0,0 +1,40 @@
#
# 18_timing
#
add_library(18_timing STATIC
m_xpapi.F90
m_time.F90
)
set_target_properties(18_timing
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(18_timing
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(18_timing
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(18_timing
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(18_timing
PUBLIC
abinit::16_hideleave
)
if(ABINIT_PAPI_FOUND)
target_link_libraries(18_timing
PUBLIC
abinit::papi)
endif()
add_library(abinit::18_timing ALIAS 18_timing)

View File

@ -0,0 +1,29 @@
#
# 21_hashfuncs
#
add_library(21_hashfuncs STATIC
m_hash_md5.F90
)
set_target_properties(21_hashfuncs
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(21_hashfuncs
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(21_hashfuncs
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(21_hashfuncs
PUBLIC
abinit::16_hideleave
)
add_library(abinit::21_hashfuncs ALIAS 21_hashfuncs)

View File

@ -0,0 +1,39 @@
#
# 27_toolbox_oop
#
add_library(27_toolbox_oop STATIC
m_copy.F90
m_iterators.F90
m_mpiotk.F90
m_nctk.F90
)
set_target_properties(27_toolbox_oop
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(27_toolbox_oop
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(27_toolbox_oop
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(27_toolbox_oop
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(27_toolbox_oop
PUBLIC
abinit::10_defs
abinit::14_hidewrite
abinit::16_hideleave
abinit::17_yaml_out
)
add_library(abinit::27_toolbox_oop ALIAS 27_toolbox_oop)

View File

@ -0,0 +1,75 @@
#
# 28_numeric_noabirule
#
add_library(28_numeric_noabirule STATIC
m_lib_four.F90
m_abi_linalg.F90
m_array.F90
m_bessel.F90
m_cplxtools.F90
m_bspline.F90
m_elpa.F90
m_gaussian_quadrature.F90
m_hide_blas.F90
m_hide_lapack.F90
m_lebedev.F90
m_levenberg_marquardt.F90
m_linalg_interfaces.F90
m_numeric_tools.F90
m_per_cond.F90
m_random_xoroshiro128plus.F90
m_random_zbq.F90
m_slk.F90
m_sort.F90
m_splines.F90
)
set_target_properties(28_numeric_noabirule
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(28_numeric_noabirule
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(28_numeric_noabirule
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(28_numeric_noabirule
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(28_numeric_noabirule
PUBLIC
abinit::18_timing
abinit::27_toolbox_oop
BLAS::BLAS
LAPACK::LAPACK
)
if(ABINIT_SCALAPACK_ENABLED)
target_link_libraries(28_numeric_noabirule
PUBLIC
abinit::scalapack
)
endif()
if(OpenMP_FOUND)
target_link_libraries(28_numeric_noabirule
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
if(ABINIT_ENABLE_GPU_CUDA)
target_link_libraries(28_numeric_noabirule
PUBLIC
abinit::17_gpu_toolbox
)
endif()
add_library(abinit::28_numeric_noabirule ALIAS 28_numeric_noabirule)

View File

@ -0,0 +1,33 @@
#
# 29_kpoints
#
add_library(29_kpoints STATIC
m_hashtable.F90
m_htetra.F90
m_octree.F90
m_symkpt.F90
)
set_target_properties(29_kpoints
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(29_kpoints
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(29_kpoints
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(29_kpoints
PUBLIC
abinit::17_libtetra_ext
abinit::28_numeric_noabirule
)
add_library(abinit::29_kpoints ALIAS 29_kpoints)

View File

@ -0,0 +1,37 @@
#
# 32_util
#
add_library(32_util STATIC
m_atomdata.F90
m_dummy.F90
m_exp_mat.F90
m_matrix.F90
m_pptools.F90
m_special_funcs.F90
m_symtk.F90
m_pstat.F90
)
set_target_properties(32_util
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(32_util
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(32_util
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(32_util
PUBLIC
abinit::17_libtetra_ext
abinit::28_numeric_noabirule
)
add_library(abinit::32_util ALIAS 32_util)

View File

@ -0,0 +1,53 @@
#
# 33_xc_lowlevel
#
add_library(33_xc_lowlevel STATIC
libxc_tools.c
m_libxc_functionals.F90
m_drivexc.F90
m_xc_noncoll.F90
m_xchcth.F90
m_xciit.F90
m_xcpbe.F90
m_xcpositron.F90
m_xclda.F90
)
set_target_properties(33_xc_lowlevel
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(33_xc_lowlevel
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
)
target_include_directories(33_xc_lowlevel
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(33_xc_lowlevel
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(33_xc_lowlevel
PUBLIC
abinit::28_numeric_noabirule
)
if(OpenMP_FOUND)
target_link_libraries(33_xc_lowlevel
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
if(ABINIT_LIBXC_FOUND)
target_link_libraries(33_xc_lowlevel
PUBLIC
abinit::libxc)
endif()
add_library(abinit::33_xc_lowlevel ALIAS 33_xc_lowlevel)

View File

@ -0,0 +1,19 @@
add_subdirectory(02_clib)
add_subdirectory(10_defs)
add_subdirectory(11_memory_mpi)
add_subdirectory(12_hide_mpi)
add_subdirectory(14_hidewrite)
add_subdirectory(16_hideleave)
if(ABINIT_ENABLE_GPU_CUDA)
add_subdirectory(17_gpu_toolbox)
endif()
add_subdirectory(17_libtetra_ext)
add_subdirectory(17_yaml_out)
add_subdirectory(18_timing)
add_subdirectory(21_hashfuncs)
add_subdirectory(27_toolbox_oop)
add_subdirectory(28_numeric_noabirule)
add_subdirectory(29_kpoints)
add_subdirectory(32_util)
add_subdirectory(33_xc_lowlevel)
add_subdirectory(39_libpaw)

View File

@ -39,7 +39,7 @@
#endif
#ifdef HAVE_STDDEF_H
#include <stddef.h> /* ptrdiff_t */
#include <stddef.h> /* ptrdiff_t and size_t */
#endif
#ifdef HAVE_SYS_TYPES_H
@ -84,7 +84,7 @@
#define STRINGIZE(x) STRINGIZEx(x)
#define CONCAT(prefix, name) prefix ## name
/* determine precision */
/* determine precision */
#if defined(ABINIT_SINGLE)
typedef float R;
#elif defined(ABINIT_LDOUBLE)

View File

@ -0,0 +1,71 @@
#
# 39_libpaw
#
add_library(39_libpaw STATIC
libpaw_libxc.c
m_libpaw_mpi.F90
m_libpaw_tools.F90
m_libpaw_libxc.F90
m_paral_atom.F90
m_paw_numeric.F90
m_paw_sphharm.F90
m_paw_io.F90
m_pawang.F90
m_pawrad.F90
m_pawtab.F90
m_paw_an.F90
m_paw_ij.F90
m_pawfgrtab.F90
m_paw_finegrid.F90
m_paw_onsite.F90
m_pawcprj.F90
m_pawrhoij.F90
m_pawdij.F90
m_pawxc.F90
m_paw_atom.F90
m_paw_gaussfit.F90
m_pawxmlps.F90
m_pawpsp.F90
)
set_target_properties(39_libpaw
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(39_libpaw
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs)
target_include_directories(39_libpaw
PUBLIC
$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/modules>
$<INSTALL_INTERFACE:include/libpaw>
)
target_compile_definitions(39_libpaw
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(39_libpaw
PUBLIC
abinit::33_xc_lowlevel
)
if(OpenMP_FOUND)
target_link_libraries(39_libpaw
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::39_libpaw ALIAS 39_libpaw)
#
# installable libpaw
#
set_target_properties(39_libpaw
PROPERTIES OUTPUT_NAME paw)
# change export name, so that the user projet can import target abinit::paw
set_target_properties(39_libpaw
PROPERTIES EXPORT_NAME paw)

View File

@ -0,0 +1,41 @@
#
# 41_geometry
#
add_library(41_geometry STATIC
m_ab7_symmetry.F90
m_crystal.F90
m_ewald.F90
m_geometry.F90
m_gtermcutoff.F90
m_spgdata.F90
m_spgbuilder.F90
m_supercell.F90
m_symlist.F90
m_symsg.F90
m_symfind.F90
)
set_target_properties(41_geometry
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(41_geometry
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(41_geometry
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(41_geometry
PUBLIC
abinit::28_numeric_noabirule
abinit::32_util
abinit::39_libpaw
)
add_library(abinit::41_geometry ALIAS 41_geometry)

View File

@ -0,0 +1,36 @@
#
# 42_nlstrain
#
add_library(42_nlstrain STATIC
m_contistr01.F90
m_contistr03.F90
m_contistr12.F90
m_contstr21.F90
m_contstr23.F90
m_contstr25.F90
m_contstr25a.F90
m_contstr26.F90
)
set_target_properties(42_nlstrain
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(42_nlstrain
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(42_nlstrain
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(42_nlstrain
PUBLIC
abinit::14_hidewrite
)
add_library(abinit::42_nlstrain ALIAS 42_nlstrain)

View File

@ -0,0 +1,31 @@
#
# 42_parser
#
add_library(42_parser STATIC
m_parser.F90
)
set_target_properties(42_parser
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(42_parser
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(42_parser
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(42_parser
PUBLIC
abinit::16_hideleave
abinit::32_util
abinit::41_geometry
)
add_library(abinit::42_parser ALIAS 42_parser)

View File

@ -0,0 +1,62 @@
#
# 43_ptgroups
#
add_library(43_ptgroups STATIC
m_defs_ptgroups.F90
m_ptgroups.F90
m_ptg_C1.F90
m_ptg_Ci.F90
m_ptg_C2.F90
m_ptg_Cs.F90
m_ptg_C2h.F90
m_ptg_D2.F90
m_ptg_C2v.F90
m_ptg_D2h.F90
m_ptg_C4.F90
m_ptg_S4.F90
m_ptg_C4h.F90
m_ptg_D4.F90
m_ptg_C4v.F90
m_ptg_D2d.F90
m_ptg_D4h.F90
m_ptg_C3.F90
m_ptg_C3i.F90
m_ptg_D3.F90
m_ptg_C3v.F90
m_ptg_D3d.F90
m_ptg_C6.F90
m_ptg_C3h.F90
m_ptg_C6h.F90
m_ptg_D6.F90
m_ptg_C6v.F90
m_ptg_D3h.F90
m_ptg_D6h.F90
m_ptg_T.F90
m_ptg_Th.F90
m_ptg_O.F90
m_ptg_Td.F90
m_ptg_Oh.F90
)
set_target_properties(43_ptgroups
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(43_ptgroups
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(43_ptgroups
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(43_ptgroups
PUBLIC
28_numeric_noabirule
32_util)
add_library(abinit::43_ptgroups ALIAS 43_ptgroups)

View File

@ -0,0 +1,41 @@
#
# 43_wvl_wrappers
#
add_library(43_wvl_wrappers STATIC
defs_wvltypes.F90
defs_PSolver.F90
m_abi2big.F90
m_paw2wvl.F90
m_wvl_denspot.F90
m_wvl_descr_psp.F90
m_wvl_projectors.F90
m_wvl_wfs.F90
)
set_target_properties(43_wvl_wrappers
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(43_wvl_wrappers
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(43_wvl_wrappers
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(43_wvl_wrappers
PUBLIC
abinit::41_geometry)
if(ABINIT_BIGDFT_FOUND)
target_link_libraries(43_wvl_wrappers
PUBLIC
abinit::bigdft)
endif()
add_library(abinit::43_wvl_wrappers ALIAS 43_wvl_wrappers)

View File

@ -0,0 +1,42 @@
#
# 44_abitools
#
add_library(44_abitools STATIC
m_berrytk.F90
m_cgtools.F90
m_dynmat.F90
m_integrals.F90
m_macroave.F90
m_wfutils.F90
)
set_target_properties(44_abitools
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(44_abitools
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(44_abitools
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(44_abitools
PUBLIC
28_numeric_noabirule
32_util
39_libpaw
41_geometry)
if(OpenMP_FOUND)
target_link_libraries(44_abitools
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::44_abitools ALIAS 44_abitools)

View File

@ -0,0 +1,41 @@
#
# 44_abitypes_defs
#
add_library(44_abitypes_defs STATIC
defs_abitypes.F90
m_args_gs.F90
m_distribfft.F90
m_dtset.F90
m_dtfil.F90
m_efield.F90
m_efmas_defs.F90
m_energies.F90
m_results_gs.F90
m_results_img.F90
m_results_respfn.F90
)
set_target_properties(44_abitypes_defs
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(44_abitypes_defs
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(44_abitypes_defs
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(44_abitypes_defs
PUBLIC
29_kpoints
32_util
41_geometry
42_parser)
add_library(abinit::44_abitypes_defs ALIAS 44_abitypes_defs)

View File

@ -0,0 +1,62 @@
#
# 45_geomoptim
#
add_library(45_geomoptim STATIC
m_predtk.F90
m_abihist.F90
m_abimover.F90
m_abiimages.F90
m_bfgs.F90
m_ga.F90
m_hmc.F90
m_ipi.F90
m_lbfgs.F90
m_mep.F90
m_m1geo.F90
m_pimd.F90
m_use_ga.F90
m_pimd_langevin.F90
m_pimd_nosehoover.F90
m_pred_bfgs.F90
m_pred_delocint.F90
m_pred_diisrelax.F90
m_pred_fire.F90
m_pred_hmc.F90
m_pred_isokinetic.F90
m_pred_isothermal.F90
m_pred_langevin.F90
m_pred_moldyn.F90
m_pred_nose.F90
m_pred_simple.F90
m_pred_srkna14.F90
m_pred_steepdesc.F90
m_pred_velverlet.F90
m_pred_verlet.F90
m_predict_neb.F90
m_predict_pimd.F90
m_predict_steepest.F90
m_predict_string.F90
m_xfpack.F90
)
set_target_properties(45_geomoptim
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(45_geomoptim
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(45_geomoptim
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(45_geomoptim
PUBLIC
abinit::44_abitypes_defs)
add_library(abinit::45_geomoptim ALIAS 45_geomoptim)

View File

@ -0,0 +1,49 @@
#
# 45_xgTools
#
set(66_wfs_SRC
m_xg.F90
m_xgScalapack.F90
m_xgTransposer.F90
)
if (ABINIT_ENABLE_GPU_CUDA AND ABINIT_KOKKOS_WANTED)
LIST(APPEND 66_wfs_SRC
m_xg_kokkos.cpp
m_xg_kokkos.h
m_xg_kokkos.F90)
endif()
add_library(45_xgTools STATIC
${66_wfs_SRC})
set_target_properties(45_xgTools
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(45_xgTools
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(45_xgTools
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(45_xgTools
PUBLIC
abinit::44_abitypes_defs)
if (ABINIT_YAKL_WANTED)
target_link_libraries(45_xgTools
PUBLIC
abinit::yakl)
target_include_directories(45_xgTools
PUBLIC
${YAKL_BINARY_DIR})
endif()
add_library(abinit::45_xgTools ALIAS 45_xgTools)

View File

@ -0,0 +1,65 @@
#
# 46_manage_cuda
#
add_library(46_manage_cuda STATIC
m_manage_cuda.F90
m_alloc_hamilt_gpu.F90
m_nvtx_data.F90
abi_gpu_header.h
cuda_rec.cu
cuda_rec_cut.cu
density.cu
gpu_apply_invovl_inner.cu
gpu_apply_local_potential.cu
gpu_compute_nl_hamiltonian.cu
gpu_compute_nl_projections.cu
gpu_density_accumulation.cu
gpu_fourwf.cu
gpu_gemm_nonlop.cu
gpu_gemm_nonlop.h
gpu_mkkpg.cu
gpu_nonlop.cu
gpu_sphere.cu
gpu_fftbox.cu
prt_utils_rec.cu
rec_dens_calc.cu
rec_kernels.cu
recursion_bth.cu
recursion_cut_bth.cu
recursion_cut_no_bth.cu
recursion_no_bth.cu
)
set_target_properties(46_manage_cuda
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(46_manage_cuda
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
${CMAKE_SOURCE_DIR}/src/incs
)
target_compile_definitions(46_manage_cuda
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(46_manage_cuda
PUBLIC
abinit::17_gpu_toolbox
abinit::44_abitypes_defs
)
if(ABINIT_ENABLE_GPU_CUDA)
target_link_libraries(46_manage_cuda
PUBLIC
CUDA::cufft
CUDA::cublas
)
endif()
add_library(abinit::46_manage_cuda ALIAS 46_manage_cuda)

View File

@ -0,0 +1,39 @@
#
# 48_diago
#
add_library(48_diago STATIC
m_chebfi2.F90
m_lobpcg2.F90
)
set_target_properties(48_diago
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(48_diago
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
${CMAKE_SOURCE_DIR}/src/incs
)
target_compile_definitions(48_diago
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(48_diago
PUBLIC
abinit::44_abitools
abinit::44_abitypes_defs
abinit::45_xgTools)
if(ABINIT_ENABLE_GPU_CUDA)
target_link_libraries(48_diago
PUBLIC
abinit::46_manage_cuda
)
endif()
add_library(abinit::48_diago ALIAS 48_diago)

View File

@ -0,0 +1,31 @@
#
# 49_gw_toolbox_oop
#
add_library(49_gw_toolbox_oop STATIC
m_bs_defs.F90
m_gwdefs.F90
m_melemts.F90
m_spectra.F90
)
set_target_properties(49_gw_toolbox_oop
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(49_gw_toolbox_oop
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(49_gw_toolbox_oop
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(49_gw_toolbox_oop
PUBLIC
abinit::44_abitypes_defs)
add_library(abinit::49_gw_toolbox_oop ALIAS 49_gw_toolbox_oop)

View File

@ -0,0 +1,31 @@
#
# 51_manage_mpi
#
add_library(51_manage_mpi STATIC
m_io_redirect.F90
m_mpinfo.F90
m_wffile.F90
m_xredistribute.F90
)
set_target_properties(51_manage_mpi
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(51_manage_mpi
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(51_manage_mpi
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(51_manage_mpi
PUBLIC
abinit::44_abitypes_defs)
add_library(abinit::51_manage_mpi ALIAS 51_manage_mpi)

View File

@ -0,0 +1,49 @@
#
# 52_fft_mpi_noabirule
#
add_library(52_fft_mpi_noabirule STATIC
defs_fftdata.F90
m_fftw3.F90
m_dfti.F90
m_fftcore.F90
m_fft_mesh.F90
m_sgfft.F90
m_sg2002.F90
)
set_target_properties(52_fft_mpi_noabirule
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(52_fft_mpi_noabirule
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(52_fft_mpi_noabirule
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(52_fft_mpi_noabirule
PUBLIC
abinit::44_abitools
abinit::51_manage_mpi)
if(OpenMP_FOUND)
target_link_libraries(52_fft_mpi_noabirule
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
if (ABINIT_FFT_FLAVOR MATCHES "GOEDECKER")
# no linking required
else()
target_link_libraries(52_fft_mpi_noabirule
PUBLIC
abinit::fft)
endif()
add_library(abinit::52_fft_mpi_noabirule ALIAS 52_fft_mpi_noabirule)

View File

@ -0,0 +1,42 @@
#
# 53_ffts
#
add_library(53_ffts STATIC
m_fft.F90
)
set_target_properties(53_ffts
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(53_ffts
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(53_ffts
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(53_ffts
PUBLIC
abinit::52_fft_mpi_noabirule
)
if(ABINIT_ENABLE_GPU_CUDA)
target_link_libraries(53_ffts
PUBLIC
abinit::46_manage_cuda
)
endif()
if(OpenMP_FOUND)
target_link_libraries(53_ffts
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::53_ffts ALIAS 53_ffts)

View File

@ -0,0 +1,36 @@
#
# 54_spacepar
#
add_library(54_spacepar STATIC
m_multipoles.F90
m_spacepar.F90
)
set_target_properties(54_spacepar
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(54_spacepar
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(54_spacepar
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(54_spacepar
PUBLIC
abinit::53_ffts
)
if(OpenMP_FOUND)
target_link_libraries(54_spacepar
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::54_spacepar ALIAS 54_spacepar)

View File

@ -0,0 +1,33 @@
#
# 55_abiutil
#
add_library(55_abiutil STATIC
m_dens.F90
m_results_out.F90
m_scf_history.F90
m_builtin_tests.F90
m_timana.F90
)
set_target_properties(55_abiutil
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(55_abiutil
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(55_abiutil
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(55_abiutil
PUBLIC
abinit::53_ffts
)
add_library(abinit::55_abiutil ALIAS 55_abiutil)

View File

@ -0,0 +1,34 @@
#
# 56_io_mpi
#
add_library(56_io_mpi STATIC
m_abi_etsf.F90
m_exit.F90
m_hdr.F90
m_rwwf.F90
)
set_target_properties(56_io_mpi
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(56_io_mpi
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(56_io_mpi
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(56_io_mpi
PUBLIC
abinit::43_wvl_wrappers
abinit::44_abitypes_defs
abinit::51_manage_mpi
)
add_library(abinit::56_io_mpi ALIAS 56_io_mpi)

View File

@ -0,0 +1,35 @@
#
# 56_mixing
#
add_library(56_mixing STATIC
m_ab7_mixing.F90
)
set_target_properties(56_mixing
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(56_mixing
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(56_mixing
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(56_mixing
PUBLIC
abinit::44_abitypes_defs
)
if(OpenMP_FOUND)
target_link_libraries(56_mixing
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::56_mixing ALIAS 56_mixing)

View File

@ -0,0 +1,46 @@
#
# 56_recipspace
#
add_library(56_recipspace STATIC
m_initylmg.F90
m_ab7_kpoints.F90
m_bz_mesh.F90
m_double_grid.F90
m_gsphere.F90
m_getshell.F90
m_kg.F90
m_kpts.F90
m_lgroup.F90
m_nesting.F90
m_skw.F90
)
set_target_properties(56_recipspace
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(56_recipspace
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(56_recipspace
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(56_recipspace
PUBLIC
abinit::44_abitypes_defs
abinit::54_spacepar
)
if(OpenMP_FOUND)
target_link_libraries(56_recipspace
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::56_recipspace ALIAS 56_recipspace)

48
src/56_xc/CMakeLists.txt Normal file
View File

@ -0,0 +1,48 @@
#
# 56_xc
#
add_library(56_xc STATIC
m_electronpositron.F90
m_kxc.F90
m_xcdata.F90
m_xc_vdw.F90
m_dfpt_mkvxc.F90
m_gammapositron.F90
m_mkcore.F90
m_rhotoxc.F90
m_xctk.F90
m_xchybrid.F90
)
set_target_properties(56_xc
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(56_xc
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(56_xc
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(56_xc
PUBLIC
abinit::44_abitypes_defs
abinit::51_manage_mpi
abinit::53_ffts
abinit::54_spacepar
)
if(OpenMP_FOUND)
target_link_libraries(56_xc
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::56_xc ALIAS 56_xc)

View File

@ -0,0 +1,42 @@
#
# 57_iopsp_parser
#
add_library(57_iopsp_parser STATIC
flib_pwscf.F90
functionals_pwscf.F90
m_pseudo_pwscf.F90
m_pspheads.F90
m_psxml2ab.F90
m_read_upf_pwscf.F90
# modules taken from QE to support UPF2
pseudo_types.F90
read_upf_new.F90
upf_kinds.F90
xmltools.F90
upf_utils.F90
)
set_target_properties(57_iopsp_parser
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(57_iopsp_parser
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(57_iopsp_parser
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(57_iopsp_parser
PUBLIC
abinit::21_hashfuncs
abinit::44_abitypes_defs
)
add_library(abinit::57_iopsp_parser ALIAS 57_iopsp_parser)

View File

@ -0,0 +1,49 @@
#
# 57_iovars
#
add_library(57_iovars STATIC
m_chkinp.F90
m_ingeo.F90
m_inkpts.F90
m_invars1.F90
m_invars2.F90
m_memeval.F90
m_mpi_setup.F90
m_outvars.F90
m_outvar_a_h.F90
m_outvar_i_n.F90
m_outvar_o_z.F90
m_outxml.F90
m_out_acknowl.F90
)
set_target_properties(57_iovars
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(57_iovars
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(57_iovars
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(57_iovars
PUBLIC
abinit::44_abitypes_defs
abinit::45_geomoptim
abinit::49_gw_toolbox_oop
abinit::52_fft_mpi_noabirule
abinit::55_abiutil
abinit::56_io_mpi
abinit::56_recipspace
abinit::56_xc
)
add_library(abinit::57_iovars ALIAS 57_iovars)

View File

@ -0,0 +1,41 @@
#
# 61_occeig
#
add_library(61_occeig STATIC
m_occ.F90
m_ebands.F90
m_fstab.F90
m_extfpmd.F90
)
set_target_properties(61_occeig
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(61_occeig
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(61_occeig
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(61_occeig
PUBLIC
abinit::44_abitypes_defs
abinit::56_recipspace
abinit::56_io_mpi
)
if(OpenMP_FOUND)
target_link_libraries(61_occeig
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::61_occeig ALIAS 61_occeig)

View File

@ -0,0 +1,40 @@
#
# 62_cg_noabirule
#
add_library(62_cg_noabirule STATIC
m_cgtk.F90
m_frskerker1.F90
m_frskerker2.F90
)
set_target_properties(62_cg_noabirule
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(62_cg_noabirule
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(62_cg_noabirule
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(62_cg_noabirule
PUBLIC
abinit::52_fft_mpi_noabirule
abinit::54_spacepar
abinit::56_recipspace
)
if(OpenMP_FOUND)
target_link_libraries(62_cg_noabirule
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::62_cg_noabirule ALIAS 62_cg_noabirule)

View File

@ -0,0 +1,51 @@
#
# 62_ctqmc
#
add_library(62_ctqmc STATIC
m_BathOperator.F90
m_BathOperatoroffdiag.F90
m_data4entropyDMFT.F90
m_Ctqmc.F90
m_Ctqmcoffdiag.F90
m_CtqmcInterface.F90
m_CtqmcoffdiagInterface.F90
m_FFTHyb.F90
m_GreenHyb.F90
m_GreenHyboffdiag.F90
m_ImpurityOperator.F90
m_ListCdagC.F90
m_MapHyb.F90
m_MatrixHyb.F90
m_OurRng.F90
m_Stat.F90
m_Vector.F90
m_VectorInt.F90
m_global.F90
)
set_target_properties(62_ctqmc
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(62_ctqmc
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(62_ctqmc
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(62_ctqmc
PUBLIC
abinit::10_defs
abinit::11_memory_mpi
abinit::16_hideleave
abinit::28_numeric_noabirule
)
add_library(abinit::62_ctqmc ALIAS 62_ctqmc)

View File

@ -0,0 +1,40 @@
#
# 62_iowfdenpot
#
add_library(62_iowfdenpot STATIC
m_io_screening.F90
m_wfk.F90
m_outqmc.F90
m_outwant.F90
)
set_target_properties(62_iowfdenpot
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(62_iowfdenpot
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(62_iowfdenpot
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(62_iowfdenpot
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::27_toolbox_oop
abinit::44_abitypes_defs
abinit::49_gw_toolbox_oop
abinit::56_io_mpi
abinit::61_occeig
abinit::62_cg_noabirule
)
add_library(abinit::62_iowfdenpot ALIAS 62_iowfdenpot)

View File

@ -0,0 +1,45 @@
#
# 62_poisson
#
add_library(62_poisson STATIC
m_barevcoul.F90
m_cutoff_sphere.F90
m_cutoff_slab.F90
m_cutoff_cylinder.F90
m_jellium.F90
m_psolver.F90
m_qplusg.F90
m_vcoul.F90
)
set_target_properties(62_poisson
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(62_poisson
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(62_poisson
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(62_poisson
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::28_numeric_noabirule
abinit::41_geometry
abinit::43_wvl_wrappers
abinit::44_abitypes_defs
abinit::49_gw_toolbox_oop
abinit::56_recipspace
abinit::53_ffts
)
add_library(abinit::62_poisson ALIAS 62_poisson)

View File

@ -0,0 +1,36 @@
#
# 62_wvl_wfs
#
add_library(62_wvl_wfs STATIC
m_wvl_psi.F90
m_wvl_rwwf.F90
)
set_target_properties(62_wvl_wfs
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(62_wvl_wfs
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(62_wvl_wfs
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(62_wvl_wfs
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::43_wvl_wrappers
abinit::44_abitypes_defs
abinit::51_manage_mpi
abinit::56_io_mpi
)
add_library(abinit::62_wvl_wfs ALIAS 62_wvl_wfs)

44
src/64_psp/CMakeLists.txt Normal file
View File

@ -0,0 +1,44 @@
#
# 64_psp
#
add_library(64_psp STATIC
m_atm2fft.F90
m_psptk.F90
m_psps.F90
m_pspini.F90
m_psp1.F90
m_psp_hgh.F90
m_psp5.F90
m_psp6.F90
m_psp8.F90
m_psp9.F90
m_upf2abinit.F90
)
set_target_properties(64_psp
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(64_psp
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(64_psp
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(64_psp
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::53_ffts
abinit::57_iovars
abinit::57_iopsp_parser
)
add_library(abinit::64_psp ALIAS 64_psp)

View File

@ -0,0 +1,36 @@
#
# 65_lotf_base
#
add_library(65_lotf_base STATIC
m_bond_lotf.F90
defs_param_lotf.F90
m_glue_lotf.F90
m_pbc_lotf.F90
m_tools_lotf.F90
m_work_var_lotf.F90
)
set_target_properties(65_lotf_base
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(65_lotf_base
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(65_lotf_base
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(65_lotf_base
PUBLIC
abinit::10_defs
abinit::16_hideleave
)
add_library(abinit::65_lotf_base ALIAS 65_lotf_base)

70
src/65_paw/CMakeLists.txt Normal file
View File

@ -0,0 +1,70 @@
#
# 65_paw
#
add_library(65_paw STATIC
m_fourier_interpol.F90
m_paw_atomorb.F90
m_paw_correlations.F90
m_paw_denpot.F90
m_paw_dfpt.F90
m_paw_dfptnl.F90
m_paw_dmft.F90
m_paw_efield.F90
m_paw_hr.F90
m_paw_init.F90
m_paw_lmn.F90
m_paw_mkaewf.F90
m_paw_mkrho.F90
m_paw_nhat.F90
m_paw_nmr.F90
m_paw_occupancies.F90
m_paw_optics.F90
m_paw_overlap.F90
m_paw_pwaves_lmn.F90
m_paw_slater.F90
m_paw_sym.F90
m_paw_tools.F90
m_paw_uj.F90
m_pawfgr.F90
m_pawpwij.F90
)
set_target_properties(65_paw
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(65_paw
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(65_paw
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(65_paw
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::27_toolbox_oop
abinit::43_wvl_wrappers
abinit::44_abitypes_defs
abinit::56_io_mpi
abinit::56_xc
abinit::56_recipspace
abinit::61_occeig
abinit::62_ctqmc
abinit::64_psp
)
if(OpenMP_FOUND)
target_link_libraries(65_paw
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
add_library(abinit::65_paw ALIAS 65_paw)

View File

@ -0,0 +1,94 @@
#
# 66_nonlocal
#
set(66_nonlocal_SRC
m_cgprj.F90
m_contract.F90
m_fock.F90
m_gemm_nonlop.F90
m_hamiltonian.F90
m_metstr.F90
m_mkffkg.F90
m_mkffnl.F90
m_nonlop.F90
m_nonlop_pl.F90
m_nonlop_test.F90
m_nonlop_ylm.F90
m_opernl.F90
m_vkbr.F90
m_opernla_ylm.F90
m_opernla_ylm_mv.F90
m_opernlb_ylm.F90
m_opernlb_ylm_mv.F90
m_opernlc_ylm.F90
m_opernlc_ylm_gpu.F90
m_opernlc_ylm_allwf_cpu.F90
m_opernld_ylm.F90
)
if (ABINIT_ENABLE_GPU_CUDA AND ABINIT_KOKKOS_WANTED)
LIST(APPEND 66_nonlocal_SRC
m_opernlc_ylm_allwf_kokkos.cpp)
endif()
add_library(66_nonlocal STATIC
${66_nonlocal_SRC})
set_target_properties(66_nonlocal
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(66_nonlocal
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(66_nonlocal
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(66_nonlocal
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::42_nlstrain
abinit::62_poisson
abinit::65_paw
)
if(OpenMP_FOUND)
target_link_libraries(66_nonlocal
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
if(ABINIT_ENABLE_GPU_CUDA)
target_link_libraries(66_nonlocal
PUBLIC
abinit::46_manage_cuda
)
endif()
if(ABINIT_ENABLE_GPU_CUDA AND ABINIT_KOKKOS_WANTED)
target_link_libraries(66_nonlocal
PUBLIC
Kokkos::kokkos
)
endif()
if (ABINIT_YAKL_WANTED)
target_link_libraries(66_nonlocal
PUBLIC
abinit::yakl)
target_include_directories(66_nonlocal
PUBLIC
${YAKL_BINARY_DIR})
endif()
add_library(abinit::66_nonlocal ALIAS 66_nonlocal)

View File

@ -0,0 +1,36 @@
#
# 66_vdwxc
#
add_library(66_vdwxc STATIC
m_evdw_wannier.F90
m_vdw_dftd2.F90
m_vdw_dftd3.F90
m_vdw_dftd3_data.F90
)
set_target_properties(66_vdwxc
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(66_vdwxc
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(66_vdwxc
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(66_vdwxc
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::32_util
abinit::41_geometry
)
add_library(abinit::66_vdwxc ALIAS 66_vdwxc)

71
src/66_wfs/CMakeLists.txt Normal file
View File

@ -0,0 +1,71 @@
#
# 66_wfs
#
set(66_wfs_SRC
m_esymm.F90
m_bandfft_kpt.F90
m_invovl.F90
m_chebfi.F90
m_cgcprj.F90
m_fock_getghc.F90
m_getchc.F90
m_getghc.F90
m_getgh1c.F90
m_getgh2c.F90
m_prep_kgb.F90
m_rayleigh_ritz.F90
m_rmm_diis.F90
)
if (ABINIT_ENABLE_GPU_CUDA AND ABINIT_KOKKOS_WANTED)
LIST(APPEND 66_wfs_SRC
add_array_kokkos.cpp
assemble_energy_contrib_kokkos.cpp)
endif()
add_library(66_wfs STATIC
${66_wfs_SRC})
set_target_properties(66_wfs
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(66_wfs
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(66_wfs
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(66_wfs
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::43_ptgroups
abinit::44_abitools
abinit::44_abitypes_defs
abinit::56_recipspace
abinit::62_cg_noabirule
abinit::66_nonlocal
)
if(OpenMP_FOUND)
target_link_libraries(66_wfs
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
if(ABINIT_ENABLE_GPU_CUDA AND ABINIT_KOKKOS_WANTED)
target_link_libraries(66_wfs
PUBLIC
Kokkos::kokkos
)
endif()
add_library(abinit::66_wfs ALIAS 66_wfs)

View File

@ -0,0 +1,87 @@
#
# 67_common
#
add_library(67_common STATIC
m_berryphase.F90
m_berryphase_new.F90
m_conducti.F90
m_dft_energy.F90
m_extraprho.F90
m_ephtk.F90
m_forces.F90
m_forstr.F90
m_cgwf.F90
m_cgwf_cprj.F90
m_epjdos.F90
m_ksdiago.F90
mkcore_wvl.F90
m_mklocl_realspace.F90
m_mklocl.F90
m_mkrho.F90
m_nucprop.F90
m_ioarr.F90
m_iowf.F90
m_eprenorms.F90
m_sigtk.F90
m_odamix.F90
m_optic_tools.F90
m_optics_vloc.F90
m_rot_cg.F90
m_rhotov.F90
m_common.F90
m_positron.F90
m_setvtr.F90
m_spin_current.F90
m_stress.F90
m_vtorhotf.F90
m_wvl_rho.F90
)
set_target_properties(67_common
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(67_common
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(67_common
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(67_common
PUBLIC
abinit::10_defs
abinit::16_hideleave
abinit::44_abitools
abinit::52_fft_mpi_noabirule
abinit::56_io_mpi
abinit::56_mixing
abinit::62_iowfdenpot
abinit::62_wvl_wfs
abinit::66_nonlocal
abinit::66_vdwxc
abinit::66_wfs
)
if(OpenMP_FOUND)
target_link_libraries(67_common
PUBLIC
OpenMP::OpenMP_Fortran)
endif()
if (ABINIT_YAKL_WANTED)
target_link_libraries(67_common
PUBLIC
abinit::yakl)
target_include_directories(67_common
PUBLIC
${YAKL_BINARY_DIR})
endif()
add_library(abinit::67_common ALIAS 67_common)

View File

@ -0,0 +1,33 @@
#
# 67_python_invocation_ext
#
add_library(67_python_invocation_ext STATIC
invocation_interface.F90
invoke_python.cpp
invoke_python.hpp
)
set_target_properties(67_python_invocation_ext
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(67_python_invocation_ext
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(67_python_invocation_ext
PRIVATE
HAVE_CONFIG_H)
#target_link_libraries(67_python_invocation_ext
# PUBLIC
# abinit::10_defs
# abinit::16_hideleave
# )
add_library(abinit::67_python_invocation_ext ALIAS 67_python_invocation_ext)

View File

@ -0,0 +1,38 @@
#
# 67_triqs_ext
#
add_library(67_triqs_ext STATIC
triqs_cthyb_qmc.cpp
triqs_interface_ctqmc.F90
)
set_target_properties(67_triqs_ext
PROPERTIES
Fortran_MODULE_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/modules)
target_include_directories(67_triqs_ext
PRIVATE
${CMAKE_BINARY_DIR}
${CMAKE_SOURCE_DIR}/shared/common/src/incs
${CMAKE_SOURCE_DIR}/src/incs
PUBLIC
${CMAKE_CURRENT_BINARY_DIR}/modules
)
target_compile_definitions(67_triqs_ext
PRIVATE
HAVE_CONFIG_H)
target_link_libraries(67_triqs_ext
PUBLIC
abinit::10_defs
abinit::16_hideleave
)
if(TRIQS_FOUND)
target_link_libraries(67_triqs_ext
PUBLIC
abinit::triqs)
endif()
add_library(abinit::67_triqs_ext ALIAS 67_triqs_ext)

Some files were not shown because too many files have changed in this diff Show More