From ed2966370feb65557d09b6e264bd773ee966e6af Mon Sep 17 00:00:00 2001 From: Mikael Simberg Date: Wed, 20 Mar 2024 13:17:23 +0100 Subject: [PATCH] Move CMake test options to main CMakeLists.txt to make available for miniapps as well --- CMakeLists.txt | 22 ++++++++++++++++++++++ test/CMakeLists.txt | 19 ------------------- 2 files changed, 22 insertions(+), 19 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 6c1c2edbc1..d8c687f4f5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -217,6 +217,28 @@ add_subdirectory(external) # --------------------------------------------------------------------------- add_subdirectory(src) +# --------------------------------------------------------------------------- +# Test options (apply to unit tests and miniapps as tests) +# --------------------------------------------------------------------------- +set(DLAF_PRESET_OPTIONS "plain-mpi" "slurm" "custom") +set(DLAF_MPI_PRESET "plain-mpi" CACHE STRING "Select a preset to use") +set_property(CACHE DLAF_MPI_PRESET PROPERTY STRINGS ${DLAF_PRESET_OPTIONS}) +option( + DLAF_CI_RUNNER_USES_MPIRUN + "Remove mpiexec command for tests executed by ctest. This option is to be used if the CI runner executes the tests with ctest -L RANK_" + OFF +) + +# On some machines, tests using multiple ranks + oversubscribing run +# significantly faster when threads are not pinned. +option(DLAF_TEST_THREAD_BINDING_ENABLED "If OFF disables pika thread binding." ON) + +# If DLAF_CI_RUNNER_USES_MPIRUN=on we don't want to use any preset, so we just go for the custom one +# without setting any variable. +if(DLAF_CI_RUNNER_USES_MPIRUN) + set(DLAF_MPI_PRESET "custom" CACHE STRING "" FORCE) +endif() + # --------------------------------------------------------------------------- # mini Apps # --------------------------------------------------------------------------- diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 3a18394716..389cb4b0e9 100644 --- a/test/CMakeLists.txt +++ b/test/CMakeLists.txt @@ -8,25 +8,6 @@ # SPDX-License-Identifier: BSD-3-Clause # -set(DLAF_PRESET_OPTIONS "plain-mpi" "slurm" "custom") -set(DLAF_MPI_PRESET "plain-mpi" CACHE STRING "Select a preset to use") -set_property(CACHE DLAF_MPI_PRESET PROPERTY STRINGS ${DLAF_PRESET_OPTIONS}) -option( - DLAF_CI_RUNNER_USES_MPIRUN - "Remove mpiexec command for tests executed by ctest. This option is to be used if the CI runner executes the tests with ctest -L RANK_" - OFF -) - -# On some machines, tests using multiple ranks + oversubscribing run -# significantly faster when threads are not pinned. -option(DLAF_TEST_THREAD_BINDING_ENABLED "If OFF disables pika thread binding." ON) - -# If DLAF_CI_RUNNER_USES_MPIRUN=on we don't want to use any preset, so we just go for the custom one -# without setting any variable. -if(DLAF_CI_RUNNER_USES_MPIRUN) - set(DLAF_MPI_PRESET "custom" CACHE STRING "" FORCE) -endif() - # if a preset has been selected and it has been changed from previous configurations if(NOT DLAF_MPI_PRESET STREQUAL _DLAF_MPI_PRESET)