]> https://gitweb.dealii.org/ - dealii.git/commitdiff
CMake: Support "mpirun=max" statement
authorMatthias Maier <tamiko@43-1.org>
Wed, 9 Feb 2022 00:37:20 +0000 (18:37 -0600)
committerMatthias Maier <tamiko@43-1.org>
Wed, 9 Feb 2022 09:42:45 +0000 (03:42 -0600)
cmake/macros/macro_deal_ii_add_test.cmake

index 427f592761cb5a9ac11d0c0d40e96ff66f52ba19..cb8c5537cce70f00f6f603c6f58a786f6916f7ff 100644 (file)
@@ -113,11 +113,24 @@ FUNCTION(DEAL_II_ADD_TEST _category _test_name _comparison_file)
   #
   # Determine whether the test should be run with mpirun:
   #
-  STRING(REGEX MATCH "mpirun=([0-9]*)" _n_cpu ${_file})
+  STRING(REGEX MATCH "mpirun=([0-9]+|max)" _n_cpu ${_file})
   IF("${_n_cpu}" STREQUAL "")
     SET(_n_cpu 0) # 0 indicates that no mpirun should be used
   ELSE()
-    STRING(REGEX REPLACE "^mpirun=([0-9]*)$" "\\1" _n_cpu ${_n_cpu})
+    STRING(REGEX REPLACE "^mpirun=([0-9]+|max)$" "\\1" _n_cpu ${_n_cpu})
+  ENDIF()
+
+  #
+  # If we encountered the special string "mpirun=max" set the number of MPI
+  # ranks used for the test to the maximum number of allowed ranks. If no
+  # limit has been specified, i.e., TEST_MPI_RANK_LIMIT is 0, skip defining
+  # the test.
+  #
+  IF("${_n_cpu}" STREQUAL "max")
+    IF(TEST_MPI_RANK_LIMIT EQUAL 0)
+      RETURN()
+    ENDIF()
+    SET(_n_cpu "${TEST_MPI_RANK_LIMIT}")
   ENDIF()
 
   #

In the beginning the Universe was created. This has made a lot of people very angry and has been widely regarded as a bad move.

Douglas Adams


Typeset in Trocchi and Trocchi Bold Sans Serif.