From 929783ddcffe233a63f28f83ce659f9c69ad71b8 Mon Sep 17 00:00:00 2001 From: Florian Uhlig <florian.uhlig@googlemail.com> Date: Tue, 17 Dec 2024 09:50:53 +0000 Subject: [PATCH] Add possibility to define number of cpus for tests When running the Dart.sh script normally all available cores are used which works well in most cases. Up to now it was possible to limit the number of used cores by defining the environment variable NCPU which was used for the build as well as the test stage. Depending on the system this resulted in a large number of tests which ran into timeouts which were not seen when running the tests sequentially. With this commit it becomes possible to limit the used cores during the test stage independently. This is done by defining the environent variable NCPU4TEST. --- CbmRoot_test.cmake | 5 ++++- Dart.sh | 11 +++++++++-- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CbmRoot_test.cmake b/CbmRoot_test.cmake index 14c9de60e2..7c0eef2e0c 100644 --- a/CbmRoot_test.cmake +++ b/CbmRoot_test.cmake @@ -33,6 +33,9 @@ Set(CTEST_BUILD_COMMAND "${BUILD_COMMAND} -i -k -j$ENV{number_of_processors}") #Include(CbmMacros) #FairRootVersion() +message("Compiling with $ENV{number_of_processors} jobs in parallel.") +message("Testing with $ENV{number_of_processors_for_test} jobs in parallel.") + Set(CTEST_USE_LAUNCHERS 1) If(${CBM_TEST_MODEL} MATCHES MergeRequest OR ${CBM_TEST_MODEL} MATCHES Continuous) @@ -139,7 +142,7 @@ If(NOT _RETVAL) EndIf() Ctest_Test(BUILD "${CTEST_BINARY_DIRECTORY}" - PARALLEL_LEVEL $ENV{number_of_processors} + PARALLEL_LEVEL $ENV{number_of_processors_for_test} ${repeat} ${stop_time} RETURN_VALUE _ctest_test_ret_val diff --git a/Dart.sh b/Dart.sh index 4af49c69bc..8fb6f6874d 100755 --- a/Dart.sh +++ b/Dart.sh @@ -119,15 +119,22 @@ then fi fi +if [ -z $NCPU4TEST ]; then + export number_of_processors_for_test=$number_of_processors +else + export number_of_processors_for_test=$NCPU4TEST +fi + echo "************************" date echo "LABEL: " $LABEL echo "SITE: " $SITE echo "Model: " ${ctest_model} -echo "Nr. of processes: " $number_of_processors +echo "Nr. of processes for build: " $number_of_processors +echo "Nr. of processes for test: " $number_of_processors_for_test echo "************************" cd $SOURCEDIR -ctest -S $SOURCEDIR/CbmRoot_test.cmake -V --VV -DCBM_TEST_MODEL=${ctest_model} +ctest -S $SOURCEDIR/CbmRoot_test.cmake -V -DCBM_TEST_MODEL=${ctest_model} #ctest -S $SOURCEDIR/CbmRoot_test.cmake -V --VV -- GitLab