Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing dependencies on installed DDC #665

Merged
merged 4 commits into from
Oct 24, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand All @@ -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"
tpadioleau marked this conversation as resolved.
Show resolved Hide resolved
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')
Expand All @@ -156,12 +164,6 @@ jobs:
;;
esac

export benchmark_ROOT=$PWD/opt/benchmark
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}} \
Expand Down Expand Up @@ -250,6 +252,15 @@ jobs:
./build/examples/characteristics_advection
;;
esac

cmake --install build --prefix $DDC_ROOT
rm -rf build
tpadioleau marked this conversation as resolved.
Show resolved Hide resolved
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' \
Expand Down
5 changes: 5 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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}")
Expand All @@ -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}")
Expand All @@ -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
Expand Down
15 changes: 15 additions & 0 deletions cmake/DDCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -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)
tpadioleau marked this conversation as resolved.
Show resolved Hide resolved

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)
tpadioleau marked this conversation as resolved.
Show resolved Hide resolved
find_dependency(KokkosKernels)
endif()

if(@DDC_BUILD_PDI_WRAPPER@)
find_dependency(PDI COMPONENTS C)
endif()
Expand Down
17 changes: 17 additions & 0 deletions install_test/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -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)
28 changes: 28 additions & 0 deletions install_test/main.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// Copyright (C) The DDC development team, see COPYRIGHT.md file
//
// SPDX-License-Identifier: MIT

#include <ddc/ddc.hpp>

#if defined(DDC_BUILD_KERNELS_FFT)
#include <ddc/kernels/fft.hpp>
#else
#error
#endif

#if defined(DDC_BUILD_KERNELS_SPLINES)
#include <ddc/kernels/splines.hpp>
#else
#error
#endif

#if defined(DDC_BUILD_PDI_WRAPPER)
#include <ddc/pdi.hpp>
#else
#error
#endif

int main()
{
return 0;
}