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

Introduce KOKKOSKERNELS_ALL_COMPONENTS_ENABLED variable #1691

Merged
merged 1 commit into from
Feb 28, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
8 changes: 4 additions & 4 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ ELSE()
IF (KokkosKernels_ENABLE_COMPONENT_SPARSE)
KOKKOSKERNELS_ADD_TEST_DIRECTORIES(sparse/unit_test)
ENDIF()
IF (KokkosKernels_ENABLE_ALL_COMPONENTS)
IF (KOKKOSKERNELS_ALL_COMPONENTS_ENABLED)
IF (KokkosKernels_ENABLE_PERFTESTS)
MESSAGE(STATUS "Enabling perf tests.")
KOKKOSKERNELS_ADD_TEST_DIRECTORIES(perf_test)
Expand All @@ -400,13 +400,13 @@ ELSE()
KOKKOSKERNELS_ADD_EXAMPLE_DIRECTORIES(example)
ENDIF ()
ELSE ()
# ENABLE_ALL_COMPONENTS is OFF, so perftests and examples can't be enabled.
# all components were not enabled, so perftests and examples can't be enabled.
# Warn if they were requested.
IF (KokkosKernels_ENABLE_PERFTESTS)
MESSAGE(WARNING "Could not enable perf tests because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF")
MESSAGE(WARNING "Could not enable perf tests because not all components were enabled")
ENDIF ()
IF (KokkosKernels_ENABLE_EXAMPLES)
MESSAGE(WARNING "Could not enable examples because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF")
MESSAGE(WARNING "Could not enable examples because not all components were enabled")
ENDIF ()
ENDIF ()

Expand Down
27 changes: 15 additions & 12 deletions cmake/kokkoskernels_components.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -45,14 +45,6 @@ KOKKOSKERNELS_ADD_OPTION(
"Whether to build the graph component. Default: OFF"
)

# The user requested individual components,
# the assumption is that a full build is not
# desired and ENABLE_ALL_COMPONENETS is turned
# off.
IF (KokkosKernels_ENABLE_COMPONENT_BATCHED OR KokkosKernels_ENABLE_COMPONENT_BLAS
OR KokkosKernels_ENABLE_COMPONENT_GRAPH OR KokkosKernels_ENABLE_COMPONENT_SPARSE)
SET(KokkosKernels_ENABLE_ALL_COMPONENTS OFF CACHE BOOL "" FORCE)
ENDIF()

# Graph depends on everything else because it depends
# on Sparse at the moment, breaking that dependency will
Expand All @@ -72,13 +64,24 @@ IF (KokkosKernels_ENABLE_COMPONENT_SPARSE)
SET(KokkosKernels_ENABLE_COMPONENT_GRAPH ON CACHE BOOL "" FORCE)
ENDIF()

# At this point, if ENABLE_ALL_COMPONENTS is
# still ON we need to enable all individual
# components as they are required for this
# build.
# If user requested to enable all components, enable all components
IF (KokkosKernels_ENABLE_ALL_COMPONENTS)
SET(KokkosKernels_ENABLE_COMPONENT_BATCHED ON CACHE BOOL "" FORCE)
SET(KokkosKernels_ENABLE_COMPONENT_BLAS ON CACHE BOOL "" FORCE)
SET(KokkosKernels_ENABLE_COMPONENT_SPARSE ON CACHE BOOL "" FORCE)
SET(KokkosKernels_ENABLE_COMPONENT_GRAPH ON CACHE BOOL "" FORCE)
ENDIF()

# KOKKOSKERNELS_ALL_COMPONENTS_ENABLED says whether all components are on,
# regardless of how this came to be
# this is in the cache so we can use it as a global variable,
# but marking it as advanced should hide it from GUIs
IF ( KokkosKernels_ENABLE_COMPONENT_BATCHED
AND KokkosKernels_ENABLE_COMPONENT_BLAS
AND KokkosKernels_ENABLE_COMPONENT_GRAPH
AND KokkosKernels_ENABLE_COMPONENT_SPARSE)
SET(KOKKOSKERNELS_ALL_COMPONENTS_ENABLED ON CACHE BOOL "" FORCE)
ELSE()
SET(KOKKOSKERNELS_ALL_COMPONENTS_ENABLED OFF CACHE BOOL "" FORCE)
ENDIF()
mark_as_advanced(FORCE KOKKOSKERNELS_ALL_COMPONENTS_ENABLED)