Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
simonpintarelli committed May 9, 2023
2 parents 8abe235 + 4c936a0 commit ea1ec7c
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 28 deletions.
10 changes: 1 addition & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
Expand Down Expand Up @@ -35,8 +35,6 @@ if(USE_CUDA)
endif()

if(USE_ROCM)
# find_package(hip REQUIRED)
# enable_language(HIP)
include(cmake/rocmlibs_target.cmake)
endif()

Expand Down Expand Up @@ -125,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"
)
26 changes: 12 additions & 14 deletions spack/packages/nlcglib/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")

Expand Down Expand Up @@ -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))

Expand Down
14 changes: 10 additions & 4 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ 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)

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"
)
2 changes: 1 addition & 1 deletion src/la/lapack_rocm.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ eigh(KokkosDVector<T, LAYOUT, KOKKOS...>& 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 */
Expand Down

0 comments on commit ea1ec7c

Please sign in to comment.