From 68ca5c47a870b18db67f1ea2cc9ae6fe062b2f32 Mon Sep 17 00:00:00 2001 From: "Dr. Mathieu Taillefumier" Date: Tue, 18 Apr 2023 13:43:20 +0200 Subject: [PATCH] [cmake] Use SIRIUS namespace convention for options and other SIRIUS internal variables - updated README.md file to reflect the new convention - updated the spack recipe - removed multiple versions of the spack recipe - updated the docker files when needed --- .github/workflows/build.yml | 4 +- CMakeLists.txt | 122 +++--- README.md | 16 +- apps/dft_loop/CMakeLists.txt | 9 +- apps/tests/CMakeLists.txt | 4 +- apps/tests/test_davidson.cpp | 4 +- apps/tests/test_hloc.cpp | 2 +- apps/tests/test_wf_ortho.cpp | 2 +- apps/tests/test_wf_trans.cpp | 2 +- apps/unit_tests/test_fft_correctness_1.cpp | 2 +- apps/unit_tests/test_fft_correctness_2.cpp | 2 +- ...make-fix-shared-library-installation.patch | 53 --- .../sirius/link-libraries-fortran.patch | 25 -- .../spack/packages/sirius/mpi_datatypes.patch | 22 - ci/github-ci/spack/packages/sirius/package.py | 394 ------------------ .../strip-spglib-include-subfolder.patch | 25 -- ci/github-ci/spack/repo.yaml | 2 - cmake/modules/FindCRAY_LIBSCI.cmake | 4 +- cmake/modules/FindElpa.cmake | 12 +- cmake/modules/FindFFTW.cmake | 31 +- cmake/modules/FindLibSPG.cmake | 10 +- cmake/modules/FindLibVDWXC.cmake | 14 +- cmake/modules/FindLibXC.cmake | 10 +- cmake/modules/FindMAGMA.cmake | 12 +- cmake/modules/FindMKL.cmake | 2 +- cmake/modules/FindSCALAPACK.cmake | 4 +- cmake/siriusConfig.cmake.in | 20 +- doc/CMakeLists.txt | 4 +- spack/packages/sirius/package.py | 65 +-- src/CMakeLists.txt | 65 +-- src/band/band.cpp | 2 +- src/band/diag_pseudo_potential.cpp | 2 +- src/band/solve.cpp | 4 +- src/beta_projectors/beta_projectors_base.cpp | 6 +- src/context/simulation_context.cpp | 10 +- src/context/simulation_context.hpp | 4 +- src/density/density.cpp | 2 +- src/density/occupation_matrix.cpp | 2 +- src/dft/dft_ground_state.cpp | 6 +- src/fft/fft.hpp | 4 +- src/geometry/force.cpp | 4 +- src/geometry/stress.cpp | 4 +- src/hamiltonian/hamiltonian.cpp | 2 +- src/hamiltonian/hamiltonian_k.cpp | 2 +- src/hamiltonian/local_operator.cpp | 2 +- src/hamiltonian/non_local_operator.cpp | 2 +- src/hamiltonian/s_u_operator.cpp | 4 +- src/k_point/generate_fv_states.cpp | 2 +- .../generate_spinor_wave_functions.cpp | 2 +- src/k_point/k_point.cpp | 2 +- src/k_point/k_point_set.cpp | 14 +- src/k_point/k_point_set.hpp | 16 +- src/linalg/dmatrix.cpp | 2 +- 53 files changed, 272 insertions(+), 771 deletions(-) delete mode 100644 ci/github-ci/spack/packages/sirius/cmake-fix-shared-library-installation.patch delete mode 100644 ci/github-ci/spack/packages/sirius/link-libraries-fortran.patch delete mode 100644 ci/github-ci/spack/packages/sirius/mpi_datatypes.patch delete mode 100644 ci/github-ci/spack/packages/sirius/package.py delete mode 100644 ci/github-ci/spack/packages/sirius/strip-spglib-include-subfolder.patch delete mode 100644 ci/github-ci/spack/repo.yaml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index eb6d30f788..b44d59697c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,7 @@ jobs: cd ${GITHUB_WORKSPACE} mkdir build cd build - spack --color always build-env $DEVSPEC -- cmake .. -DUSE_SCALAPACK=1 -DUSE_VDWXC=1 -DBUILD_TESTING=1 -DCREATE_FORTRAN_BINDINGS=1 -DCREATE_PYTHON_MODULE=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo + spack --color always build-env $DEVSPEC -- cmake .. -DSIRIUS_USE_SCALAPACK=1 -DSIRIUS_USE_VDWXC=1 -DBUILD_TESTING=1 -DCREATE_FORTRAN_BINDINGS=1 -DCREATE_PYTHON_MODULE=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo - name: Build SIRIUS run: | cd ${GITHUB_WORKSPACE}/build @@ -59,7 +59,7 @@ jobs: cd ${GITHUB_WORKSPACE} mkdir build cd build - spack --color always build-env $DEVSPEC -- cmake .. -DUSE_SCALAPACK=1 -DUSE_CUDA=1 -DUSE_VDWXC=1 -DBUILD_TESTING=1 -DCREATE_FORTRAN_BINDINGS=1 -DCREATE_PYTHON_MODULE=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo + spack --color always build-env $DEVSPEC -- cmake .. -DSIRIUS_USE_SCALAPACK=1 -DSIRIUS_USE_CUDA=1 -DSIRIUS_USE_VDWXC=1 -DBUILD_TESTING=1 -DCREATE_FORTRAN_BINDINGS=1 -DCREATE_PYTHON_MODULE=1 -DCMAKE_BUILD_TYPE=RelWithDebInfo - name: Build SIRIUS run: | cd ${GITHUB_WORKSPACE}/build diff --git a/CMakeLists.txt b/CMakeLists.txt index e9d3593404..0ea5acbd50 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -15,35 +15,35 @@ endif() # user variables -option(CREATE_PYTHON_MODULE "create sirius Python module" OFF) -option(CREATE_FORTRAN_BINDINGS "build Fortran bindings" ON) -option(BUILD_DOCS "build doxygen doc" OFF) -option(USE_ELPA "use elpa" OFF) -option(USE_MAGMA "use MAGMA" OFF) -option(USE_NLCGLIB "enable nlcglib" OFF) -option(USE_CUDA "use CUDA" OFF) -option(USE_ROCM "use ROCM AMD GPU code" OFF) -option(USE_NVTX "use Nvidia profiling tools library" OFF) -option(USE_VDWXC "use libvdwxc for van der Walls corrections" OFF) -option(USE_MKL "use Intel MKL" OFF) -option(USE_CRAY_LIBSCI "use LAPACK/SCALAPACK from Cray LIBSCI" OFF) -option(USE_SCALAPACK "use scalapack" OFF) -option(BUILD_APPS "build apps" ON) -option(USE_OPENMP "use OpenMP" ON) -option(USE_PROFILER "measure execution of functions with timer" ON) -option(USE_MEMORY_POOL "use memory pool" ON) -option(USE_POWER_COUNTER "measure energy consumption with power counters" OFF) -option(BUILD_TESTING "build test executables" OFF) # override default setting in CTest module -option(USE_VCSQNM "use variable cell stabilized quasi Newton method" OFF) - -set(GPU_MEMORY_ALIGMENT "512" CACHE STRING "memory alignment of the GPU") -set(USE_FP32 "AUTO" CACHE STRING "Enable single precision support.") - -set_property(CACHE USE_FP32 PROPERTY STRINGS "AUTO" "ON" "OFF") +option(SIRIUS_CREATE_PYTHON_MODULE "create sirius Python module" OFF) +option(SIRIUS_CREATE_FORTRAN_BINDINGS "build Fortran bindings" ON) +option(SIRIUS_BUILD_DOCS "build doxygen doc" OFF) +option(SIRIUS_USE_ELPA "use elpa" OFF) +option(SIRIUS_USE_MAGMA "use MAGMA" OFF) +option(SIRIUS_USE_NLCGLIB "enable nlcglib" OFF) +option(SIRIUS_USE_CUDA "use CUDA" OFF) +option(SIRIUS_USE_ROCM "use ROCM AMD GPU code" OFF) +option(SIRIUS_USE_NVTX "use Nvidia profiling tools library" OFF) +option(SIRIUS_USE_VDWXC "use libvdwxc for van der Walls corrections" OFF) +option(SIRIUS_USE_MKL "use Intel MKL" OFF) +option(SIRIUS_USE_CRAY_LIBSCI "use LAPACK/SCALAPACK from Cray LIBSCI" OFF) +option(SIRIUS_USE_SCALAPACK "use scalapack" OFF) +option(SIRIUS_BUILD_APPS "build apps" ON) +option(SIRIUS_USE_OPENMP "use OpenMP" ON) +option(SIRIUS_USE_PROFILER "measure execution of functions with timer" ON) +option(SIRIUS_USE_MEMORY_POOL "use memory pool" ON) +option(SIRIUS_USE_POWER_COUNTER "measure energy consumption with power counters" OFF) +option(SIRIUS_BUILD_TESTING "build test executables" OFF) # override default setting in CTest module +option(SIRIUS_USE_VCSQNM "use variable cell stabilized quasi Newton method" OFF) + +set(SIRIUS_GPU_MEMORY_ALIGMENT "512" CACHE STRING "memory alignment of the GPU") +set(SIRIUS_USE_FP32 "AUTO" CACHE STRING "Enable single precision support.") + +set_property(CACHE SIRIUS_USE_FP32 PROPERTY STRINGS "AUTO" "ON" "OFF") # set language and standard -if(CREATE_FORTRAN_BINDINGS) +if(SIRIUS_CREATE_FORTRAN_BINDINGS) enable_language(Fortran) endif() @@ -64,8 +64,8 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME) include(CTest) endif() -if(USE_CUDA AND USE_ROCM) - message(FATAL_ERROR "USE_CUDA and USE_ROCM must not be enabled at the same time!") +if(SIRIUS_USE_CUDA AND SIRIUS_USE_ROCM) + message(FATAL_ERROR "SIRIUS_USE_CUDA and SIRIUS_USE_ROCM must not be enabled at the same time!") endif() add_compile_definitions(SIRIUS_GPU_MEMORY_ALIGMENT=${GPU_MEMORY_ALIGMENT}) @@ -77,7 +77,7 @@ list(APPEND CMAKE_PREFIX_PATH $ENV{CMAKE_PREFIX_PATH}) include(GitSubmodule) # include custom defined FindPackage modules include(GNUInstallDirs) # required to get a proper LIBDIR variable -if (CREATE_PYTHON_MODULE) +if (SIRIUS_CREATE_PYTHON_MODULE) find_package(Python3 COMPONENTS Interpreter REQUIRED) set(PYTHON_EXECUTABLE ${Python3_EXECUTABLE}) endif() @@ -128,14 +128,11 @@ option(BUILD_SHARED_LIBS "Build shared libraries." ON) # generate compile_commands.json with compile commands for each target set(CMAKE_EXPORT_COMPILE_COMMANDS "YES") -if(USE_NLCGLIB) +if(SIRIUS_USE_NLCGLIB) find_package(nlcglib REQUIRED) find_package(Kokkos REQUIRED) endif() -if(USE_MEMORY_POOL) - find_package(umpire) -endif() find_package(MPI REQUIRED) find_package(GSL REQUIRED) @@ -147,11 +144,11 @@ find_package(SpFFT 1.0.2 CONFIG REQUIRED) find_package(SPLA 1.4.0 CONFIG REQUIRED) # Check if SpFFT support single precision if required -set(USE_FP32_BOOL OFF) -if(NOT USE_FP32 STREQUAL "OFF") +set(SIRIUS_USE_FP32 BOOL OFF) +if(NOT SIRIUS_USE_FP32 STREQUAL "OFF") if(SPFFT_SINGLE_PRECISION) - set(USE_FP32_BOOL ON) - elseif(USE_FP32 STREQUAL "ON") + set(SIRIUS_USE_FP32 BOOL ON) + elseif(SIRIUS_USE_FP32 STREQUAL "ON") message(FATAL_ERROR "Single precision option enabled, but SpFFT not compiled with single precision support.") endif() endif() @@ -172,50 +169,50 @@ else() target_compile_definitions(sirius::filesystem INTERFACE SIRIUS_BOOST_FILESYSTEM) endif() -if (USE_OPENMP) +if (SIRIUS_USE_OPENMP) find_package(OpenMP REQUIRED) endif() set(LINALG_LIB "") -if(USE_MKL) - set(USE_MKL_SHARED_LIBS On) # link against shared MKL libraries +if(SIRIUS_USE_MKL) + set(SIRIUS_USE_MKL_SHARED_LIBS On) # link against shared MKL libraries find_package(MKL REQUIRED) - set(LINALG_LIB "sirius::mkl") -elseif(USE_CRAY_LIBSCI) + set(SIRIUS_LINALG_LIB "sirius::mkl") +elseif(SIRIUS_USE_CRAY_LIBSCI) find_package(CRAY_LIBSCI REQUIRED) - set(LINALG_LIB "${CRAY_LIBSCI_LIBRARIES}") + set(SIRIUS_LINALG_LIB "${SIRIUS_CRAY_LIBSCI_LIBRARIES}") else() find_package(LAPACK REQUIRED) - set(LINALG_LIB "${LAPACK_LIBRARIES}") - if(USE_SCALAPACK) + set(SIRIUS_LINALG_LIB "${LAPACK_LIBRARIES}") + if(SIRIUS_USE_SCALAPACK) find_package(SCALAPACK REQUIRED) # just sets scalapack_DIR - set(LINALG_LIB "${LINALG_LIB};${SCALAPACK_LIBRARIES}") + set(SIRIUS_LINALG_LIB "${SIRIUS_LINALG_LIB};${SIRIUS_SCALAPACK_LIBRARIES}") endif() endif() -if(USE_ELPA) +if(SIRIUS_USE_ELPA) find_package(Elpa REQUIRED) -endif(USE_ELPA) +endif(SIRIUS_USE_ELPA) -if(USE_MAGMA) +if(SIRIUS_USE_MAGMA) find_package(MAGMA REQUIRED) -endif(USE_MAGMA) +endif(SIRIUS_USE_MAGMA) -if(USE_VDWXC) +if(SIRIUS_USE_VDWXC) find_package(LibVDWXC 0.3.0 REQUIRED) -endif(USE_VDWXC) +endif(SIRIUS_USE_VDWXC) find_package(costa CONFIG REQUIRED) -if(USE_CUDA) +if(SIRIUS_USE_CUDA) enable_language(CUDA) # note find cudatoolkit is called inside the include file. the # sirius::cuda_libs target is also defined there include(cmake/cudalibs_target.cmake) message(STATUS "CMAKE_CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}") -endif(USE_CUDA) +endif(SIRIUS_USE_CUDA) -if(USE_ROCM) +if(SIRIUS_USE_ROCM) # safegaurd. if (NOT DEFINED CMAKE_HIP_ARCHITECTURES) set(CMAKE_HIP_ARCHITECTURES gfx801 gfx900 gfx90a) @@ -227,6 +224,11 @@ if(USE_ROCM) set(CMAKE_HIP_STANDARD 14) endif() +if(SIRIUS_USE_MEMORY_POOL) + find_package(umpire) +endif() + + # check if git command exists find_program(GIT_EXE NAMES git) @@ -286,10 +288,10 @@ install(DIRECTORY "${PROJECT_SOURCE_DIR}/cmake/modules" # sirius library add_subdirectory(src) -if(CREATE_PYTHON_MODULE) +if(SIRIUS_CREATE_PYTHON_MODULE) # Python module add_subdirectory(python_module) -endif(CREATE_PYTHON_MODULE) +endif(SIRIUS_CREATE_PYTHON_MODULE) # applications if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) @@ -297,14 +299,14 @@ if(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) add_subdirectory(apps/unit_tests) endif(CMAKE_PROJECT_NAME STREQUAL PROJECT_NAME AND BUILD_TESTING) -if(BUILD_APPS) +if(SIRIUS_BUILD_APPS) add_subdirectory(apps/atoms) add_subdirectory(apps/hydrogen) add_subdirectory(apps/dft_loop) - if(USE_NLCGLIB) + if(SIRIUS_USE_NLCGLIB) add_subdirectory(apps/nlcg) endif() add_subdirectory(apps/upf) add_subdirectory(apps/utils) -endif(BUILD_APPS) +endif(SIRIUS_BUILD_APPS) add_subdirectory(doc) diff --git a/README.md b/README.md index 83eea78725..f48b609b6f 100644 --- a/README.md +++ b/README.md @@ -125,9 +125,9 @@ and optionally any of the additional libraries: * [Boost Filesystem](https://www.boost.org/doc/libs/1_73_0/libs/filesystem/doc/index.htm)* * [Eigen3](https://eigen.tuxfamily.org/index.php?title=Main_Page)** -\* Only required when `BUILD_APPS=On` and your compiler does not support `std::filesystem` or `std::experimental::filesystem`. +\* Only required when `SIRIUS_BUILD_APPS=On` and your compiler does not support `std::filesystem` or `std::experimental::filesystem`. -\** Only required when `-DBUILD_TESTING=On` +\** Only required when `-DSIRIUS_BUILD_TESTING=On` Clone the repository and build as follows: @@ -143,25 +143,25 @@ make -j install where `CMAKE_PREFIX_PATH` is a list of installation paths of dependencies installed in non-standard locations. #### Adding GPU support -To enable CUDA you need to pass the following options to CMake: `-DUSE_CUDA=On -DCMAKE_CUDA_ARCHITECTURES='60;70'`, where `CMAKE_CUDA_ARCHITECTURES` is +To enable CUDA you need to pass the following options to CMake: `-DSIRIUS_USE_CUDA=On -DCMAKE_CUDA_ARCHITECTURES='60;70'`, where `CMAKE_CUDA_ARCHITECTURES` is a list of NVIDIA architectures. Use `60`, `61`, `62` for Pascal; `70`, `72` for Volta; `75` for Turing; and `80` for Ampere. If CUDA is installed in a non-standard directory, you have to pass additional parameter to cmake `-DCUDA_TOOLKIT_ROOT_DIR=/path/to/cuda`. -To enable MAGMA (GPU implementation of LAPACK) use `-DUSE_MAGMA=On`. Append MAGMA's installation directory to `CMAKE_PREFIX_PATH` if necessary. +To enable MAGMA (GPU implementation of LAPACK) use `-DSIRIUS_USE_MAGMA=On`. Append MAGMA's installation directory to `CMAKE_PREFIX_PATH` if necessary. #### Parallel eigensolvers -To compile with ScaLAPACK use `-DUSE_SCALAPACK=On`. To use ELPA, both `-DUSE_SCALAPACK=On` and `-DUSE_ELPA=On` are +To compile with ScaLAPACK use `-DSIRIUS_USE_SCALAPACK=On`. To use ELPA, both `-DSIRIUS_USE_SCALAPACK=On` and `-DSIRIUS_USE_ELPA=On` are required, as we need ScaLAPACK functionality to transform the generalized eigenvalue problem to standard form, which can then be solved by ELPA. Append ScaLAPACK's and ELPA's install directory to `CMAKE_PREFIX_PATH` if necessary. #### Python module -Use `-DCREATE_PYTHON_MODULE=On` to build the Python module. The SIRIUS Python module depends on `mpi4py` and +Use `-DSIRIUS_CREATE_PYTHON_MODULE=On` to build the Python module. The SIRIUS Python module depends on `mpi4py` and `pybind11`, which need to be installed on your system. #### Additional options -To link against Intel MKL use `-DUSE_MKL=On`. For Cray libsci use `-DUSE_CRAY_LIBSCI=On`. Building tests requires `-DBUILD_TESTING=On`. +To link against Intel MKL use `-DSIRIUS_USE_MKL=On`. For Cray libsci use `-DSIRIUS_USE_CRAY_LIBSCI=On`. Building tests requires `-DSIRIUS_BUILD_TESTING=On`. -By default example applications are built. This can be turned off via `-DBUILD_APPS=Off`, which is recommended when just building Fortran bindings. +By default example applications are built. This can be turned off via `-DSIRIUS_BUILD_APPS=Off`, which is recommended when just building Fortran bindings. ### Installation on Piz Daint Please refer to the [SIRIUS wiki page](https://github.com/electronic-structure/SIRIUS/wiki/Build-on-Piz-Daint) and diff --git a/apps/dft_loop/CMakeLists.txt b/apps/dft_loop/CMakeLists.txt index 9b0a20c604..70da2b14de 100644 --- a/apps/dft_loop/CMakeLists.txt +++ b/apps/dft_loop/CMakeLists.txt @@ -1,9 +1,9 @@ -if(USE_VCSQNM) +if(SIRIUS_USE_VCSQNM) find_package (Eigen3 3.3 REQUIRED NO_MODULE) endif() add_executable(sirius.scf sirius.scf.cpp) target_link_libraries(sirius.scf PRIVATE sirius sirius::filesystem) -if(USE_VCSQNM) +if(SIRIUS_USE_VCSQNM) target_link_libraries (sirius.scf PRIVATE Eigen3::Eigen sirius) endif() install(TARGETS sirius.scf RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") @@ -11,7 +11,7 @@ set_property(TARGET sirius.scf PROPERTY POSITION_INDEPENDENT_CODE OFF) # Register verification tests as well set(SIRIUS_SCF_LABELS cpu_serial cpu_band_parallel) -if(USE_CUDA OR USE_ROCM) +if(SIRIUS_USE_CUDA OR SIRIUS_USE_ROCM) set(SIRIUS_SCF_LABELS ${SIRIUS_SCF_LABELS} gpu_serial gpu_band_parallel gpu_k_point_parallel) endif() set(SIRIUS_SCF_FLAGS_gpu_serial --control.processing_unit=gpu --control.std_evp_solver_name=cusolver --control.gen_evp_solver_name=cusolver) @@ -21,7 +21,8 @@ set(SIRIUS_SCF_FLAGS_cpu_serial --control.processing_unit=cpu) set(SIRIUS_SCF_FLAGS_cpu_band_parallel --control.processing_unit=cpu --control.mpi_grid_dims=2:2 --control.std_evp_solver_name=scalapack --control.gen_evp_solver_name=scalapack) # todo: Add OMP_NUM_THREADS + srun / mpiexec flags here too? -if(BUILD_TESTING) + +if(SIRIUS_BUILD_TESTING) file(GLOB dirs LIST_DIRECTORIES true "${CMAKE_SOURCE_DIR}/verification/test*") foreach(full_path ${dirs}) diff --git a/apps/tests/CMakeLists.txt b/apps/tests/CMakeLists.txt index 98af9c57ed..7b6c9efc3b 100644 --- a/apps/tests/CMakeLists.txt +++ b/apps/tests/CMakeLists.txt @@ -12,7 +12,7 @@ foreach(_test ${_tests}) install(TARGETS ${_test} RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") endforeach() -if(CREATE_FORTRAN_BINDINGS) +if(SIRIUS_CREATE_FORTRAN_BINDINGS) add_executable(test_fortran_api test_fortran_api.f90) target_link_libraries(test_fortran_api PRIVATE sirius MPI::MPI_Fortran) install(TARGETS test_fortran_api RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") @@ -20,4 +20,4 @@ if(CREATE_FORTRAN_BINDINGS) add_executable(test_srvo3_pwpp test_srvo3_pwpp.f90) target_link_libraries(test_srvo3_pwpp PRIVATE sirius MPI::MPI_Fortran) install(TARGETS test_srvo3_pwpp RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") -endif(CREATE_FORTRAN_BINDINGS) +endif(SIRIUS_CREATE_FORTRAN_BINDINGS) diff --git a/apps/tests/test_davidson.cpp b/apps/tests/test_davidson.cpp index 44b5d6df91..8884181d11 100644 --- a/apps/tests/test_davidson.cpp +++ b/apps/tests/test_davidson.cpp @@ -170,12 +170,12 @@ void test_davidson(cmd_args const& args__) std::cout << "precision_wf: " << precision_wf << ", precision_hs: " << precision_hs << std::endl; } if (precision_wf == "fp32" && precision_hs == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) diagonalize>(ctx, vk, pot, res_tol, eval_tol, only_kin, subspace_size, estimate_eval, extra_ortho); #endif } if (precision_wf == "fp32" && precision_hs == "fp64") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) diagonalize>(ctx, vk, pot, res_tol, eval_tol, only_kin, subspace_size, estimate_eval, extra_ortho); #endif } diff --git a/apps/tests/test_hloc.cpp b/apps/tests/test_hloc.cpp index be285daae7..165670dfd8 100644 --- a/apps/tests/test_hloc.cpp +++ b/apps/tests/test_hloc.cpp @@ -120,7 +120,7 @@ int main(int argn, char** argv) std::vector>(), false, false); for (int i = 0; i < repeat; i++) { if (fp32) { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) test_hloc(*ctx, num_bands, use_gpu); #else RTE_THROW("Not compiled with FP32 support"); diff --git a/apps/tests/test_wf_ortho.cpp b/apps/tests/test_wf_ortho.cpp index cf1936b1cf..c7107136c3 100644 --- a/apps/tests/test_wf_ortho.cpp +++ b/apps/tests/test_wf_ortho.cpp @@ -125,7 +125,7 @@ int main(int argn, char** argv) sirius::initialize(1); if (args.exist("fp32")) { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) call_test(mpi_grid_dims, cutoff, num_bands, bs, num_mag_dims, mem, 1); #else RTE_THROW("Not compiled with FP32 support"); diff --git a/apps/tests/test_wf_trans.cpp b/apps/tests/test_wf_trans.cpp index dc81715ed3..70a80816c2 100644 --- a/apps/tests/test_wf_trans.cpp +++ b/apps/tests/test_wf_trans.cpp @@ -138,7 +138,7 @@ int main(int argn, char** argv) sirius::initialize(1); if (args.exist("fp32")) { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) call_test(mpi_grid_dims, cutoff, num_bands, bs, num_mag_dims, mem, 1); #else RTE_THROW("Not compiled with FP32 support"); diff --git a/apps/unit_tests/test_fft_correctness_1.cpp b/apps/unit_tests/test_fft_correctness_1.cpp index e77332b592..1783f25c7f 100644 --- a/apps/unit_tests/test_fft_correctness_1.cpp +++ b/apps/unit_tests/test_fft_correctness_1.cpp @@ -131,7 +131,7 @@ int main(int argn, char **argv) printf("running %-30s : ", argv[0]); int result{0}; if (args.exist("fp32")) { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) result = run_test(args); #else RTE_THROW("not compiled with FP32 support"); diff --git a/apps/unit_tests/test_fft_correctness_2.cpp b/apps/unit_tests/test_fft_correctness_2.cpp index 278642153d..557192056c 100644 --- a/apps/unit_tests/test_fft_correctness_2.cpp +++ b/apps/unit_tests/test_fft_correctness_2.cpp @@ -85,7 +85,7 @@ int main(int argn, char **argv) printf("running %-30s : ", argv[0]); int result{0}; if (args.exist("fp32")) { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) result = run_test(args); #else RTE_THROW("not compiled with FP32 support"); diff --git a/ci/github-ci/spack/packages/sirius/cmake-fix-shared-library-installation.patch b/ci/github-ci/spack/packages/sirius/cmake-fix-shared-library-installation.patch deleted file mode 100644 index bffa67e5da..0000000000 --- a/ci/github-ci/spack/packages/sirius/cmake-fix-shared-library-installation.patch +++ /dev/null @@ -1,53 +0,0 @@ -From 4b51d07369b5972f3917cc8f2425caa814ae0975 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tiziano=20M=C3=BCller?= -Date: Thu, 16 May 2019 10:53:04 +0200 -Subject: [PATCH] cmake: fix shared library installation - -fixes the error during `make install`: - - TARGETS given no LIBRARY DESTINATION for shared library target - -when building shared libraries. - -... and respect the current OS/distro library dir. ---- - src/CMakeLists.txt | 11 +++++++++-- - 1 file changed, 9 insertions(+), 2 deletions(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index 65307dd3..2b7a5279 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -2,6 +2,8 @@ - # working correctly - # list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -fPIC") - -+include(GNUInstallDirs) # required to get a proper LIBDIR variable -+ - # keep two libraries: libsirius and libsirius_f - - if(USE_CUDA) -@@ -9,13 +11,18 @@ if(USE_CUDA) - file(GLOB_RECURSE CUFILES_KERNELS "Kernels/*.cu") - add_library(sirius_cu "${CUFILES_KERNELS};${CUFILES_SDDK}") - set_target_properties(sirius_cu PROPERTIES POSITION_INDEPENDENT_CODE ON) -- INSTALL (TARGETS sirius_cu ARCHIVE DESTINATION ${CMAKE_INSTALL_PREFIX}/lib/) -+ INSTALL (TARGETS sirius_cu -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ ) - endif() - if(CREATE_FORTRAN_BINDINGS) - add_library(sirius_f "sirius_api.cpp;sirius.f90") - SIRIUS_SETUP_TARGET(sirius_f) - INSTALL (TARGETS sirius_f ARCHIVE DESTINATION -- ${CMAKE_INSTALL_PREFIX}/lib/) -+ ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" -+ ) - set_target_properties(sirius_f PROPERTIES POSITION_INDEPENDENT_CODE ON) - set_target_properties(sirius_f PROPERTIES Fortran_MODULE_DIRECTORY mod_files) - target_link_libraries(sirius_f PUBLIC OpenMP::OpenMP_CXX) --- -2.16.4 - diff --git a/ci/github-ci/spack/packages/sirius/link-libraries-fortran.patch b/ci/github-ci/spack/packages/sirius/link-libraries-fortran.patch deleted file mode 100644 index 16de3a1710..0000000000 --- a/ci/github-ci/spack/packages/sirius/link-libraries-fortran.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 76f238d0ebcfc186f5210b0807b6a83a5c17bd43 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tiziano=20M=C3=BCller?= -Date: Wed, 24 Apr 2019 15:30:50 +0200 -Subject: [PATCH 2/2] cmake: properly link Fortran lib against used libraries - ---- - src/CMakeLists.txt | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt -index b927adef..a0d4aeb3 100644 ---- a/src/CMakeLists.txt -+++ b/src/CMakeLists.txt -@@ -13,7 +13,7 @@ if(USE_CUDA) - endif() - if(CREATE_FORTRAN_BINDINGS) - add_library(sirius_f "sirius_api.cpp;sirius.f90") -- add_dependencies(sirius_f generate_version_hpp runtime_options_json_hpp) -+ SIRIUS_SETUP_TARGET(sirius_f) - INSTALL (TARGETS sirius_f ARCHIVE DESTINATION - ${CMAKE_INSTALL_PREFIX}/lib/) - set_target_properties(sirius_f PROPERTIES POSITION_INDEPENDENT_CODE ON) --- -2.16.4 - diff --git a/ci/github-ci/spack/packages/sirius/mpi_datatypes.patch b/ci/github-ci/spack/packages/sirius/mpi_datatypes.patch deleted file mode 100644 index 47ddeeec24..0000000000 --- a/ci/github-ci/spack/packages/sirius/mpi_datatypes.patch +++ /dev/null @@ -1,22 +0,0 @@ -diff --git a/src/mpi/communicator.hpp b/src/mpi/communicator.hpp -index 709e56cfc..a05375bda 100644 ---- a/src/mpi/communicator.hpp -+++ b/src/mpi/communicator.hpp -@@ -111,7 +111,7 @@ struct mpi_type_wrapper> - { - static MPI_Datatype kind() - { -- return MPI_CXX_DOUBLE_COMPLEX; -+ return MPI_C_DOUBLE_COMPLEX; - } - }; - -@@ -174,7 +174,7 @@ struct mpi_type_wrapper - { - static MPI_Datatype kind() - { -- return MPI_CXX_BOOL; -+ return MPI_C_BOOL; - } - }; - diff --git a/ci/github-ci/spack/packages/sirius/package.py b/ci/github-ci/spack/packages/sirius/package.py deleted file mode 100644 index abba88504e..0000000000 --- a/ci/github-ci/spack/packages/sirius/package.py +++ /dev/null @@ -1,394 +0,0 @@ -# Copyright 2013-2022 Lawrence Livermore National Security, LLC and other -# Spack Project Developers. See the top-level COPYRIGHT file for details. -# -# SPDX-License-Identifier: (Apache-2.0 OR MIT) - -import os - -from spack import * - - -class Sirius(CMakePackage, CudaPackage, ROCmPackage): - """Domain specific library for electronic structure calculations""" - - homepage = "https://github.com/electronic-structure/SIRIUS" - url = "https://github.com/electronic-structure/SIRIUS/archive/v6.1.5.tar.gz" - list_url = "https://github.com/electronic-structure/SIRIUS/releases" - git = "https://github.com/electronic-structure/SIRIUS.git" - - maintainers = ["simonpintarelli", "haampie", "dev-zero", "AdhocMan", "toxa81"] - - # Don't upstream this, it's to work around - # https://github.com/spack/spack/pull/18574 / https://github.com/spack/spack/pull/18838 - build_dirname = "spack-build" - - version("develop", branch="develop") - version("master", branch="master") - - version("7.4.3", sha256="015679a60a39fa750c5d1bd8fb1ce73945524bef561270d8a171ea2fd4687fec") - version("7.4.0", sha256="f9360a695a1e786d8cb9d6702c82dd95144a530c4fa7e8115791c7d1e92b020b") - version("7.3.2", sha256="a256508de6b344345c295ad8642dbb260c4753cd87cc3dd192605c33542955d7") - version("7.3.1", sha256="8bf9848b8ebf0b43797fd359adf8c84f00822de4eb677e3049f22baa72735e98") - version( - "7.3.0", - sha256="69b5cf356adbe181be6c919032859c4e0160901ff42a885d7e7ea0f38cc772e2", - ) - version( - "7.2.7", - sha256="929bf7f131a4847624858b9c4295532c24b0c06f6dcef5453c0dfc33fb78eb03", - ) - version( - "7.2.6", - sha256="e751fd46cdc7c481ab23b0839d3f27fb00b75dc61dc22a650c92fe8e35336e3a", - ) - version( - "7.2.5", - sha256="794e03d4da91025f77542d3d593d87a8c74e980394f658a0210a4fd91c011f22", - ) - version( - "7.2.4", - sha256="aeed0e83b80c3a79a9469e7f3fe10d80ad331795e38dbc3c49cb0308e2bd084d", - ) - version( - "7.2.3", - sha256="6c10f0e87e50fcc7cdb4d1b2d35e91dba6144de8f111e36c7d08912e5942a906", - ) - version( - "7.2.1", - sha256="01bf6c9893ff471473e13351ca7fdc2ed6c1f4b1bb7afa151909ea7cd6fa0de7", - ) - version( - "7.2.0", - sha256="537800459db8a7553d7aa251c19f3a31f911930194b068bc5bca2dfb2c9b71db", - ) - version( - "7.0.2", - sha256="ee613607ce3be0b2c3f69b560b2415ce1b0e015179002aa90739430dbfaa0389", - deprecated=True, - ) - version( - "7.0.1", - sha256="cca11433f86e7f4921f7956d6589f27bf0fd5539f3e8f96e66a3a6f274888595", - deprecated=True, - ) - version( - "7.0.0", - sha256="da783df11e7b65668e29ba8d55c8a6827e2216ad6d88040f84f42ac20fd1bb99", - deprecated=True, - ) - version( - "6.5.7", - sha256="d886c3066163c43666ebac2ea50351df03907b5686671e514a75f131ba51b43c", - deprecated=True, - ) - version( - "6.5.6", - sha256="c8120100bde4477545eae489ea7f9140d264a3f88696ec92728616d78f214cae", - deprecated=True, - ) - version( - "6.5.5", - sha256="0b23d3a8512682eea67aec57271031c65f465b61853a165015b38f7477651dd1", - deprecated=True, - ) - version( - "6.5.4", - sha256="5f731926b882a567d117afa5e0ed33291f1db887fce52f371ba51f014209b85d", - deprecated=True, - ) - version( - "6.5.3", - sha256="eae0c303f332425a8c792d4455dca62557931b28a5df8b4c242652d5ffddd580", - deprecated=True, - ) - version( - "6.5.2", - sha256="c18adc45b069ebae03f94eeeeed031ee99b3d8171fa6ee73c7c6fb1e42397fe7", - deprecated=True, - ) - version( - "6.5.1", - sha256="599dd0fa25a4e83db2a359257a125e855d4259188cf5b0065b8e7e66378eacf3", - deprecated=True, - ) - version( - "6.5.0", - sha256="5544f3abbb71dcd6aa08d18aceaf53c38373de4cbd0c3af44fbb39c20cfeb7cc", - deprecated=True, - ) - version( - "6.4.4", - sha256="1c5de9565781847658c3cc11edcb404e6e6d1c5a9dfc81e977de7a9a7a162c8a", - deprecated=True, - ) - version( - "6.4.3", - sha256="4d1effeadb84b3e1efd7d9ac88018ef567aa2e0aa72e1112f0abf2e493e2a189", - deprecated=True, - ) - version( - "6.4.2", - sha256="40b9b66deebb6538fc0f4cd802554d0d763ea6426b9b2f0e8db8dc617e494479", - deprecated=True, - ) - version( - "6.4.1", - sha256="86f25c71517952a63e92e0a9bcf66d27e4afb2b0d67cf84af480f116b8e7f53c", - deprecated=True, - ) - version( - "6.4.0", - sha256="bc61758b71dd2996e2ff515b8c3560b2c69c00931cb2811a163a31bcfea4436e", - deprecated=True, - ) - version( - "6.3.4", - sha256="8839e988b4bb6ef99b6180f7fba03a5537e31fce51bb3e4c2298b513d6a07e0a", - deprecated=True, - ) - version( - "6.3.3", - sha256="7ba30a4e5c9a545433251211454ec0d59b74ba8941346057bc7de11e7f6886f7", - deprecated=True, - ) - version( - "6.3.2", - sha256="1723e5ad338dad9a816369a6957101b2cae7214425406b12e8712c82447a7ee5", - deprecated=True, - ) - version( - "6.1.5", - sha256="379f0a2e5208fd6d91c2bd4939c3a5c40002975fb97652946fa1bfe4a3ef97cb", - deprecated=True, - ) - - variant("shared", default=True, description="Build shared libraries") - variant("openmp", default=True, description="Build with OpenMP support") - variant( - "boost_filesystem", - default=False, - description="Use Boost filesystem for self-consistent field method " - "mini-app. Only required when the compiler does not " - "support std::experimental::filesystem nor std::filesystem", - ) - variant("fortran", default=False, description="Build Fortran bindings") - variant("python", default=False, description="Build Python bindings") - variant("memory_pool", default=True, description="Build with memory pool") - variant("elpa", default=False, description="Use ELPA") - variant("vdwxc", default=False, description="Enable libvdwxc support") - variant("scalapack", default=False, description="Enable scalapack support") - variant("magma", default=False, description="Enable MAGMA support") - variant( - "nlcglib", default=False, description="enable robust wave function optimization" - ) - variant( - "build_type", - default="Release", - description="CMake build type", - values=("Debug", "Release", "RelWithDebInfo"), - ) - variant("apps", default=True, description="Build applications") - variant("tests", default=False, description="Build tests") - variant( - "single_precision", - default=False, - description="Use single precision arithmetics", - ) - variant( - "profiler", - default=True, - description="Use internal profiler to measure execution time", - ) - depends_on("mpi") - depends_on("gsl") - depends_on("lapack") - depends_on("fftw-api@3") - depends_on("libxc@3.0.0:") - depends_on("libxc@4.0.0:", when="@7.2.0:") - depends_on("spglib") - depends_on("hdf5+hl") - depends_on("pkgconfig", type="build") - - # Python module - depends_on("python", when="+python@3.6:", type=("build", "run")) - depends_on("python", when="@:6", type=("build", "run")) - depends_on("py-numpy", when="+python", type=("build", "run")) - depends_on("py-scipy", when="+python", type=("build", "run")) - depends_on("py-h5py", when="+python", type=("build", "run")) - depends_on("py-mpi4py", when="+python", type=("build", "run")) - depends_on("py-pyyaml", when="+python", type=("build", "run")) - depends_on("py-mpi4py", when="+python", type=("build", "run")) - depends_on("py-voluptuous", when="+python", type=("build", "run")) - depends_on("py-pybind11", when="+python", type=("build", "run")) - extends("python", when="+python") - - depends_on("magma", when="+magma") - depends_on("boost cxxstd=14 +filesystem", when="+boost_filesystem") - - depends_on("spfft@0.9.6: +mpi", when="@6.4.0:") - depends_on("spfft@0.9.13:", when="@7.0.1:") - depends_on("spfft+single_precision", when="+single_precision ^spfft") - depends_on("spfft+cuda", when="+cuda ^spfft") - depends_on("spfft+rocm", when="+rocm ^spfft") - depends_on("spfft+openmp", when="+openmp ^spfft") - - depends_on("spla@1.1.0:", when="@7.0.2:") - depends_on("spla+cuda", when="+cuda ^spla") - depends_on("spla+rocm", when="+rocm ^spla") - depends_on("spla+openmp", when="+openmp ^spla") - - depends_on("nlcglib", when="+nlcglib") - - depends_on("libvdwxc@0.3.0:+mpi", when="+vdwxc") - - depends_on("scalapack", when="+scalapack") - - with when("@7.4.3:"): - depends_on("umpire", when=("+memory_pool")) - depends_on("umpire+cuda", when="+memory_pool+cuda") - depends_on("umpire+rocm", when="+memory_pool+rocm") - - # rocm - depends_on("hip", when="+rocm") - depends_on("rocblas", when="+rocm") - - # FindHIP cmake script only works for < 4.1 - depends_on("hip@:4.0", when="@:7.2.0 +rocm") - - conflicts("+shared", when="@6.3.0:6.4") - conflicts("+boost_filesystem", when="~apps") - conflicts("^libxc@5.0.0") # known to produce incorrect results - conflicts("+single_precision", when="@:7.2.4") - - # Propagate openmp to blas - depends_on("openblas threads=openmp", when="+openmp ^openblas") - depends_on("amdblis threads=openmp", when="+openmp ^amdblis") - depends_on("blis threads=openmp", when="+openmp ^blis") - depends_on("intel-mkl threads=openmp", when="+openmp ^intel-mkl") - - depends_on("elpa+openmp", when="+elpa+openmp") - depends_on("elpa~openmp", when="+elpa~openmp") - - depends_on("eigen@3.4.0:", when="@7.4: +tests") - - depends_on("costa+shared", when="@7.4:") - - # TODO: - # add support for CRAY_LIBSCI, testing - - patch("strip-spglib-include-subfolder.patch", when="@6.1.5") - patch("link-libraries-fortran.patch", when="@6.1.5") - patch("cmake-fix-shared-library-installation.patch", when="@6.1.5") - patch("mpi_datatypes.patch", when="@:7.2.6") - - @property - def libs(self): - libraries = [] - - if "@6.3.0:" in self.spec: - libraries += ["libsirius"] - - return find_libraries( - libraries, - root=self.prefix, - shared="+shared" in self.spec, - recursive=True, - ) - else: - if "+fortran" in self.spec: - libraries += ["libsirius_f"] - - if "+cuda" in self.spec: - libraries += ["libsirius_cu"] - - return find_libraries( - libraries, - root=self.prefix, - shared="+shared" in self.spec, - recursive=True, - ) - - def cmake_args(self): - spec = self.spec - - args = [ - self.define_from_variant("USE_OPENMP", "openmp"), - self.define_from_variant("USE_ELPA", "elpa"), - self.define_from_variant("USE_MAGMA", "magma"), - self.define_from_variant("USE_NLCGLIB", "nlcglib"), - self.define_from_variant("USE_VDWXC", "vdwxc"), - self.define_from_variant("USE_MEMORY_POOL", "memory_pool"), - self.define_from_variant("USE_SCALAPACK", "scalapack"), - self.define_from_variant("CREATE_FORTRAN_BINDINGS", "fortran"), - self.define_from_variant("CREATE_PYTHON_MODULE", "python"), - self.define_from_variant("USE_CUDA", "cuda"), - self.define_from_variant("USE_ROCM", "rocm"), - self.define_from_variant("BUILD_TESTING", "tests"), - self.define_from_variant("BUILD_APPS", "apps"), - self.define_from_variant("BUILD_SHARED_LIBS", "shared"), - self.define_from_variant("USE_FP32", "single_precision"), - self.define_from_variant("USE_PROFILER", "profiler"), - ] - - lapack = spec["lapack"] - blas = spec["blas"] - - args.extend( - [ - self.define("LAPACK_FOUND", "true"), - self.define("LAPACK_LIBRARIES", lapack.libs.joined(";")), - self.define("BLAS_FOUND", "true"), - self.define("BLAS_LIBRARIES", blas.libs.joined(";")), - ] - ) - - if "+scalapack" in spec: - args.extend( - [ - self.define("SCALAPACK_FOUND", "true"), - self.define( - "SCALAPACK_INCLUDE_DIRS", spec["scalapack"].prefix.include - ), - self.define( - "SCALAPACK_LIBRARIES", spec["scalapack"].libs.joined(";") - ), - ] - ) - - if spec["blas"].name in ["intel-mkl", "intel-parallel-studio"]: - args.append(self.define("USE_MKL", "ON")) - - if "+elpa" in spec: - elpa_incdir = os.path.join(spec["elpa"].headers.directories[0], "elpa") - args.append(self.define("ELPA_INCLUDE_DIR", elpa_incdir)) - - if "+cuda" in spec: - cuda_arch = spec.variants["cuda_arch"].value - if cuda_arch[0] != "none": - # Specify a single arch directly - if "@:6" in spec: - args.append( - self.define( - "CMAKE_CUDA_FLAGS", "-arch=sm_{0}".format(cuda_arch[0]) - ) - ) - - # Make SIRIUS handle it - elif "@6:7.3" in spec: - args.append(self.define("CUDA_ARCH", ";".join(cuda_arch))) - else: - args.append(self.define("CMAKE_CUDA_ARCHITECTURES", ";".join(cuda_arch))) - if "+rocm" in spec: - archs = ",".join(self.spec.variants["amdgpu_target"].value) - if "@:7.3" in spec: - args.extend( - [ - self.define("HIP_ROOT_DIR", spec["hip"].prefix), - self.define("HIP_HCC_FLAGS", "--amdgpu-target={0}".format(archs)), - self.define("HIP_CXX_COMPILER", self.spec["hip"].hipcc), - ] - ) - else: - args.extend([self.define("CMAKE_HIP_ARCHITECTURES", archs)]) - - return args diff --git a/ci/github-ci/spack/packages/sirius/strip-spglib-include-subfolder.patch b/ci/github-ci/spack/packages/sirius/strip-spglib-include-subfolder.patch deleted file mode 100644 index 0e775149a3..0000000000 --- a/ci/github-ci/spack/packages/sirius/strip-spglib-include-subfolder.patch +++ /dev/null @@ -1,25 +0,0 @@ -From 1a4ae29387790183b3de38acf8d38623429f3f62 Mon Sep 17 00:00:00 2001 -From: =?UTF-8?q?Tiziano=20M=C3=BCller?= -Date: Wed, 24 Apr 2019 11:29:05 +0200 -Subject: [PATCH] spglib does not install to a subfolder by default - ---- - src/Unit_cell/unit_cell_symmetry.hpp | 2 +- - 1 file changed, 1 insertion(+), 1 deletion(-) - -diff --git a/src/Unit_cell/unit_cell_symmetry.hpp b/src/Unit_cell/unit_cell_symmetry.hpp -index 9852bd4a..2c5a1e04 100644 ---- a/src/Unit_cell/unit_cell_symmetry.hpp -+++ b/src/Unit_cell/unit_cell_symmetry.hpp -@@ -26,7 +26,7 @@ - #define __UNIT_CELL_SYMMETRY_HPP__ - - extern "C" { --#include -+#include - } - - #include "geometry3d.hpp" --- -2.16.4 - diff --git a/ci/github-ci/spack/repo.yaml b/ci/github-ci/spack/repo.yaml deleted file mode 100644 index c9f9c52b5c..0000000000 --- a/ci/github-ci/spack/repo.yaml +++ /dev/null @@ -1,2 +0,0 @@ -repo: - namespace: user diff --git a/cmake/modules/FindCRAY_LIBSCI.cmake b/cmake/modules/FindCRAY_LIBSCI.cmake index f650cc6465..12be81e458 100644 --- a/cmake/modules/FindCRAY_LIBSCI.cmake +++ b/cmake/modules/FindCRAY_LIBSCI.cmake @@ -9,7 +9,7 @@ else() message(FATAL_ERROR "Unknown compiler. When using libsci use either GNU or INTEL compiler") endif() -find_library(CRAY_LIBSCI_LIBRARIES +find_library(SIRIUS_CRAY_LIBSCI_LIBRARIES NAMES ${_sciname} HINTS ${_SCALAPACK_LIBRARY_DIRS} @@ -18,4 +18,4 @@ find_library(CRAY_LIBSCI_LIBRARIES PATH_SUFFIXES lib DOC "scalapack library path") -find_package_handle_standard_args(CRAY_LIBSCI DEFAULT_MSG CRAY_LIBSCI_LIBRARIES) +find_package_handle_standard_args(CRAY_LIBSCI DEFAULT_MSG SIRIUS_CRAY_LIBSCI_LIBRARIES) diff --git a/cmake/modules/FindElpa.cmake b/cmake/modules/FindElpa.cmake index d85bb9a232..b6b2876dc9 100644 --- a/cmake/modules/FindElpa.cmake +++ b/cmake/modules/FindElpa.cmake @@ -13,7 +13,7 @@ pkg_search_module(_ELPA elpa-2019.11.001 elpa-2020.05.001) -find_library(ELPA_LIBRARIES +find_library(SIRIUS_ELPA_LIBRARIES NAMES elpa elpa_openmp PATH_SUFFIXES lib HINTS @@ -22,7 +22,7 @@ find_library(ELPA_LIBRARIES ${_ELPA_LIBRARY_DIRS} DOC "elpa libraries list") -find_path(ELPA_INCLUDE_DIR +find_path(SIRIUS_ELPA_INCLUDE_DIR NAMES elpa/elpa.h elpa/elpa_constants.h PATH_SUFFIXES include/elpa_openmp-$ENV{EBVERSIONELPA} include/elpa-$ENV{EBVERSIONELPA} HINTS @@ -30,13 +30,13 @@ find_path(ELPA_INCLUDE_DIR ENV ELPAROOT ENV EBROOTELPA) -find_package_handle_standard_args(Elpa "DEFAULT_MSG" ELPA_LIBRARIES ELPA_INCLUDE_DIR) +find_package_handle_standard_args(Elpa "DEFAULT_MSG" SIRIUS_ELPA_LIBRARIES SIRIUS_ELPA_INCLUDE_DIR) -message("ELPA_INCLUDE_DIR: ${ELPA_INCLUDE_DIR}") +message("ELPA_INCLUDE_DIR: ${SIRIUS_ELPA_INCLUDE_DIR}") if(Elpa_FOUND AND NOT TARGET sirius::elpa) add_library(sirius::elpa INTERFACE IMPORTED) set_target_properties(sirius::elpa PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${ELPA_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${ELPA_LIBRARIES}") + INTERFACE_INCLUDE_DIRECTORIES "${SIRIUS_ELPA_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${SIRIUS_ELPA_LIBRARIES}") endif() diff --git a/cmake/modules/FindFFTW.cmake b/cmake/modules/FindFFTW.cmake index d261546f9e..fed769a134 100644 --- a/cmake/modules/FindFFTW.cmake +++ b/cmake/modules/FindFFTW.cmake @@ -1,33 +1,34 @@ include(FindPackageHandleStandardArgs) -find_path(FFTW_INCLUDE_DIR +find_path(SIRIUS_FFTW_INCLUDE_DIRS NAMES fftw3.h PATH_SUFFIXES include include/fftw HINTS ENV MKLROOT HINTS ENV FFTWROOT HINTS ENV FFTW_INC - ) +) -find_library(FFTW_LIBRARIES +find_library(SIRIUS_FFTW_LIBRARIES NAMES fftw3 PATH_SUFFIXES lib HINTS ENV MKLROOT HINTS ENV FFTW_DIR HINTS ENV FFTWROOT - ) +) -set(FFTW_INCLUDE_DIRS ${FFTW_INCLUDE_DIR}) - -if(FFTW_LIBRARIES MATCHES "NOTFOUND") - # ok, fftw libraries not found. - # MKL contains fftw, lets assume we use MKL - # TODO: handle this properly - set(FFTW_LIBRARIES "") +if (SIRIUS_FFTW_INCLUDE_DIRS) find_package_handle_standard_args(FFTW - REQUIRED_VARS FFTW_INCLUDE_DIR ) - mark_as_advanced(FFTW_FOUND FFTW_INCLUDE_DIR) + REQUIRED_VARS SIRIUS_FFTW_INCLUDE_DIRS SIRIUS_FFTW_LIBRARIES) else() find_package_handle_standard_args(FFTW - REQUIRED_VARS FFTW_INCLUDE_DIR FFTW_LIBRARIES) - mark_as_advanced(FFTW_FOUND FFTW_INCLUDE_DIR FFTW_LIBRARIES) + REQUIRED_VARS SIRIUS_FFTW_LIBRARIES) +endif() +set(SIRIUS_FFTW_FOUND TRUE) +if (NOT TARGET sirius::fftw) + add_library(sirius::fftw INTERFACE IMPORTED) + set_target_properties(sirius::mkl PROPERTIES + INTERFACE_INCLUDE_DIRECTORIES "${SIRIUS_FFTW_INCLUDE_DIRS}" + INTERFACE_LINK_LIBRARIES "${SIRIUS_FFTW_LIBRARIES}") endif() + +mark_as_advanced(SIRIUS_FFTW_FOUND SIRIUS_FFTW_INCLUDE_DIRS SIRIUS_FFTW_LIBRARIES) diff --git a/cmake/modules/FindLibSPG.cmake b/cmake/modules/FindLibSPG.cmake index 564852c942..c30ea52c69 100644 --- a/cmake/modules/FindLibSPG.cmake +++ b/cmake/modules/FindLibSPG.cmake @@ -3,7 +3,7 @@ include(FindPackageHandleStandardArgs) -find_path(LIBSPG_INCLUDE_DIR +find_path(SIRIUS_LIBSPG_INCLUDE_DIR NAMES spglib.h PATH_SUFFIXES include include/spglib spglib HINTS @@ -12,7 +12,7 @@ find_path(LIBSPG_INCLUDE_DIR ENV LIBSPGROOT DOC "spglib include directory") -find_library(LIBSPG_LIBRARIES +find_library(SIRIUS_LIBSPG_LIBRARIES NAMES symspg PATH_SUFFIXES lib HINTS @@ -21,11 +21,11 @@ find_library(LIBSPG_LIBRARIES ENV LIBSPGROOT DOC "spglib libraries list") -find_package_handle_standard_args(LibSPG DEFAULT_MSG LIBSPG_LIBRARIES LIBSPG_INCLUDE_DIR) +find_package_handle_standard_args(LibSPG DEFAULT_MSG SIRIUS_LIBSPG_LIBRARIES SIRIUS_LIBSPG_INCLUDE_DIR) if(LibSPG_FOUND AND NOT TARGET sirius::libspg) add_library(sirius::libspg INTERFACE IMPORTED) set_target_properties(sirius::libspg PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${LIBSPG_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${LIBSPG_LIBRARIES}") + INTERFACE_INCLUDE_DIRECTORIES "${SIRIUS_LIBSPG_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${SIRIUS_LIBSPG_LIBRARIES}") endif() diff --git a/cmake/modules/FindLibVDWXC.cmake b/cmake/modules/FindLibVDWXC.cmake index 7dbebc71d5..1cd525b79b 100644 --- a/cmake/modules/FindLibVDWXC.cmake +++ b/cmake/modules/FindLibVDWXC.cmake @@ -7,7 +7,7 @@ find_package(PkgConfig REQUIRED) pkg_search_module(_LIBVDWXC libvdwxc>=${LibVDWXC_FIND_VERSION}) -find_path(LIBVDWXC_INCLUDE_DIR +find_path(SIRIUS_LIBVDWXC_INCLUDE_DIR NAMES vdwxc.h vdwxc_mpi.h PATH_SUFFIXES include inc HINTS @@ -17,7 +17,7 @@ find_path(LIBVDWXC_INCLUDE_DIR ${_LIBVDWXC_INCLUDE_DIRS} DOC "vdwxc include directory") -find_library(LIBVDWXC_LIBRARIES +find_library(SIRIUS_LIBVDWXC_LIBRARIES NAMES vdwxc PATH_SUFFIXES lib HINTS @@ -28,14 +28,14 @@ find_library(LIBVDWXC_LIBRARIES DOC "vdwxc libraries list") # try linking in C (C++ fails because vdwxc_mpi.h includes mpi.h inside extern "C"{...}) -set(CMAKE_REQUIRED_LIBRARIES "${LIBVDWXC_LIBRARIES}") -check_symbol_exists(vdwxc_init_mpi "${LIBVDWXC_INCLUDE_DIR}/vdwxc_mpi.h" HAVE_LIBVDW_WITH_MPI) +set(CMAKE_REQUIRED_LIBRARIES "${SIRIUS_LIBVDWXC_LIBRARIES}") +check_symbol_exists(vdwxc_init_mpi "${SIRIUS_LIBVDWXC_INCLUDE_DIR}/vdwxc_mpi.h" HAVE_LIBVDW_WITH_MPI) -find_package_handle_standard_args(LibVDWXC DEFAULT_MSG LIBVDWXC_LIBRARIES LIBVDWXC_INCLUDE_DIR) +find_package_handle_standard_args(LibVDWXC DEFAULT_MSG SIRIUS_LIBVDWXC_LIBRARIES SIRIUS_LIBVDWXC_INCLUDE_DIR) if(LibVDWXC_FOUND AND NOT TARGET sirius::libvdwxc) add_library(sirius::libvdwxc INTERFACE IMPORTED) set_target_properties(sirius::libvdwxc PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${LIBVDWXC_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${LIBVDWXC_LIBRARIES}") + INTERFACE_INCLUDE_DIRECTORIES "${SIRIUS_LIBVDWXC_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${SIRIUS_LIBVDWXC_LIBRARIES}") endif() diff --git a/cmake/modules/FindLibXC.cmake b/cmake/modules/FindLibXC.cmake index 45f547e9b8..1143d9bd0a 100644 --- a/cmake/modules/FindLibXC.cmake +++ b/cmake/modules/FindLibXC.cmake @@ -3,7 +3,7 @@ find_package(PkgConfig REQUIRED) pkg_search_module(_LIBXC libxc>=${LibXC_FIND_VERSION}) -find_library(LIBXC_LIBRARIES NAMES xc +find_library(SIRIUS_LIBXC_LIBRARIES NAMES xc PATH_SUFFIXES lib HINTS ENV EBROOTLIBXC @@ -11,7 +11,7 @@ find_library(LIBXC_LIBRARIES NAMES xc ${_LIBXC_LIBRARY_DIRS} DOC "libxc libraries list") -find_path(LIBXC_INCLUDE_DIR NAMES xc.h xc_f90_types_m.mod +find_path(SIRIUS_LIBXC_INCLUDE_DIR NAMES xc.h xc_f90_types_m.mod PATH_SUFFIXES inc include HINTS ${_LIBXC_INCLUDE_DIRS} @@ -19,11 +19,11 @@ find_path(LIBXC_INCLUDE_DIR NAMES xc.h xc_f90_types_m.mod ENV LIBXCROOT ) -find_package_handle_standard_args(LibXC DEFAULT_MSG LIBXC_LIBRARIES LIBXC_INCLUDE_DIR) +find_package_handle_standard_args(LibXC DEFAULT_MSG SIRIUS_LIBXC_LIBRARIES SIRIUS_LIBXC_INCLUDE_DIR) if(LibXC_FOUND AND NOT TARGET sirius::libxc) add_library(sirius::libxc INTERFACE IMPORTED) set_target_properties(sirius::libxc PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${LIBXC_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${LIBXC_LIBRARIES}") + INTERFACE_INCLUDE_DIRECTORIES "${SIRIUS_LIBXC_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${SIRIUS_LIBXC_LIBRARIES}") endif() diff --git a/cmake/modules/FindMAGMA.cmake b/cmake/modules/FindMAGMA.cmake index f393f7c5d1..caca89f2fa 100644 --- a/cmake/modules/FindMAGMA.cmake +++ b/cmake/modules/FindMAGMA.cmake @@ -1,6 +1,6 @@ include(FindPackageHandleStandardArgs) -find_path(MAGMA_INCLUDE_DIR magmablas.h +find_path(SIRIUS_MAGMA_INCLUDE_DIR magmablas.h HINTS ENV EBROOTMAGMA ENV MAGMA_DIR @@ -8,7 +8,7 @@ find_path(MAGMA_INCLUDE_DIR magmablas.h PATH_SUFFIXES include magma/include ) -find_library(MAGMA_LIBRARIES NAMES magma magma_sparse +find_library(SIRIUS_MAGMA_LIBRARIES NAMES magma magma_sparse HINTS ENV EBROOTMAGMA ENV MAGMA_DIR @@ -16,12 +16,12 @@ find_library(MAGMA_LIBRARIES NAMES magma magma_sparse PATH_SUFFIXES lib magma/lib ) -find_package_handle_standard_args(MAGMA DEFAULT_MSG MAGMA_INCLUDE_DIR MAGMA_LIBRARIES) -mark_as_advanced(MAGMA_FOUND MAGMA_INCLUDE_DIR MAGMA_LIBRARIES) +find_package_handle_standard_args(MAGMA DEFAULT_MSG SIRIUS_MAGMA_INCLUDE_DIR SIRIUS_MAGMA_LIBRARIES) +mark_as_advanced(MAGMA_FOUND SIRIUS_MAGMA_INCLUDE_DIR SIRIUS_MAGMA_LIBRARIES) if(MAGMA_FOUND AND NOT TARGET sirius::magma) add_library(sirius::magma INTERFACE IMPORTED) set_target_properties(sirius::magma PROPERTIES - INTERFACE_INCLUDE_DIRECTORIES "${MAGMA_INCLUDE_DIR}" - INTERFACE_LINK_LIBRARIES "${MAGMA_LIBRARIES}") + INTERFACE_INCLUDE_DIRECTORIES "${SIRIUS_MAGMA_INCLUDE_DIR}" + INTERFACE_LINK_LIBRARIES "${SIRIUS_MAGMA_LIBRARIES}") endif() diff --git a/cmake/modules/FindMKL.cmake b/cmake/modules/FindMKL.cmake index 2f007b5e8f..c0c2ac3a0b 100644 --- a/cmake/modules/FindMKL.cmake +++ b/cmake/modules/FindMKL.cmake @@ -43,7 +43,7 @@ if(CMAKE_FIND_LIBRARY_SUFFIXES STREQUAL ".a") message(FATAL_ERROR "Attempting to find static MKL libraries. SIRIUS supports only shared linking against MKL. NOTE: On Cray systems you must set `CRAYPE_LINK_TYPE=dynamic`.") endif() -if(NOT USE_MKL_SHARED_LIBS) +if(NOT SIRIUS_USE_MKL_SHARED_LIBS) set(INT_LIB "libmkl_intel_lp64.a") set(SEQ_LIB "libmkl_sequential.a") if(CMAKE_CXX_COMPILER_ID MATCHES "Intel") diff --git a/cmake/modules/FindSCALAPACK.cmake b/cmake/modules/FindSCALAPACK.cmake index 668f3442ac..c13955cc41 100644 --- a/cmake/modules/FindSCALAPACK.cmake +++ b/cmake/modules/FindSCALAPACK.cmake @@ -2,7 +2,7 @@ include(FindPackageHandleStandardArgs) find_package(PkgConfig REQUIRED) pkg_search_module(_SCALAPACK scalapack) -find_library(SCALAPACK_LIBRARIES +find_library(SIRIUS_SCALAPACK_LIBRARIES NAMES scalapack scalapack-openmpi HINTS ${_SCALAPACK_LIBRARY_DIRS} @@ -11,4 +11,4 @@ find_library(SCALAPACK_LIBRARIES PATH_SUFFIXES lib DOC "scalapack library path") -find_package_handle_standard_args(SCALAPACK DEFAULT_MSG SCALAPACK_LIBRARIES) +find_package_handle_standard_args(SCALAPACK DEFAULT_MSG SIRIUS_SCALAPACK_LIBRARIES) diff --git a/cmake/siriusConfig.cmake.in b/cmake/siriusConfig.cmake.in index 6c493f22c5..d80c1fe8df 100644 --- a/cmake/siriusConfig.cmake.in +++ b/cmake/siriusConfig.cmake.in @@ -40,41 +40,41 @@ if(NOT TARGET sirius::sirius) find_package(SPLA 1.1.0 CONFIG ${mode}) find_package(costa CONFIG ${mode}) - if(@USE_OPENMP@) + if(@SIRIUS_USE_OPENMP@) find_package(OpenMP ${mode}) endif() - if(@USE_MKL@) - set(USE_MKL_SHARED_LIBS On) # link against shared MKL libraries + if(@SIRIUS_USE_MKL@) + set(SIRIUS_USE_MKL_SHARED_LIBS On) # link against shared MKL libraries find_package(MKL ${mode}) - elseif(@USE_CRAY_LIBSCI@) + elseif(@SIRIUS_USE_CRAY_LIBSCI@) find_package(CRAY_LIBSCI ${mode}) else() find_package(LAPACK ${mode}) - if(@USE_SCALAPACK@) + if(@SIRIUS_USE_SCALAPACK@) find_package(SCALAPACK ${mode}) # just sets scalapack_DIR endif() endif() - if(@USE_ELPA@) + if(@SIRIUS_USE_ELPA@) find_package(Elpa ${mode}) endif() - if(@USE_MAGMA@) + if(@SIRIUS_USE_MAGMA@) find_package(MAGMA ${mode}) endif() - if(@USE_VDWXC@) + if(@SIRIUS_USE_VDWXC@) find_package(LibVDWXC 0.3.0 ${mode}) endif() - if(@USE_CUDA@) + if(@SIRIUS_USE_CUDA@) # TODO: propagate the passed `sm` flag find_package(CUDA ${mode}) include("${CMAKE_CURRENT_LIST_DIR}/cudalibs_target.cmake") endif() - if(@USE_ROCM@) + if(@SIRIUS_USE_ROCM@) find_package(hip CONFIG ${mode}) find_package(rocblas CONFIG ${mode}) find_package(rocsolver CONFIG ${mode}) diff --git a/doc/CMakeLists.txt b/doc/CMakeLists.txt index 5821910048..c22283483d 100644 --- a/doc/CMakeLists.txt +++ b/doc/CMakeLists.txt @@ -1,6 +1,6 @@ find_package(Doxygen) -if(DOXYGEN_FOUND AND BUILD_DOCS) +if(DOXYGEN_FOUND AND SIRIUS_BUILD_DOCS) set(DOXYGEN_CONFIG_FILE "${CMAKE_CURRENT_BINARY_DIR}/doxygen.cfg") # configure doxygen.cfg.in and adapt paths configure_file(doxygen.cfg.in ${DOXYGEN_CONFIG_FILE} @ONLY IMMEDIATE) @@ -10,4 +10,4 @@ if(DOXYGEN_FOUND AND BUILD_DOCS) COMMAND ${DOXYGEN_EXECUTABLE} ${DOXYGEN_CONFIG_FILE} WORKING_DIRECTORY ${DOXYGEN_OUTPUT_DIR}) install(DIRECTORY ${DOXYGEN_OUTPUT_DIR}/html/ DESTINATION ${CMAKE_INSTALL_PREFIX}/doc) -endif(DOXYGEN_FOUND AND BUILD_DOCS) +endif() diff --git a/spack/packages/sirius/package.py b/spack/packages/sirius/package.py index a9983238a1..e593a72051 100644 --- a/spack/packages/sirius/package.py +++ b/spack/packages/sirius/package.py @@ -150,7 +150,8 @@ class Sirius(CMakePackage, CudaPackage, ROCmPackage): variant("vdwxc", default=False, description="Enable libvdwxc support") variant("scalapack", default=False, description="Enable scalapack support") variant("magma", default=False, description="Enable MAGMA support") - variant("nlcglib", default=False, description="enable robust wave function optimization") + variant("nlcglib", default=False, description="Enable robust wave function optimization") + variant("wannier90", default=False, description="Enable Wannier90 library") variant( "build_type", default="Release", @@ -203,15 +204,15 @@ class Sirius(CMakePackage, CudaPackage, ROCmPackage): depends_on("spla+openmp", when="+openmp ^spla") depends_on("nlcglib", when="+nlcglib") - depends_on("nlcglib+cuda", when="+nlcglib+cuda") depends_on("nlcglib+rocm", when="+nlcglib+rocm") + depends_on("nlcglib+cuda", when="+nlcglib+cuda") depends_on("libvdwxc@0.3.0:+mpi", when="+vdwxc") depends_on("scalapack", when="+scalapack") depends_on("rocblas", when="+rocm") - depends_on("rocsolver", when="+rocm") + depends_on("rocsolver", when="@7.5.0: +rocm") # FindHIP cmake script only works for < 4.1 depends_on("hip@:4.0", when="@:7.2.0 +rocm") @@ -228,6 +229,9 @@ class Sirius(CMakePackage, CudaPackage, ROCmPackage): depends_on("blis threads=openmp", when="+openmp ^blis") depends_on("intel-mkl threads=openmp", when="+openmp ^intel-mkl") + depends_on("wannier90", when="@7.5.0: +wannier90") + depends_on("wannier90+shared", when="@7.5.0: +wannier90+shared") + depends_on("elpa+openmp", when="+elpa+openmp") depends_on("elpa~openmp", when="+elpa~openmp") @@ -269,23 +273,28 @@ def libs(self): def cmake_args(self): spec = self.spec + cm_label = "" + if "@7.5:" in spec: + cm_label = "SIRIUS_" + args = [ - self.define_from_variant("USE_OPENMP", "openmp"), - self.define_from_variant("USE_ELPA", "elpa"), - self.define_from_variant("USE_MAGMA", "magma"), - self.define_from_variant("USE_NLCGLIB", "nlcglib"), - self.define_from_variant("USE_VDWXC", "vdwxc"), - self.define_from_variant("USE_MEMORY_POOL", "memory_pool"), - self.define_from_variant("USE_SCALAPACK", "scalapack"), - self.define_from_variant("CREATE_FORTRAN_BINDINGS", "fortran"), - self.define_from_variant("CREATE_PYTHON_MODULE", "python"), - self.define_from_variant("USE_CUDA", "cuda"), - self.define_from_variant("USE_ROCM", "rocm"), - self.define_from_variant("BUILD_TESTING", "tests"), - self.define_from_variant("BUILD_APPS", "apps"), - self.define_from_variant("BUILD_SHARED_LIBS", "shared"), - self.define_from_variant("USE_FP32", "single_precision"), - self.define_from_variant("USE_PROFILER", "profiler"), + self.define_from_variant(cm_label + "USE_OPENMP", "openmp"), + self.define_from_variant(cm_label + "USE_ELPA", "elpa"), + self.define_from_variant(cm_label + "USE_MAGMA", "magma"), + self.define_from_variant(cm_label + "USE_NLCGLIB", "nlcglib"), + self.define_from_variant(cm_label + "USE_VDWXC", "vdwxc"), + self.define_from_variant(cm_label + "USE_MEMORY_POOL", "memory_pool"), + self.define_from_variant(cm_label + "USE_SCALAPACK", "scalapack"), + self.define_from_variant(cm_label + "CREATE_FORTRAN_BINDINGS", "fortran"), + self.define_from_variant(cm_label + "CREATE_PYTHON_MODULE", "python"), + self.define_from_variant(cm_label + "USE_CUDA", "cuda"), + self.define_from_variant(cm_label + "USE_ROCM", "rocm"), + self.define_from_variant(cm_label + "BUILD_TESTING", "tests"), + self.define_from_variant(cm_label + "BUILD_APPS", "apps"), + self.define_from_variant(cm_label + "BUILD_SHARED_LIBS", "shared"), + self.define_from_variant(cm_label + "USE_FP32", "single_precision"), + self.define_from_variant(cm_label + "USE_PROFILER", "profiler"), + self.define_from_variant(cm_label + "USE_WANNIER90", "wannier90"), ] lapack = spec["lapack"] @@ -303,21 +312,25 @@ def cmake_args(self): if "+scalapack" in spec and "^cray-libsci" not in spec: args.extend( [ - self.define("SCALAPACK_FOUND", "true"), - self.define("SCALAPACK_INCLUDE_DIRS", spec["scalapack"].prefix.include), - self.define("SCALAPACK_LIBRARIES", spec["scalapack"].libs.joined(";")), + self.define(cm_label + "SCALAPACK_FOUND", "true"), + self.define( + cm_label + "SCALAPACK_INCLUDE_DIRS", spec["scalapack"].prefix.include + ), + self.define( + cm_label + "SCALAPACK_LIBRARIES", spec["scalapack"].libs.joined(";") + ), ] ) if "^cray-libsci" in spec: - args.append(self.define("USE_CRAY_LIBSCI", "ON")) + args.append(self.define(cm_label + "USE_CRAY_LIBSCI", "ON")) - if spec["blas"].name in ["intel-mkl", "intel-parallel-studio"]: - args.append(self.define("USE_MKL", "ON")) + if spec["blas"].name in ["intel-mkl", "intel-parallel-studio", "intel-oneapi-mkl"]: + args.append(self.define(cm_label + "USE_MKL", "ON")) if "+elpa" in spec: elpa_incdir = os.path.join(spec["elpa"].headers.directories[0], "elpa") - args.append(self.define("ELPA_INCLUDE_DIR", elpa_incdir)) + args.append(self.define(cm_label + "ELPA_INCLUDE_DIR", elpa_incdir)) if "+cuda" in spec: cuda_arch = spec.variants["cuda_arch"].value diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 3dd5dc2cb1..45392fa14d 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -2,11 +2,11 @@ # working correctly # list(APPEND CUDA_NVCC_FLAGS "-Xcompiler -fPIC") -if(CREATE_FORTRAN_BINDINGS) +if(SIRIUS_CREATE_FORTRAN_BINDINGS) set(_FSOURCES "api/sirius_api.cpp;api/sirius.f90") endif() -if(USE_CUDA OR USE_ROCM) +if(SIRIUS_USE_CUDA OR SIRIUS_USE_ROCM) set(_CUSOURCES "gpu/augmentation_operator.cu" "gpu/checksum.cu" @@ -102,55 +102,60 @@ target_compile_features(sirius PUBLIC c_std_99) target_compile_features(sirius PUBLIC cuda_std_14) set_target_properties(sirius PROPERTIES POSITION_INDEPENDENT_CODE ON) -if(USE_ROCM) +if(SIRIUS_USE_ROCM) set_source_files_properties(${_CUSOURCES} PROPERTIES LANGUAGE HIP) + set_target_properties(sirius PROPERTIES HIP_ARCHITECTURES ${CMAKE_HIP_ARCHITECTURES}) endif() -target_link_libraries(sirius PUBLIC SpFFT::spfft - SPLA::spla - ${GSL_LIBRARY} - "${LINALG_LIB}" +if(SIRIUS_USE_CUDA) + set_target_properties(sirius PROPERTIES CUDA_ARCHITECTURES ${CMAKE_CUDA_ARCHITECTURES}) +endif() + +target_link_libraries(sirius PUBLIC ${GSL_LIBRARY} MPI::MPI_CXX sirius::libxc sirius::libspg sirius::hdf5 costa::costa - $ $ $ $ - $ $ $ - $<$:nvToolsExt> - $<$:roc::rocblas> - $<$:roc::rocsolver> - $<$:hip::host> - $<$:umpire>) + SpFFT::spfft + SPLA::spla + "${SIRIUS_LINALG_LIB}" + $<$:umpire> + $<$:nvToolsExt> + $ + $<$:roc::rocblas> + $<$:hip::host> + $ + ) target_include_directories(sirius PUBLIC $ $ $ $) target_compile_definitions(sirius PUBLIC - $<$:SIRIUS_PROFILE> - $<$:SIRIUS_SCALAPACK> - $<$:SIRIUS_USE_MEMORY_POOL> - $<$:SIRIUS_USE_POWER_COUNTER> - $<$:SIRIUS_ELPA> - $<$:SIRIUS_NLCGLIB> - $<$:SIRIUS_GPU SIRIUS_CUDA> - $<$:SIRIUS_CUDA_NVTX> - $<$:SIRIUS_MAGMA> - $<$:SIRIUS_GPU SIRIUS_ROCM> - $<$:SIRIUS_USE_VDWXC> - $<$:USE_FP32> - $<$:SIRIUS_VCSQNM> - $<$:SIRIUS_HAVE_VDWXC_MPI> - $<$,$>:HAVE_HIP> # Required for magma headers + $<$:SIRIUS_PROFILE> + $<$:SIRIUS_SCALAPACK> + $<$:SIRIUS_USE_MEMORY_POOL> + $<$:SIRIUS_SIRIUS_USE_POWER_COUNTER> + $<$:SIRIUS_ELPA> + $<$:SIRIUS_NLCGLIB> + $<$:SIRIUS_GPU SIRIUS_CUDA> + $<$:SIRIUS_CUDA_NVTX> + $<$:SIRIUS_MAGMA> + $<$:SIRIUS_GPU SIRIUS_ROCM> + $<$:SIRIUS_USE_VDWXC> + $<$:SIRIUS_USE_FP32> + $<$:SIRIUS_VCSQNM> + $<$:SIRIUS_HAVE_VDWXC_MPI> + $<$,$>:HAVE_HIP> # Required for magma headers ) -if(CREATE_FORTRAN_BINDINGS) +if(SIRIUS_CREATE_FORTRAN_BINDINGS) set_target_properties(sirius PROPERTIES Fortran_MODULE_DIRECTORY mod_files) install(FILES "${PROJECT_BINARY_DIR}/src/mod_files/sirius.mod" DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/sirius") diff --git a/src/band/band.cpp b/src/band/band.cpp index 01cd7a5c93..a16dcdef8a 100644 --- a/src/band/band.cpp +++ b/src/band/band.cpp @@ -77,7 +77,7 @@ Band::initialize_subspace(K_point_set& kset__, Hamiltonian0& H0__) const template void Band::initialize_subspace(K_point_set& kset__, Hamiltonian0& H0__) const; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template void Band::initialize_subspace(K_point_set& kset__, Hamiltonian0& H0__) const; diff --git a/src/band/diag_pseudo_potential.cpp b/src/band/diag_pseudo_potential.cpp index 68fb02ff18..f0129f5d57 100644 --- a/src/band/diag_pseudo_potential.cpp +++ b/src/band/diag_pseudo_potential.cpp @@ -307,7 +307,7 @@ Band::diag_pseudo_potential_exact(int ispn__, Hamiltonian_k Band::diag_S_davidson(Hamiltonian_k& Hk__) const; diff --git a/src/band/solve.cpp b/src/band/solve.cpp index af9932c201..13eeb1090f 100644 --- a/src/band/solve.cpp +++ b/src/band/solve.cpp @@ -57,7 +57,7 @@ template void Band::solve_full_potential(Hamiltonian_k& Hk__, double itsol_tol__) const; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template<> void Band::solve_full_potential(Hamiltonian_k& Hk__, double itsol_tol__) const @@ -204,7 +204,7 @@ template void Band::solve(K_point_set& kset__, Hamiltonian0& H0__, double itsol_tol__) const; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template void Band::solve(K_point_set& kset__, Hamiltonian0& H0__, double itsol_tol__) const; diff --git a/src/beta_projectors/beta_projectors_base.cpp b/src/beta_projectors/beta_projectors_base.cpp index 9db94a26db..bb802d241c 100644 --- a/src/beta_projectors/beta_projectors_base.cpp +++ b/src/beta_projectors/beta_projectors_base.cpp @@ -94,7 +94,7 @@ template void beta_projectors_generate_cpu(sddk::matrix>&, sddk::mdarray, 3> const&, int, int, beta_chunk_t const&, Simulation_context const&, fft::Gvec const&); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 // explicit instantiation template void beta_projectors_generate_cpu(sddk::matrix>&, sddk::mdarray, 3> const&, @@ -124,7 +124,7 @@ template void beta_projectors_generate_gpu(beta_projectors_coeffs_t&, sddk::mdarray, 3> const&, sddk::mdarray, 3> const&, Simulation_context const&, fft::Gvec const&, sddk::mdarray const&, beta_chunk_t const&, int); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 // explicit instantiation template void beta_projectors_generate_gpu(beta_projectors_coeffs_t&, sddk::mdarray, 3> const&, @@ -312,7 +312,7 @@ Beta_projector_generator::generate(beta_projectors_coeffs_t& out, int ichu template class Beta_projector_generator; template class Beta_projectors_base; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template class Beta_projector_generator; template class Beta_projectors_base; #endif diff --git a/src/context/simulation_context.cpp b/src/context/simulation_context.cpp index 9b9b396274..08d56c984a 100644 --- a/src/context/simulation_context.cpp +++ b/src/context/simulation_context.cpp @@ -67,7 +67,7 @@ spfft::Grid& Simulation_context::spfft_grid_coarse() return *spfft_grid_coarse_; } -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template <> spfft::TransformFloat& Simulation_context::spfft() { @@ -838,7 +838,7 @@ Simulation_context::update() spfft_grid_coarse_ = std::make_unique(fft_coarse_grid_[0], fft_coarse_grid_[1], fft_coarse_grid_[2], gvec_coarse_fft_->zcol_count(), spl_z.local_size(), spfft_pu, -1, comm_fft_coarse().native(), SPFFT_EXCH_DEFAULT); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 spfft_grid_coarse_float_ = std::make_unique(fft_coarse_grid_[0], fft_coarse_grid_[1], fft_coarse_grid_[2], gvec_coarse_fft_->zcol_count(), spl_z.local_size(), spfft_pu, -1, comm_fft_coarse().native(), SPFFT_EXCH_DEFAULT); @@ -853,7 +853,7 @@ Simulation_context::update() spfft_pu, fft_type_coarse, fft_coarse_grid_[0], fft_coarse_grid_[1], fft_coarse_grid_[2], spl_z.local_size(), gvec_coarse_fft_->count(), SPFFT_INDEX_TRIPLETS, gv.at(sddk::memory_t::host)))); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 spfft_transform_coarse_float_.reset(new spfft::TransformFloat(spfft_grid_coarse_float_->create_transform( spfft_pu, fft_type_coarse, fft_coarse_grid_[0], fft_coarse_grid_[1], fft_coarse_grid_[2], spl_z.local_size(), gvec_coarse_fft_->count(), SPFFT_INDEX_TRIPLETS, @@ -875,7 +875,7 @@ Simulation_context::update() new spfft::Grid(fft_grid_[0], fft_grid_[1], fft_grid_[2], gvec_fft_->zcol_count(), spl_z.local_size(), spfft_pu, -1, comm_fft().native(), SPFFT_EXCH_DEFAULT)); -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) spfft_grid_float_ = std::unique_ptr( new spfft::GridFloat(fft_grid_[0], fft_grid_[1], fft_grid_[2], gvec_fft_->zcol_count(), spl_z.local_size(), spfft_pu, -1, comm_fft().native(), SPFFT_EXCH_DEFAULT)); @@ -887,7 +887,7 @@ Simulation_context::update() spfft_transform_.reset(new spfft::Transform(spfft_grid_->create_transform( spfft_pu, fft_type, fft_grid_[0], fft_grid_[1], fft_grid_[2], spl_z.local_size(), gvec_fft_->count(), SPFFT_INDEX_TRIPLETS, gv.at(sddk::memory_t::host)))); -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) spfft_transform_float_.reset(new spfft::TransformFloat(spfft_grid_float_->create_transform( spfft_pu, fft_type, fft_grid_[0], fft_grid_[1], fft_grid_[2], spl_z.local_size(), gvec_fft_->count(), SPFFT_INDEX_TRIPLETS, gv.at(sddk::memory_t::host)))); diff --git a/src/context/simulation_context.hpp b/src/context/simulation_context.hpp index 05d31019d2..c0b78e27a9 100644 --- a/src/context/simulation_context.hpp +++ b/src/context/simulation_context.hpp @@ -208,7 +208,7 @@ class Simulation_context : public Simulation_parameters * FFT grid. The transformation is parallel. */ std::unique_ptr spfft_transform_; std::unique_ptr spfft_grid_; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) std::unique_ptr spfft_transform_float_; std::unique_ptr spfft_grid_float_; #endif @@ -219,7 +219,7 @@ class Simulation_context : public Simulation_parameters /// Coarse-grained FFT for application of local potential and density summation. std::unique_ptr spfft_transform_coarse_; std::unique_ptr spfft_grid_coarse_; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) std::unique_ptr spfft_transform_coarse_float_; std::unique_ptr spfft_grid_coarse_float_; #endif diff --git a/src/density/density.cpp b/src/density/density.cpp index d120648c64..888320b8af 100644 --- a/src/density/density.cpp +++ b/src/density/density.cpp @@ -1210,7 +1210,7 @@ Density::generate(K_point_set const& ks__, bool symmetrize__, bool add_core__, b template void Density::generate(K_point_set const& ks__, bool symmetrize__, bool add_core__, bool transform_to_rg__); -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template void Density::generate(K_point_set const& ks__, bool symmetrize__, bool add_core__, bool transform_to_rg__); #endif diff --git a/src/density/occupation_matrix.cpp b/src/density/occupation_matrix.cpp index 45e177664f..5fae4eaef4 100644 --- a/src/density/occupation_matrix.cpp +++ b/src/density/occupation_matrix.cpp @@ -215,7 +215,7 @@ Occupation_matrix::add_k_point_contribution(K_point& kp__) } template void Occupation_matrix::add_k_point_contribution(K_point& kp__); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template void Occupation_matrix::add_k_point_contribution(K_point& kp__); #endif diff --git a/src/dft/dft_ground_state.cpp b/src/dft/dft_ground_state.cpp index fd0e8f072a..e77657d52c 100644 --- a/src/dft/dft_ground_state.cpp +++ b/src/dft/dft_ground_state.cpp @@ -37,7 +37,7 @@ DFT_ground_state::initial_state() potential_.generate(density_, ctx_.use_symmetry(), true); if (!ctx_.full_potential()) { if (ctx_.cfg().parameters().precision_wf() == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) Hamiltonian0 H0(potential_, true); Band(ctx_).initialize_subspace(kset_, H0); #else @@ -222,7 +222,7 @@ DFT_ground_state::find(double density_tol__, double energy_tol__, double iter_so ctx_.message(2, __func__, s); if (ctx_.cfg().parameters().precision_wf() == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) Hamiltonian0 H0(potential_, true); /* find new wave-functions */ if (ctx_.cfg().parameters().precision_hs() == "fp32") { @@ -266,7 +266,7 @@ DFT_ground_state::find(double density_tol__, double energy_tol__, double iter_so /* tolerance can't be too small */ iter_solver_tol__ = std::max(ctx_.cfg().settings().itsol_tol_min(), tol); -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) if (ctx_.cfg().parameters().precision_gs() != "auto") { /* if the final precision is not equal to the current precision */ if (ctx_.cfg().parameters().precision_gs() == "fp64" && ctx_.cfg().parameters().precision_wf() == "fp32") { diff --git a/src/fft/fft.hpp b/src/fft/fft.hpp index be15f08b97..b6f47ee690 100644 --- a/src/fft/fft.hpp +++ b/src/fft/fft.hpp @@ -42,7 +42,7 @@ struct SpFFT_Grid {using type = spfft::Grid;}; template <> struct SpFFT_Grid> {using type = spfft::Grid;}; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template <> struct SpFFT_Grid> {using type = spfft::GridFloat;}; @@ -63,7 +63,7 @@ struct SpFFT_Transform {using type = spfft::Transform;}; template <> struct SpFFT_Transform> {using type = spfft::Transform;}; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template <> struct SpFFT_Transform {using type = spfft::TransformFloat;}; diff --git a/src/geometry/force.cpp b/src/geometry/force.cpp index 01751c0cd6..d3d61dcd7b 100644 --- a/src/geometry/force.cpp +++ b/src/geometry/force.cpp @@ -73,7 +73,7 @@ sddk::mdarray const& Force::calc_forces_nonloc() PROFILE("sirius::Force::calc_forces_nonloc"); if (ctx_.cfg().parameters().precision_wf() == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) this->calc_forces_nonloc_aux(); #endif } else { @@ -912,7 +912,7 @@ Force::print_info(std::ostream& out__, int verbosity__) template void Force::calc_forces_nonloc_aux(); -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template void Force::calc_forces_nonloc_aux(); diff --git a/src/geometry/stress.cpp b/src/geometry/stress.cpp index 6f5d834a72..2fcc7372b6 100644 --- a/src/geometry/stress.cpp +++ b/src/geometry/stress.cpp @@ -693,7 +693,7 @@ Stress::calc_stress_kin() { PROFILE("sirius::Stress|kin"); if (ctx_.cfg().parameters().precision_wf() == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) this->calc_stress_kin_aux(); #endif } else { @@ -758,7 +758,7 @@ r3::matrix Stress::calc_stress_nonloc() { if (ctx_.cfg().parameters().precision_wf() == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) if (ctx_.gamma_point()) { calc_stress_nonloc_aux(); } else { diff --git a/src/hamiltonian/hamiltonian.cpp b/src/hamiltonian/hamiltonian.cpp index c16c7c3ed3..149c50b9fd 100644 --- a/src/hamiltonian/hamiltonian.cpp +++ b/src/hamiltonian/hamiltonian.cpp @@ -271,7 +271,7 @@ void Hamiltonian0::apply_hmt_to_apw(Atom const& atom__, int ngv__, sddk::mdarray, 2>& alm__, sddk::mdarray, 2>& halm__) const; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template class Hamiltonian0; template diff --git a/src/hamiltonian/hamiltonian_k.cpp b/src/hamiltonian/hamiltonian_k.cpp index 6b5ecae7f4..6a2cb50577 100644 --- a/src/hamiltonian/hamiltonian_k.cpp +++ b/src/hamiltonian/hamiltonian_k.cpp @@ -1493,7 +1493,7 @@ Hamiltonian_k::get_h_o_diag_lapw<2>() const; template std::pair, sddk::mdarray> Hamiltonian_k::get_h_o_diag_lapw<3>() const; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template class Hamiltonian_k; template std::pair, sddk::mdarray> diff --git a/src/hamiltonian/local_operator.cpp b/src/hamiltonian/local_operator.cpp index 533310699d..2b1b6b3400 100644 --- a/src/hamiltonian/local_operator.cpp +++ b/src/hamiltonian/local_operator.cpp @@ -647,7 +647,7 @@ void Local_operator::apply_fplapw(fft::spfft_transform_type& spfftk__, std // instantiate for supported precision template class Local_operator; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template class Local_operator; #endif } // namespace sirius diff --git a/src/hamiltonian/non_local_operator.cpp b/src/hamiltonian/non_local_operator.cpp index b9ed512bd9..ebe2f87f07 100644 --- a/src/hamiltonian/non_local_operator.cpp +++ b/src/hamiltonian/non_local_operator.cpp @@ -399,7 +399,7 @@ template class D_operator; template class Q_operator; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template class Non_local_operator; template class D_operator; diff --git a/src/hamiltonian/s_u_operator.cpp b/src/hamiltonian/s_u_operator.cpp index 55cd7196c8..1857ff84b9 100644 --- a/src/hamiltonian/s_u_operator.cpp +++ b/src/hamiltonian/s_u_operator.cpp @@ -95,7 +95,7 @@ U_operator::find_orbital_index(const int ia__, const int n__, const int l__) } template class U_operator; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template class U_operator; #endif @@ -181,7 +181,7 @@ template void apply_U_operator(Simulation_context&, wf::spin_range, wf:: const wf::Wave_functions&, const wf::Wave_functions&, U_operator&, wf::Wave_functions&); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template void apply_U_operator(Simulation_context&, wf::spin_range, wf::band_range, const wf::Wave_functions&, const wf::Wave_functions&, U_operator&, wf::Wave_functions&); diff --git a/src/k_point/generate_fv_states.cpp b/src/k_point/generate_fv_states.cpp index 5bbf55f47f..66127877fe 100644 --- a/src/k_point/generate_fv_states.cpp +++ b/src/k_point/generate_fv_states.cpp @@ -121,7 +121,7 @@ void K_point::generate_fv_states() } template void K_point::generate_fv_states(); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template void K_point::generate_fv_states(); #endif diff --git a/src/k_point/generate_spinor_wave_functions.cpp b/src/k_point/generate_spinor_wave_functions.cpp index edf269e053..725bde75e6 100644 --- a/src/k_point/generate_spinor_wave_functions.cpp +++ b/src/k_point/generate_spinor_wave_functions.cpp @@ -88,7 +88,7 @@ void K_point::generate_spinor_wave_functions() } template void K_point::generate_spinor_wave_functions(); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template void K_point::generate_spinor_wave_functions(); #endif diff --git a/src/k_point/k_point.cpp b/src/k_point/k_point.cpp index abb664b10b..39d79c06b0 100644 --- a/src/k_point/k_point.cpp +++ b/src/k_point/k_point.cpp @@ -831,7 +831,7 @@ K_point::generate_gklo_basis() } template class K_point; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template class K_point; #endif } // namespace sirius diff --git a/src/k_point/k_point_set.cpp b/src/k_point/k_point_set.cpp index a2a6ee629a..22395f13c2 100644 --- a/src/k_point/k_point_set.cpp +++ b/src/k_point/k_point_set.cpp @@ -77,7 +77,7 @@ template void K_point_set::sync_band(); -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template void K_point_set::sync_band(); @@ -147,9 +147,9 @@ void K_point_set::initialize(std::vector const& counts) } for (auto it : spl_num_kpoints_) { - kpoints_[it.i]->initialize(); -#if defined(USE_FP32) - kpoints_float_[it.i]->initialize(); + kpoints_[it.i]->initialize(); +#if defined(SIRIUS_USE_FP32) + kpoints_float_[it.i]->initialize(); #endif } @@ -441,7 +441,7 @@ void K_point_set::find_band_occupancies() template void K_point_set::find_band_occupancies(); -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) template void K_point_set::find_band_occupancies(); #endif @@ -472,7 +472,7 @@ double K_point_set::valence_eval_sum() const double K_point_set::valence_eval_sum() const { if (ctx_.cfg().parameters().precision_wf() == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) return this->valence_eval_sum(); #else RTE_THROW("not compiled with FP32 support"); @@ -520,7 +520,7 @@ double K_point_set::entropy_sum() const double K_point_set::entropy_sum() const { if (ctx_.cfg().parameters().precision_wf() == "fp32") { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) return this->entropy_sum(); #else RTE_THROW("not compiled with FP32 support"); diff --git a/src/k_point/k_point_set.hpp b/src/k_point/k_point_set.hpp index 725f0f183b..707bd46947 100644 --- a/src/k_point/k_point_set.hpp +++ b/src/k_point/k_point_set.hpp @@ -46,7 +46,7 @@ class K_point_set /// List of k-points. std::vector>> kpoints_; -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) /// List of k-points in fp32 type, most calculation and assertion in this class only rely on fp64 type kpoints_ std::vector>> kpoints_float_; #endif @@ -144,12 +144,12 @@ class K_point_set void update() { /* update k-points */ - for (auto it : spl_num_kpoints_) { - kpoints_[it.i]->update(); -#if defined(USE_FP32) - kpoints_float_[it.i]->update(); + for (auto it : spl_num_kpoints_) { + kpoints_[it.i]->update(); +#if defined(SIRIUS_USE_FP32) + kpoints_float_[it.i]->update(); #endif - } + } } /// Get a list of band energies for a given k-point index. @@ -178,7 +178,7 @@ class K_point_set void add_kpoint(r3::vector vk__, double weight__) { kpoints_.push_back(std::unique_ptr>(new K_point(ctx_, vk__, weight__))); -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 kpoints_float_.push_back(std::unique_ptr>(new K_point(ctx_, vk__, weight__))); #endif } @@ -281,7 +281,7 @@ inline K_point* K_point_set::get(int ik__) const template<> inline K_point* K_point_set::get(int ik__) const { -#if defined(USE_FP32) +#if defined(SIRIUS_USE_FP32) RTE_ASSERT(ik__ >= 0 && ik__ < (int)kpoints_float_.size()); return kpoints_float_[ik__].get(); #else diff --git a/src/linalg/dmatrix.cpp b/src/linalg/dmatrix.cpp index 31a6a47a3e..01c6c6a864 100644 --- a/src/linalg/dmatrix.cpp +++ b/src/linalg/dmatrix.cpp @@ -259,7 +259,7 @@ void dmatrix::save_to_hdf5(std::string name__, int m__, int n__) // instantiate for required types template class dmatrix; template class dmatrix>; -#ifdef USE_FP32 +#ifdef SIRIUS_USE_FP32 template class dmatrix; template class dmatrix>; #endif