From ad7c7a017f6fec25ca75688377143d31b3c26d0e Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Thu, 2 Feb 2023 09:54:12 -0700 Subject: [PATCH 1/3] Use the options ENABLE_PERFTEST, ENABLE_EXAMPLES The cmake options KokkosKernels_ENABLE_PERFTESTS and KokkosKernels_ENABLE_EXAMPLES were not actually used, both perf_test/ and example/ were always built as long as KokkosKernels_ENABLE_ALL_COMPONENTS=ON. This makes these options have an effect again. If perftests or examples are enabled but ENABLE_ALL_COMPONENTS=OFF, print a message about why they can't actually be enabled. --- CMakeLists.txt | 19 ++++++++++++++++--- 1 file changed, 16 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 443b124cb2..a7533bda72 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -66,7 +66,7 @@ IF (NOT KOKKOSKERNELS_HAS_TRILINOS) "ENABLE_PERFTESTS" ON BOOL - "Whether to build performance tests. Default: OFF" + "Whether to build performance tests. Default: ON" ) KOKKOSKERNELS_ADD_OPTION( "ENABLE_TESTS_AND_PERFSUITE" @@ -383,10 +383,23 @@ ELSE() KOKKOSKERNELS_ADD_TEST_DIRECTORIES(sparse/unit_test) ENDIF() IF (KokkosKernels_ENABLE_ALL_COMPONENTS) - KOKKOSKERNELS_ADD_TEST_DIRECTORIES(perf_test) - KOKKOSKERNELS_ADD_EXAMPLE_DIRECTORIES(example) + IF (KokkosKernels_ENABLE_PERFTESTS) + MESSAGE(STATUS "Enabling perf tests.") + KOKKOSKERNELS_ADD_TEST_DIRECTORIES(perf_test) + ENDIF () + IF (KokkosKernels_ENABLE_EXAMPLES) + MESSAGE(STATUS "Enabling examples.") + KOKKOSKERNELS_ADD_EXAMPLE_DIRECTORIES(example) + ENDIF () ENDIF() + IF (NOT KokkosKernels_ENABLE_ALL_COMPONENTS AND KokkosKernels_ENABLE_PERFTESTS) + MESSAGE(STATUS "Could not enable perf tests because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF") + ENDIF () + IF (NOT KokkosKernels_ENABLE_ALL_COMPONENTS AND KokkosKernels_ENABLE_EXAMPLES) + MESSAGE(STATUS "Could not enable examples because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF") + ENDIF () + KOKKOSKERNELS_PACKAGE_POSTPROCESS() IF (KokkosKernels_ENABLE_DOCS) ADD_SUBDIRECTORY(docs) From 926524583db5044e874cbc3c056fb98fb52bdffc Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Thu, 2 Feb 2023 10:44:24 -0700 Subject: [PATCH 2/3] From e10harvey: fix typo in perf_test cmake --- perf_test/CMakeLists.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/perf_test/CMakeLists.txt b/perf_test/CMakeLists.txt index bc638b64c1..28752e9c6c 100644 --- a/perf_test/CMakeLists.txt +++ b/perf_test/CMakeLists.txt @@ -28,7 +28,7 @@ if (KokkosKernels_ENABLE_PERFTESTS) KOKKOSKERNELS_INCLUDE_DIRECTORIES(sparse) - if(Kokkos_ENABLE_TESTS_AND_PERFSUITE) + if(KokkosKernels_ENABLE_TESTS_AND_PERFSUITE) #Add RPS implementations of KK perf tests here KOKKOSKERNELS_ADD_EXECUTABLE( tracked_testing From cb44e117a6a5f9647c26820b4c782d65e5f23d0b Mon Sep 17 00:00:00 2001 From: Brian Kelley Date: Thu, 2 Feb 2023 11:29:26 -0700 Subject: [PATCH 3/3] Add feedback about cmake - Turn ENABLE_PERFTESTS off by default - since both examples and perf tests are off by default, warn if those are ON but can't be enabled because ENABLE_ALL_COMPONENTS=OFF - use ELSE to simplify logic where ENABLE_ALL_COMPONENTS=OFF --- CMakeLists.txt | 20 +++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a7533bda72..9d685e648e 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -64,9 +64,9 @@ IF (NOT KOKKOSKERNELS_HAS_TRILINOS) ) KOKKOSKERNELS_ADD_OPTION( "ENABLE_PERFTESTS" - ON + OFF BOOL - "Whether to build performance tests. Default: ON" + "Whether to build performance tests. Default: OFF" ) KOKKOSKERNELS_ADD_OPTION( "ENABLE_TESTS_AND_PERFSUITE" @@ -391,13 +391,15 @@ ELSE() MESSAGE(STATUS "Enabling examples.") KOKKOSKERNELS_ADD_EXAMPLE_DIRECTORIES(example) ENDIF () - ENDIF() - - IF (NOT KokkosKernels_ENABLE_ALL_COMPONENTS AND KokkosKernels_ENABLE_PERFTESTS) - MESSAGE(STATUS "Could not enable perf tests because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF") - ENDIF () - IF (NOT KokkosKernels_ENABLE_ALL_COMPONENTS AND KokkosKernels_ENABLE_EXAMPLES) - MESSAGE(STATUS "Could not enable examples because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF") + ELSE () + # ENABLE_ALL_COMPONENTS is OFF, 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") + ENDIF () + IF (KokkosKernels_ENABLE_EXAMPLES) + MESSAGE(WARNING "Could not enable examples because KokkosKernels_ENABLE_ALL_COMPONENTS=OFF") + ENDIF () ENDIF () KOKKOSKERNELS_PACKAGE_POSTPROCESS()