Skip to content

Commit

Permalink
Merge pull request #6142 from dalg24/cleanup_exported_kokkos_options
Browse files Browse the repository at this point in the history
Cleanup exported kokkos options
  • Loading branch information
dalg24 authored May 19, 2023
2 parents 87c7be9 + 3f565bb commit 8ede4a4
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 3 deletions.
10 changes: 9 additions & 1 deletion cmake/KokkosConfigCommon.cmake.in
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,18 @@ SET(Kokkos_CXX_COMPILER "@CMAKE_CXX_COMPILER@")
SET(Kokkos_CXX_COMPILER_ID "@KOKKOS_CXX_COMPILER_ID@")
SET(Kokkos_CXX_STANDARD @KOKKOS_CXX_STANDARD@)

# These are needed by KokkosKernels
# Export Kokkos_ENABLE_<BACKEND> for each backend that was enabled.
# NOTE: "Devices" is a little bit of a misnomer here. These are really
# backends, e.g. Kokkos_ENABLE_OPENMP, Kokkos_ENABLE_CUDA, Kokkos_ENABLE_HIP,
# or Kokkos_ENABLE_SYCL.
FOREACH(DEV ${Kokkos_DEVICES})
SET(Kokkos_ENABLE_${DEV} ON)
ENDFOREACH()
# Export relevant Kokkos_ENABLE<OPTION> variables, e.g.
# Kokkos_ENABLE_CUDA_RELOCATABLE_DEVICE_CODE, Kokkos_ENABLE_DEBUG, etc.
FOREACH(OPT ${Kokkos_OPTIONS})
SET(Kokkos_ENABLE_${OPT} ON)
ENDFOREACH()

IF(Kokkos_ENABLE_CUDA)
SET(Kokkos_CUDA_ARCHITECTURES @KOKKOS_CUDA_ARCHITECTURES@)
Expand Down
2 changes: 1 addition & 1 deletion cmake/kokkos_enable_options.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
FUNCTION(KOKKOS_ENABLE_OPTION SUFFIX DEFAULT DOCSTRING)
KOKKOS_OPTION(ENABLE_${SUFFIX} ${DEFAULT} BOOL ${DOCSTRING})
STRING(TOUPPER ${SUFFIX} UC_NAME)
IF (KOKKOS_ENABLE_${UC_NAME})
IF (KOKKOS_ENABLE_${UC_NAME} AND NOT "Kokkos_ENABLE_${UC_NAME}" IN_LIST Kokkos_OPTIONS_NOT_TO_EXPORT)
LIST(APPEND KOKKOS_ENABLED_OPTIONS ${UC_NAME})
#I hate that CMake makes me do this
SET(KOKKOS_ENABLED_OPTIONS ${KOKKOS_ENABLED_OPTIONS} PARENT_SCOPE)
Expand Down
7 changes: 6 additions & 1 deletion cmake/kokkos_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,12 @@
# upper-case version for use within

set(Kokkos_OPTIONS_NOT_TO_EXPORT
Kokkos_ENABLE_TESTS Kokkos_ENABLE_EXAMPLES)
Kokkos_ENABLE_BENCHMARKS
Kokkos_ENABLE_EXAMPLES
Kokkos_ENABLE_TESTS
Kokkos_ENABLE_HEADER_SELF_CONTAINMENT_TESTS
Kokkos_ENABLE_COMPILER_WARNINGS
)

#
#
Expand Down

0 comments on commit 8ede4a4

Please sign in to comment.