Skip to content

Commit

Permalink
Check also Kokkos options when DDC is installed (#744)
Browse files Browse the repository at this point in the history
  • Loading branch information
tpadioleau authored Jan 7, 2025
1 parent a6d8774 commit 557dd5b
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 11 deletions.
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ set(DDC_INSTALL_INCLUDEDIR ${CMAKE_INSTALL_INCLUDEDIR})

## Custom cmake modules
list(APPEND CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/cmake")
include(DDCCheckRequiredKokkosOptions)
include(DDCVendorConfiguration)

## kokkos
Expand Down Expand Up @@ -299,6 +300,7 @@ write_basic_package_version_file(

install(
FILES
cmake/DDCCheckRequiredKokkosOptions.cmake
${CMAKE_CURRENT_BINARY_DIR}/DDCConfig.cmake
${CMAKE_CURRENT_BINARY_DIR}/DDCConfigVersion.cmake
DESTINATION ${DDC_INSTALL_CMAKEDIR}
Expand Down
14 changes: 14 additions & 0 deletions cmake/DDCCheckRequiredKokkosOptions.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Copyright (C) The DDC development team, see COPYRIGHT.md file
#
# SPDX-License-Identifier: MIT

function(ddc_check_required_kokkos_options)
kokkos_check(DEVICES CUDA RETURN_VALUE is_cuda_enabled)
if("${is_cuda_enabled}")
kokkos_check(OPTIONS CUDA_CONSTEXPR CUDA_RELOCATABLE_DEVICE_CODE)
endif()
kokkos_check(DEVICES HIP RETURN_VALUE is_hip_enabled)
if("${is_hip_enabled}")
kokkos_check(OPTIONS HIP_RELOCATABLE_DEVICE_CODE)
endif()
endfunction()
3 changes: 3 additions & 0 deletions cmake/DDCConfig.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@ set(DDC_BUILD_DOUBLE_PRECISION @DDC_BUILD_DOUBLE_PRECISION@)

ddc_find_dependency(Kokkos 4.4...<5)

include(${CMAKE_CURRENT_LIST_DIR}/DDCCheckRequiredKokkosOptions.cmake)
ddc_check_required_kokkos_options()

if(@DDC_BUILD_KERNELS_FFT@)
ddc_find_dependency(KokkosFFT 0.2.1...<1)
endif()
Expand Down
11 changes: 0 additions & 11 deletions cmake/DDCVendorConfiguration.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -42,17 +42,6 @@ macro(ddc_configure_kokkos)
add_subdirectory(vendor/kokkos)
endmacro()

function(ddc_check_required_kokkos_options)
kokkos_check(DEVICES CUDA RETURN_VALUE is_cuda_enabled)
if("${is_cuda_enabled}")
kokkos_check(OPTIONS CUDA_CONSTEXPR CUDA_RELOCATABLE_DEVICE_CODE)
endif()
kokkos_check(DEVICES HIP RETURN_VALUE is_hip_enabled)
if("${is_hip_enabled}")
kokkos_check(OPTIONS HIP_RELOCATABLE_DEVICE_CODE)
endif()
endfunction()

macro(ddc_configure_kokkos_fft)
option(KokkosFFT_ENABLE_HOST_AND_DEVICE "Enable FFT on both host and device" ON)
add_subdirectory(vendor/kokkos-fft)
Expand Down

0 comments on commit 557dd5b

Please sign in to comment.