Skip to content

Commit

Permalink
Improve cmake workaround for rocm <6
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau committed Dec 15, 2024
1 parent b7205a5 commit 6e9fa5f
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 11 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,6 @@ 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"
;;
'cpu-clang')
Expand Down
22 changes: 14 additions & 8 deletions cmake/DDCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -4,29 +4,35 @@

@PACKAGE_INIT@

include(CMakeFindDependencyMacro)
# Workaround for rocm <6 setting a cmake_minimum_required <3.12.
# When redefining `find_dependency` we get a better chance
# to use the NEW policy for CMP0074.
macro(ddc_find_dependency)
include(CMakeFindDependencyMacro)
find_dependency(${ARGN})
endmacro()

set(DDC_BUILD_DOUBLE_PRECISION @DDC_BUILD_DOUBLE_PRECISION@)

find_package(Kokkos 4.4...4.5)
ddc_find_dependency(Kokkos 4.4...4.5)

if(@DDC_BUILD_KERNELS_FFT@)
find_dependency(KokkosFFT 0.2.1...<1)
ddc_find_dependency(KokkosFFT 0.2.1...<1)
endif()

if(@DDC_BUILD_KERNELS_SPLINES@)
find_dependency(Ginkgo 1.8.0 EXACT)
ddc_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.
# only the time of calling ddc_find_dependency.
list(PREPEND CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR})
find_dependency(LAPACKE)
ddc_find_dependency(LAPACKE)
list(POP_FRONT CMAKE_MODULE_PATH)
find_dependency(KokkosKernels)
ddc_find_dependency(KokkosKernels)
endif()

if(@DDC_BUILD_PDI_WRAPPER@)
find_dependency(PDI COMPONENTS C)
ddc_find_dependency(PDI COMPONENTS C)
endif()

include(${CMAKE_CURRENT_LIST_DIR}/DDCTargets.cmake)
Expand Down

0 comments on commit 6e9fa5f

Please sign in to comment.