From fcfd605fcd37deff121fc919b420fe747f5d94db Mon Sep 17 00:00:00 2001 From: Simon Pintarelli Date: Tue, 19 Jan 2021 13:37:18 +0100 Subject: [PATCH] rename define __CUDA to __NCLGLIB_CUDA --- cmake/nlcglib_macros.cmake | 2 +- src/CMakeLists.txt | 4 ++-- src/exec_space.hpp | 2 +- src/gpu/acc.cpp | 2 +- src/la/cusolver.cpp | 2 +- src/la/lapack.hpp | 8 ++++---- src/la/mvector.hpp | 6 +++--- src/nlcglib.cpp | 8 ++++---- test/test.cpp | 4 ++-- 9 files changed, 19 insertions(+), 19 deletions(-) diff --git a/cmake/nlcglib_macros.cmake b/cmake/nlcglib_macros.cmake index 36537a9..faa597c 100644 --- a/cmake/nlcglib_macros.cmake +++ b/cmake/nlcglib_macros.cmake @@ -23,5 +23,5 @@ MACRO(NLCGLIB_SETUP_TARGET _target) target_link_libraries(${_target} PRIVATE my_lapack) endif() target_compile_definitions(${_target} PUBLIC $<$:__USE_OPENMP>) - target_compile_definitions(${_target} PUBLIC $<$:__CUDA>) + target_compile_definitions(${_target} PUBLIC $<$:__NLCGLIB__CUDA>) ENDMACRO() diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6d4c568..353bbbd 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -6,7 +6,7 @@ target_link_libraries(nlcglib_internal INTERFACE my_lapack) target_include_directories(nlcglib_internal PUBLIC ${CMAKE_SOURCE_DIR}/src) target_include_directories(nlcglib_internal PUBLIC ${CMAKE_SOURCE_DIR}/include) target_include_directories(nlcglib_internal PUBLIC ${CUDA_INCLUDE_DIRS}) -target_compile_definitions(nlcglib_internal PUBLIC $<$:__CUDA>) +target_compile_definitions(nlcglib_internal PUBLIC $<$:__NLCGLIB__CUDA>) set(nlcglib_internal_location $) @@ -18,7 +18,7 @@ target_include_directories(nlcglib nlcglib_setup_target(nlcglib) set_target_properties(nlcglib PROPERTIES PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/nlcglib.hpp) -target_compile_definitions(nlcglib PUBLIC $<$:__CUDA>) +target_compile_definitions(nlcglib PUBLIC $<$:__NLCGLIB__CUDA>) include(GNUInstallDirs) diff --git a/src/exec_space.hpp b/src/exec_space.hpp index 5bec8e9..fdb37ad 100644 --- a/src/exec_space.hpp +++ b/src/exec_space.hpp @@ -9,7 +9,7 @@ struct exec { }; -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA template <> struct exec { diff --git a/src/gpu/acc.cpp b/src/gpu/acc.cpp index f3a216a..acbcef5 100644 --- a/src/gpu/acc.cpp +++ b/src/gpu/acc.cpp @@ -1,4 +1,4 @@ -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA #include #include #include diff --git a/src/la/cusolver.cpp b/src/la/cusolver.cpp index 7ba601f..c9f10dc 100644 --- a/src/la/cusolver.cpp +++ b/src/la/cusolver.cpp @@ -1,4 +1,4 @@ -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA #include "cusolver.hpp" #include diff --git a/src/la/lapack.hpp b/src/la/lapack.hpp index 084d206..7483add 100644 --- a/src/la/lapack.hpp +++ b/src/la/lapack.hpp @@ -4,7 +4,7 @@ #include #include #include "lapack_cpu.hpp" -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA #include "lapack_cuda.hpp" #endif #include "mvector.hpp" @@ -42,7 +42,7 @@ namespace nlcglib { // return d; // } -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA /// diag (on CUDA-GPU) template std::enable_if_t< @@ -367,7 +367,7 @@ struct innerh_tr // return sum; // } -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA template std::enable_if_t< Kokkos::SpaceAccessibility::accessible, @@ -463,7 +463,7 @@ double l2norm(const mvector& x) { return Kokkos::real(z); } -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA template std::enable_if_t::accessible> loewdin_aux(Kokkos::View& w) diff --git a/src/la/mvector.hpp b/src/la/mvector.hpp index a7c092d..b08ee78 100644 --- a/src/la/mvector.hpp +++ b/src/la/mvector.hpp @@ -397,7 +397,7 @@ make_mmatrix(std::shared_ptr matrix_base, std::enable_if_tget(i); auto kindex = matrix_base->kpoint_index(i); Communicator comm(buffer.mpi_comm); -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA if (Kokkos::SpaceAccessibility::accessible) { // make sure is memory type device if (buffer.memtype != memory_type::device) @@ -433,7 +433,7 @@ make_mmatrix(std::shared_ptr matrix_base, std::enable_if_tget(i); auto kindex = matrix_base->kpoint_index(i); Communicator comm(buffer.mpi_comm); -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA if (Kokkos::SpaceAccessibility::accessible) { // make sure is memory type device if (buffer.memtype != memory_type::device) @@ -467,7 +467,7 @@ auto make_mmvector(std::shared_ptr vector_base) // vector_t vector(); auto buffer = vector_base->get(i); if (buffer.memtype == memory_type::device) { -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA Kokkos::View src(buffer.data, buffer.size[0]); vector_t dst("vector", buffer.size[0]); Kokkos::deep_copy(dst, src); diff --git a/src/nlcglib.cpp b/src/nlcglib.cpp index 53f6ef8..712cfbc 100644 --- a/src/nlcglib.cpp +++ b/src/nlcglib.cpp @@ -321,7 +321,7 @@ nlcg_check_gradient_host(EnergyBase& energy) void nlcg_check_gradient_cuda(EnergyBase& energy) { -#if defined (__CLANG) && defined (__CUDA) +#if defined (__CLANG) && defined (__NLCGLIB__CUDA) Kokkos::initialize(); nlcg_check_gradient(energy); Kokkos::finalize(); @@ -342,7 +342,7 @@ nlcg_mvp2_cpu(EnergyBase& energy_base, smearing_type smearing, double temp, doub nlcg_info nlcg_mvp2_device(EnergyBase& energy_base, smearing_type smearing, double temp, double tol, double kappa, double tau, int maxiter, int restart) { -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA Kokkos::initialize(); auto info = nlcg(energy_base, smearing, temp, maxiter, tol, kappa, tau, restart); Kokkos::finalize(); @@ -365,7 +365,7 @@ nlcg_mvp2_device_cpu(EnergyBase& energy_base, int maxiter, int restart) { -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA Kokkos::initialize(); auto info = nlcg(energy_base, smearing, temp, maxiter, tol, kappa, tau, restart); Kokkos::finalize(); @@ -388,7 +388,7 @@ nlcg_mvp2_cpu_device(EnergyBase& energy_base, int maxiter, int restart) { -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA Kokkos::initialize(); auto info = nlcg( energy_base, smearing, temp, maxiter, tol, kappa, tau, restart); diff --git a/test/test.cpp b/test/test.cpp index 6d89e36..b910a41 100644 --- a/test/test.cpp +++ b/test/test.cpp @@ -52,7 +52,7 @@ run_unmanaged() eigh(H, eigvals, S); } -#ifdef __CUDA +#ifdef __NLCGLIB__CUDA void run_unmanaged_cuda() { @@ -117,7 +117,7 @@ int main(int argc, char *argv[]) run(); - #ifdef __CUDA + #ifdef __NLCGLIB__CUDA run_unmanaged_cuda(); #endif