Skip to content

Commit

Permalink
CMake: Support "mpirun=max" statement
Browse files Browse the repository at this point in the history
  • Loading branch information
tamiko committed Feb 9, 2022
1 parent 87daf61 commit 7940075
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions cmake/macros/macro_deal_ii_add_test.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()

#
Expand Down

0 comments on commit 7940075

Please sign in to comment.