From 0405475748be645cb25de404c4acd96d9ea58ca1 Mon Sep 17 00:00:00 2001 From: Pradipta Samanta <samanta@dkrz.de> Date: Fri, 21 Feb 2025 17:16:59 +0100 Subject: [PATCH] build kokkos internally along with the package --- CMakeLists.txt | 16 ++++++++++++++++ src/support/CMakeLists.txt | 10 ++++++---- 2 files changed, 22 insertions(+), 4 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8fb4acf..ab93b92 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -110,6 +110,22 @@ else() endif() endif() +include(FetchContent) +# configure kokkos 4.4 repository link +FetchContent_Declare(kokkos + URL https://github.com/kokkos/kokkos/releases/download/4.4.01/kokkos-4.4.01.tar.gz + URL_HASH MD5=eafd0d42c9831858aa84fde78576644c +) + +# disable build of C++23 mdspan experimental support for now +set(Kokkos_ENABLE_IMPL_MDSPAN OFF CACHE BOOL "Experimental mdspan support") + +# by default, build the Kokkos serial backend for CPU +set(Kokkos_ENABLE_SERIAL ON CACHE BOOL "Kokkos Serial backend") +set(Kokkos_ARCH_NATIVE ON CACHE BOOL "Kokkos native architecture optimisations") + +FetchContent_MakeAvailable(kokkos) + add_subdirectory(src) # Allow for 'make test' even if the tests are disabled: diff --git a/src/support/CMakeLists.txt b/src/support/CMakeLists.txt index b4ceb37..9f56017 100644 --- a/src/support/CMakeLists.txt +++ b/src/support/CMakeLists.txt @@ -57,9 +57,6 @@ if(IM_ENABLE_OPENACC) endif() endif() -message(STATUS "iconmath-support enabling Kokkos") -find_package(Kokkos REQUIRED) - target_include_directories( iconmath-support PUBLIC @@ -77,7 +74,12 @@ target_include_directories( # https://cmake.org/cmake/help/latest/manual/cmake-generator-expressions.7.html $<BUILD_INTERFACE:$<$<COMPILE_LANGUAGE:C,CXX>:${CMAKE_CURRENT_BINARY_DIR}>>) -target_link_libraries(iconmath-support PUBLIC fortran-support::fortran-support Kokkos::kokkos) +target_link_libraries(iconmath-support + PUBLIC + fortran-support::fortran-support + PRIVATE + Kokkos::kokkos +) install(TARGETS iconmath-support EXPORT "${PROJECT_NAME}-targets") -- GitLab