From 9e43ad6fe4b016461f2fb7e9b595b6e76c633f9e Mon Sep 17 00:00:00 2001 From: Simon Pintarelli Date: Mon, 8 May 2023 22:36:30 +0200 Subject: [PATCH 1/5] cmake --- CMakeLists.txt | 4 +--- src/mpi/mpi_type.hpp | 4 ++-- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index c8e30f8..32981e6 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,7 +12,7 @@ set(BUILD_TESTS OFF CACHE BOOL "build tests") set(LAPACK_VENDOR "OpenBLAS" CACHE STRING "lapack vendor") set_property(CACHE LAPACK_VENDOR PROPERTY STRINGS "OpenBLAS" "MKL" "MKLONEAPI") -find_package(MPI REQUIRED COMPONENTS CXX) +find_package(MPI REQUIRED) if(USE_OPENMP) find_package(OpenMP REQUIRED) @@ -35,8 +35,6 @@ if(USE_CUDA) endif() if(USE_ROCM) - # find_package(hip REQUIRED) - # enable_language(HIP) include(cmake/rocmlibs_target.cmake) endif() diff --git a/src/mpi/mpi_type.hpp b/src/mpi/mpi_type.hpp index 7151d2d..8fdf03d 100644 --- a/src/mpi/mpi_type.hpp +++ b/src/mpi/mpi_type.hpp @@ -57,13 +57,13 @@ struct mpi_type template <> struct mpi_type> { - static MPI_Datatype type() { return MPI_CXX_DOUBLE_COMPLEX; } + static MPI_Datatype type() { return MPI_C_DOUBLE_COMPLEX; } }; template <> struct mpi_type> { - static MPI_Datatype type() { return MPI_CXX_DOUBLE_COMPLEX; } + static MPI_Datatype type() { return MPI_C_DOUBLE_COMPLEX; } }; From 413f09df0dc845c92d187ccab9cf70e61c98253b Mon Sep 17 00:00:00 2001 From: Simon Pintarelli Date: Tue, 9 May 2023 13:18:14 +0200 Subject: [PATCH 2/5] cmake require 3.21 --- CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 32981e6..09ba5c4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.18 FATAL_ERROR) +cmake_minimum_required(VERSION 3.21 FATAL_ERROR) project(nlcglib LANGUAGES CXX VERSION 0.8) set(CMAKE_CXX_STANDARD 17) From f8575bba8c916a14de2fe4065ce1d2ec5c8a0944 Mon Sep 17 00:00:00 2001 From: Simon Pintarelli Date: Tue, 9 May 2023 13:18:27 +0200 Subject: [PATCH 3/5] cleanup spack recipe --- spack/packages/nlcglib/package.py | 26 ++++++++++++-------------- 1 file changed, 12 insertions(+), 14 deletions(-) diff --git a/spack/packages/nlcglib/package.py b/spack/packages/nlcglib/package.py index b3b1361..9146973 100644 --- a/spack/packages/nlcglib/package.py +++ b/spack/packages/nlcglib/package.py @@ -22,28 +22,26 @@ class Nlcglib(CMakePackage, CudaPackage, ROCmPackage): variant("build_type", default="Release", description="CMake build type", - values=("Debug", "Release", "RelWithDebInfo"), - ) + values=("Debug", "Release", "RelWithDebInfo")) - with when('+rocm'): + with when("+rocm"): variant("magma", default=True, description="Use magma eigenvalue solver (AMDGPU)") - depends_on("magma+rocm", when="+magma+rocm") + depends_on("magma+rocm", when="+magma") + depends_on("kokkos+rocm") + depends_on("rocblas") + depends_on("rocsolver") + + with when("+cuda"): + depends_on("kokkos+cuda+cuda_lambda+wrapper", when="%gcc") + depends_on("kokkos+cuda") - depends_on("cmake@3.18:", type="build") + depends_on("cmake@3.21:", type="build") depends_on("mpi") depends_on("lapack") depends_on("kokkos") depends_on("kokkos+openmp", when="+openmp") - depends_on("kokkos+cuda+cuda_lambda+wrapper", when="+cuda%gcc") - depends_on("kokkos+cuda", when="+cuda") - - # rocm dependencies - depends_on("kokkos+rocm", when="+rocm") - depends_on("rocblas", when="+rocm") - depends_on("rocsolver", when="+rocm") - depends_on("googletest", type="build", when="+tests") depends_on("nlohmann-json") @@ -81,7 +79,7 @@ def cmake_args(self): if "+rocm" in self.spec: options.append(self.define( "CMAKE_CXX_COMPILER", self.spec["hip"].hipcc)) - archs = ",".join(self.spec.variants['amdgpu_target'].value) + archs = ",".join(self.spec.variants["amdgpu_target"].value) options.append("-DHIP_HCC_FLAGS=--amdgpu-target={0}".format(archs)) options.append("-DCMAKE_CXX_FLAGS=--amdgpu-target={0} --offload-arch={0}".format(archs)) From bc39f72bb3fd2b7ec6064ddff4c5f0512235b09a Mon Sep 17 00:00:00 2001 From: Simon Pintarelli Date: Tue, 9 May 2023 14:58:53 +0200 Subject: [PATCH 4/5] unused variable --- src/la/lapack_rocm.hpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/la/lapack_rocm.hpp b/src/la/lapack_rocm.hpp index c8497f7..a4c6283 100644 --- a/src/la/lapack_rocm.hpp +++ b/src/la/lapack_rocm.hpp @@ -45,7 +45,7 @@ eigh(KokkosDVector& U, int lda = U_host.array().stride(1); int n = U_host.map().ncols(); Kokkos::deep_copy(U_host.array(), S_host.array()); - lapack_int info = LAPACKE_zheevd( + LAPACKE_zheevd( LAPACK_COL_MAJOR, /* matrix layout */ 'V', /* jobz */ 'U', /* uplot */ From 4c936a06ee0143fc4fa2202e978aaf53c90007fd Mon Sep 17 00:00:00 2001 From: Simon Pintarelli Date: Tue, 9 May 2023 14:59:03 +0200 Subject: [PATCH 5/5] cmake: targets/header files --- CMakeLists.txt | 6 ------ src/CMakeLists.txt | 14 ++++++++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 09ba5c4..8971a32 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -123,9 +123,3 @@ install( ${CMAKE_CURRENT_BINARY_DIR}/cmake/nlcglib/nlcglibConfigVersion.cmake DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/nlcglib) -install( - FILES - ${PROJECT_SOURCE_DIR}/include/nlcglib.hpp - ${PROJECT_SOURCE_DIR}/include/interface.hpp - DESTINATION "${CMAKE_INSTALL_PREFIX}/include/nlcglib" - ) diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index d6bfff8..1fb6969 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -22,8 +22,9 @@ else() target_link_libraries(nlcglib PRIVATE nlcg::cpu_lapack) endif() - -set_target_properties(nlcglib PROPERTIES PUBLIC_HEADER ${CMAKE_SOURCE_DIR}/include/nlcglib.hpp) +set_target_properties(nlcglib PROPERTIES PUBLIC_HEADER + ${CMAKE_SOURCE_DIR}/include/nlcglib.hpp +) include(GNUInstallDirs) @@ -31,5 +32,10 @@ install(TARGETS nlcglib EXPORT nlcglib_targets LIBRARY DESTINATION "${CMAKE_INSTALL_LIBDIR}" ARCHIVE DESTINATION "${CMAKE_INSTALL_LIBDIR}" - PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}" - INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}") + PUBLIC_HEADER DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nlcglib" + INCLUDES DESTINATION "${CMAKE_INSTALL_INCLUDEDIR}/nlcglib") +install( + FILES + ${PROJECT_SOURCE_DIR}/include/interface.hpp + DESTINATION "${CMAKE_INSTALL_PREFIX}/include/nlcglib" +)