From af8c454b9b7f10b2d9a34258a278b6a84b8951cb Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Wed, 16 Oct 2024 14:32:22 +0200 Subject: [PATCH 1/4] Add missing dependencies on installed DDC --- .github/workflows/tests.yml | 10 ++++++++++ CMakeLists.txt | 5 +++++ cmake/DDCConfig.cmake.in | 15 +++++++++++++++ install_test/CMakeLists.txt | 17 +++++++++++++++++ install_test/main.cpp | 28 ++++++++++++++++++++++++++++ 5 files changed, 75 insertions(+) create mode 100644 install_test/CMakeLists.txt create mode 100644 install_test/main.cpp diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 335066c02..28cebd8a0 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -157,6 +157,7 @@ jobs: esac export benchmark_ROOT=$PWD/opt/benchmark + export DDC_ROOT=$PWD/opt/ddc export GTest_ROOT=$PWD/opt/gtest export Kokkos_ROOT=$PWD/opt/kokkos export KokkosFFT_ROOT=$PWD/opt/kokkos-fft @@ -250,6 +251,15 @@ jobs: ./build/examples/characteristics_advection ;; esac + + cmake --install build --prefix $DDC_ROOT + rm -rf build + cmake \ + -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \ + -B build \ + -S /src/install_test + cmake --build build --parallel 2 + EOF docker run \ --cidfile='docker.cid' \ diff --git a/CMakeLists.txt b/CMakeLists.txt index cffa0a609..79f1b5152 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -159,6 +159,7 @@ if("${DDC_BUILD_KERNELS_FFT}") endif() target_link_libraries(DDC INTERFACE KokkosFFT::fft) + target_compile_definitions(DDC INTERFACE "DDC_BUILD_KERNELS_FFT") endif() if("${DDC_BUILD_KERNELS_SPLINES}") @@ -170,6 +171,9 @@ if("${DDC_BUILD_KERNELS_SPLINES}") find_package(LAPACKE REQUIRED) target_link_libraries(DDC INTERFACE ${LAPACKE_LIBRARIES}) target_include_directories(DDC SYSTEM INTERFACE ${LAPACKE_INCLUDE_DIRS}) + install( + FILES cmake/FindLAPACKE.cmake + DESTINATION lib/cmake/DDC) # Kokkos-kernels set(DDC_KokkosKernels_DEPENDENCY_POLICY "AUTO" CACHE STRING "Policy to find the `KokkosKernels` package. Options: ${DDC_DEPENDENCY_POLICIES}") @@ -188,6 +192,7 @@ if("${DDC_BUILD_KERNELS_SPLINES}") endif() target_link_libraries(DDC INTERFACE Kokkos::kokkoskernels) + target_compile_definitions(DDC INTERFACE "DDC_BUILD_KERNELS_SPLINES") endif() ## The PDI wrapper diff --git a/cmake/DDCConfig.cmake.in b/cmake/DDCConfig.cmake.in index 649505306..46b1ea49d 100644 --- a/cmake/DDCConfig.cmake.in +++ b/cmake/DDCConfig.cmake.in @@ -6,10 +6,25 @@ include(CMakeFindDependencyMacro) +set(DDC_BUILD_DOUBLE_PRECISION @DDC_BUILD_DOUBLE_PRECISION@) +set(DDC_BUILD_KERNELS_FFT @DDC_BUILD_KERNELS_FFT@) +set(DDC_BUILD_KERNELS_SPLINES @DDC_BUILD_KERNELS_SPLINES@) +set(DDC_BUILD_PDI_WRAPPER @DDC_BUILD_PDI_WRAPPER@) + +find_package(Kokkos 4.4...4.5 CONFIG) + if(@DDC_BUILD_KERNELS_FFT@) find_dependency(KokkosFFT 0.2.1...<1 CONFIG) endif() +if(@DDC_BUILD_KERNELS_SPLINES@) + find_dependency(Ginkgo 1.8.0 EXACT) + list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) + find_dependency(LAPACKE) + list(POP_FRONT CMAKE_MODULE_PATH) + find_dependency(KokkosKernels) +endif() + if(@DDC_BUILD_PDI_WRAPPER@) find_dependency(PDI COMPONENTS C) endif() diff --git a/install_test/CMakeLists.txt b/install_test/CMakeLists.txt new file mode 100644 index 000000000..ccd6436fd --- /dev/null +++ b/install_test/CMakeLists.txt @@ -0,0 +1,17 @@ +# Copyright (C) The DDC development team, see COPYRIGHT.md file +# +# SPDX-License-Identifier: MIT + +cmake_minimum_required(VERSION 3.22) +project(test-installed-ddc LANGUAGES CXX) + +find_package(DDC REQUIRED) + +message("DDC options:") +message("DDC_BUILD_DOUBLE_PRECISION=${DDC_BUILD_DOUBLE_PRECISION}") +message("DDC_BUILD_KERNELS_FFT=${DDC_BUILD_KERNELS_FFT}") +message("DDC_BUILD_KERNELS_SPLINES=${DDC_BUILD_KERNELS_SPLINES}") +message("DDC_BUILD_PDI_WRAPPER=${DDC_BUILD_PDI_WRAPPER}") + +add_executable(main main.cpp) +target_link_libraries(main PRIVATE DDC::DDC DDC::PDI_Wrapper) diff --git a/install_test/main.cpp b/install_test/main.cpp new file mode 100644 index 000000000..092ee534c --- /dev/null +++ b/install_test/main.cpp @@ -0,0 +1,28 @@ +// Copyright (C) The DDC development team, see COPYRIGHT.md file +// +// SPDX-License-Identifier: MIT + +#include + +#if defined(DDC_BUILD_KERNELS_FFT) +#include +#else +#error +#endif + +#if defined(DDC_BUILD_KERNELS_SPLINES) +#include +#else +#error +#endif + +#if defined(DDC_BUILD_PDI_WRAPPER) +#include +#else +#error +#endif + +int main() +{ + return 0; +} From 41c27ad0dd3b23b8bd5ae00b6e6dde8d7f9a188f Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Tue, 22 Oct 2024 12:11:51 +0200 Subject: [PATCH 2/4] Patch for rocm 5.7 --- .github/workflows/tests.yml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 28cebd8a0..912982fe4 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -128,6 +128,14 @@ jobs: cat<<-'EOF' > run.sh set -xe git config --global --add safe.directory '*' + + export benchmark_ROOT=$PWD/opt/benchmark + export DDC_ROOT=$PWD/opt/ddc + export GTest_ROOT=$PWD/opt/gtest + export Kokkos_ROOT=$PWD/opt/kokkos + export KokkosFFT_ROOT=$PWD/opt/kokkos-fft + export KokkosKernels_ROOT=$PWD/opt/kokkos-kernels + case "${{matrix.backend}}" in 'cuda') export CC=${CUDA_GCC} @@ -137,7 +145,7 @@ jobs: 'hip') export CC=hipcc export CXX=hipcc - export CMAKE_PREFIX_PATH=/opt/rocm + export CMAKE_PREFIX_PATH="/opt/rocm:$benchmark_ROOT:$DDC_ROOT:$GTest_ROOT:$Kokkos_ROOT:$KokkosFFT_ROOT:$KokkosKernels_ROOT" EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=ON -DKokkos_ENABLE_ROCTHRUST=OFF -DKokkos_ARCH_AMD_GFX90A=ON" ;; 'cpu-clang') @@ -156,13 +164,6 @@ jobs: ;; esac - export benchmark_ROOT=$PWD/opt/benchmark - export DDC_ROOT=$PWD/opt/ddc - export GTest_ROOT=$PWD/opt/gtest - export Kokkos_ROOT=$PWD/opt/kokkos - export KokkosFFT_ROOT=$PWD/opt/kokkos-fft - export KokkosKernels_ROOT=$PWD/opt/kokkos-kernels - cmake \ -DCMAKE_BUILD_TYPE=${{matrix.cmake_build_type}} \ -DCMAKE_CXX_STANDARD=${{matrix.cxx_version}} \ From 47ada334af847d5288ab2366adb9f1e56dab2e33 Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Wed, 23 Oct 2024 23:12:22 +0200 Subject: [PATCH 3/4] Review from cedricchevalier19 --- .github/workflows/tests.yml | 2 ++ cmake/DDCConfig.cmake.in | 7 +++++-- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 912982fe4..1374f67d9 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -145,6 +145,8 @@ jobs: 'hip') export CC=hipcc export CXX=hipcc + # We extend the CMAKE_PREFIX_PATH with the content of _ROOT variables to support + # rocm 5.7. (likely due to a cmake_minimum_required(VERSION 3.3)) export CMAKE_PREFIX_PATH="/opt/rocm:$benchmark_ROOT:$DDC_ROOT:$GTest_ROOT:$Kokkos_ROOT:$KokkosFFT_ROOT:$KokkosKernels_ROOT" EXTRA_CMAKE_FLAGS="-DKokkos_ENABLE_HIP=ON -DKokkos_ENABLE_HIP_RELOCATABLE_DEVICE_CODE=ON -DKokkos_ENABLE_ROCTHRUST=OFF -DKokkos_ARCH_AMD_GFX90A=ON" ;; diff --git a/cmake/DDCConfig.cmake.in b/cmake/DDCConfig.cmake.in index 46b1ea49d..9f90bbf39 100644 --- a/cmake/DDCConfig.cmake.in +++ b/cmake/DDCConfig.cmake.in @@ -11,14 +11,17 @@ set(DDC_BUILD_KERNELS_FFT @DDC_BUILD_KERNELS_FFT@) set(DDC_BUILD_KERNELS_SPLINES @DDC_BUILD_KERNELS_SPLINES@) set(DDC_BUILD_PDI_WRAPPER @DDC_BUILD_PDI_WRAPPER@) -find_package(Kokkos 4.4...4.5 CONFIG) +find_package(Kokkos 4.4...4.5) if(@DDC_BUILD_KERNELS_FFT@) - find_dependency(KokkosFFT 0.2.1...<1 CONFIG) + find_dependency(KokkosFFT 0.2.1...<1) endif() if(@DDC_BUILD_KERNELS_SPLINES@) find_dependency(Ginkgo 1.8.0 EXACT) + # DDC installs a FindLAPACKE.cmake file. + # We choose to rely on it by prepending to CMAKE_MODULE_PATH + # only the time of calling find_dependency. list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}) find_dependency(LAPACKE) list(POP_FRONT CMAKE_MODULE_PATH) From 6c046294630a4f1f42dc8b6a185169f85d9529bd Mon Sep 17 00:00:00 2001 From: Thomas Padioleau Date: Thu, 24 Oct 2024 15:12:45 +0200 Subject: [PATCH 4/4] Review from yasahi-hpc --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 1374f67d9..143d41fdc 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -16,7 +16,7 @@ jobs: - uses: actions/checkout@v4 - uses: DoozyX/clang-format-lint-action@v0.18 with: - source: 'benchmarks/ examples/ include/ddc/ tests/' + source: 'benchmarks/ examples/ include/ddc/ install_test/ tests/' exclude: '' extensions: 'hpp,cpp' clangFormatVersion: 18