From 3be1ee50f0e2a61535e8accc524dcdba5bf3b109 Mon Sep 17 00:00:00 2001 From: David Wells Date: Mon, 3 Sep 2018 17:22:01 -0400 Subject: [PATCH] Execute quick tests in parallel. The quick tests are currently set up as a custom target which immediately launches ctest. The difficulty with this is that its not possible (AFAICT) to get the number of jobs available from make at that point, so there is no way to run these in parallel without giving an explicit number of jobs to ctest. This PR sets the number of jobs to the number of CPUs on the machine: while hardcoding this is not ideal, this is the right usage pattern for a build script like make -j20 make test where all processors on the machine should be available. --- doc/news/changes/minor/20180913DavidWells | 8 ++++++++ doc/readme.html | 4 ++-- tests/quick_tests/run.cmake | 13 +++++++++++-- 3 files changed, 21 insertions(+), 4 deletions(-) create mode 100644 doc/news/changes/minor/20180913DavidWells diff --git a/doc/news/changes/minor/20180913DavidWells b/doc/news/changes/minor/20180913DavidWells new file mode 100644 index 0000000000..882500f487 --- /dev/null +++ b/doc/news/changes/minor/20180913DavidWells @@ -0,0 +1,8 @@ +Fixed: make test now runs in parallel automatically (i.e., it uses +a CMake command to determine the number of cores available). Since make +test just immediately invokes ctest as a subprocess, it is +currently not possible to link the number of globally available +make processes with the number of concurrently run tests; i.e., +the number of cores make test uses is not changeable by users. +
+(David Wells, 2018/09/13) diff --git a/doc/readme.html b/doc/readme.html index 6751ee266b..de4c9b9747 100644 --- a/doc/readme.html +++ b/doc/readme.html @@ -183,8 +183,8 @@
  • If your machine has multiple processors, use make - -jN in the last step, where N is the number of simultaneous build processes you want make to use at any given time. Allowing make to use more simultaneous build processes (assuming you have that many processor - cores) will greatly lower the build time. + -jN install in the second to last step instead, where N is the number of simultaneous build processes you want make to use at any given time. Allowing make to use more simultaneous build processes (assuming you have that many processor + cores) will greatly lower the build time. make test automatically runs in parallel and no -jN flag should be supplied to it.
  • If you do not intend to modify the deal.II sources and recompile things, then you can remove the build/ directory after the last step. diff --git a/tests/quick_tests/run.cmake b/tests/quick_tests/run.cmake index 4b4567bce4..4e4c212998 100644 --- a/tests/quick_tests/run.cmake +++ b/tests/quick_tests/run.cmake @@ -13,13 +13,22 @@ ## ## --------------------------------------------------------------------- -# This file is run when "make test" is executed by the user and is +# This file is run when "make test" is executed by the user and is # responsible for running the tests and printing some helpful # error messages. +include(ProcessorCount) +PROCESSORCOUNT(_n_processors) +IF(_n_processors EQUAL 0) + SET(_n_processors "1") +ENDIF() SEPARATE_ARGUMENTS(ALL_TESTS) -EXECUTE_PROCESS(COMMAND ${CMAKE_CTEST_COMMAND} --force-new-ctest-process --output-on-failure -O quicktests.log RESULT_VARIABLE res_var) +EXECUTE_PROCESS(COMMAND ${CMAKE_CTEST_COMMAND} -j${_n_processors} + --force-new-ctest-process + --output-on-failure + -O quicktests.log + RESULT_VARIABLE res_var) IF(NOT "${res_var}" STREQUAL "0") MESSAGE(" -- 2.39.5