# - Specifies the maximal number of worker threads that can should be
# used by the threading backend. Note that individual tests might
# exceed this limit by calling MultithreadInfo::set_thread_limit(), or
-# by manually creating additional threads. Defaults to 3.
+# by manually creating additional threads. The special value 0
+# enforces no limit. Defaults to 0.
#
# Usage:
# DEAL_II_ADD_TEST(category test_name comparison_file)
ENDIF()
#
- # If we encountered the special string "mpirun=max" set the number of MPI
+ # If we encounter 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.
RETURN()
ENDIF()
+ #
+ # Determine whether the test declaration specifies a thread pool size via
+ # threads=N:
+ #
+ STRING(REGEX MATCH "threads=([0-9]+|max)" _n_threads ${_file})
+ IF("${_n_threads}" STREQUAL "")
+ SET(_n_threads 0) # 0 indicates that the default thread pool size
+ # should be used (currently set to 3 in tests.h)
+ ELSE()
+ STRING(REGEX REPLACE "^threads=([0-9]+|max)$" "\\1" _n_threads ${_n_threads})
+ ENDIF()
+
+ #
+ # If we encounter the special string "threads=max" set the number of
+ # threads of the threading pool to the maximum number of allowed threads.
+ # If no limit has been specified, i.e., TEST_THREAD_LIMIT is 0, skip
+ # defining the test.
+ #
+ IF("${_n_threads}" STREQUAL "max")
+ IF(TEST_THREAD_LIMIT EQUAL 0)
+ RETURN()
+ ENDIF()
+ SET(_n_threads "${TEST_THREAD_LIMIT}")
+ ENDIF()
+
+ #
+ # If the number of threads specified for the test via .threads=N. exceeds
+ # the limit ${TEST_THREAD_LIMIT}, skip defining the test
+ #
+ IF(TEST_THREAD_LIMIT GREATER 0 AND _n_threads GREATER TEST_THREAD_LIMIT)
+ RETURN()
+ ENDIF()
+
#
# Determine the expected build stage of this test:
#
#
ADD_CUSTOM_COMMAND(OUTPUT ${_test_directory}/output
- COMMAND TEST_THREAD_LIMIT=${TEST_THREAD_LIMIT}
+ COMMAND TEST_N_THREADS=${_n_threads}
sh ${DEAL_II_PATH}/${DEAL_II_SHARE_RELDIR}/scripts/run_test.sh
run "${_test_full}" ${_run_args}
COMMAND ${PERL_EXECUTABLE}
# - Specifies the maximal number of worker threads that can should be
# used by the threading backend. Note that individual tests might
# exceed this limit by calling MultithreadInfo::set_thread_limit(),
-# or by manually creating additional threads. Defaults to 3.
+# or by manually creating additional threads. The special value 0
+# enforces no limit. Defaults to 0.
#
# TEST_PICKUP_REGEX
# - A regular expression to select only a subset of tests during setup.
SET_IF_EMPTY(TEST_MPI_RANK_LIMIT 0)
SET_IF_EMPTY(TEST_THREAD_LIMIT "$ENV{TEST_THREAD_LIMIT}")
- SET_IF_EMPTY(TEST_THREAD_LIMIT 3)
+ SET_IF_EMPTY(TEST_THREAD_LIMIT 0)
#
# ... and finally pick up tests:
# failing_output
##
- # Limit the deal.II thread pool to TEST_THREAD_LIMIT threads.
- export TEST_N_THREADS="${TEST_THREAD_LIMIT}"
+ #
+ # If TEST_N_THREADS is not equal to zero then:
+ # - Export the environment variable DEAL_II_NUM_THREADS set to
+ # $TEST_N_THREADS. This will enforce an upper bound of
+ # DEAL_II_NUM_THREADS during thread initialization of the threading
+ # pool in deal.II.
+ # - Export TEST_N_THREADS which is internally used in the deal.II
+ # testsuite to explicitly set the number of threads in the header
+ # file tests.h.
+ #
+ if [ "${TEST_N_THREADS+0}" -ne 0 ]; then
+ export DEAL_II_NUM_THREADS="${TEST_N_THREADS}"
+ export TEST_N_THREADS
+ fi
# Limit the OpenMP pool to two threads.
export OMP_NUM_THREADS="2"
- The time limit (in seconds) a single test is allowed to take. Defaults
to 180 seconds
+TEST_MPI_RANK_LIMIT
+ - Specifies the maximal number of MPI ranks that can be used. If a
+ test variant configures a larger number of MPI ranks (via
+ .mpirun=N. in the output file) than this limit the test will be
+ dropped. The special value 0 enforces no limit. Defaults to 0.
+
+TEST_THREAD_LIMIT
+ - Specifies the maximal number of worker threads that can should be
+ used by the threading backend. Note that individual tests might
+ exceed this limit by calling MultithreadInfo::set_thread_limit(), or
+ by manually creating additional threads. The special value 0
+ enforces no limit. Defaults to 0.
+
TEST_PICKUP_REGEX
- A regular expression to select only a subset of tests during setup.
An empty string is interpreted as a catchall (this is the default).
dropped. The special value 0 enforces no limit. Defaults to 0.
TEST_THREAD_LIMIT
- - Specifies the maximal number of worker threads that can should be used
- by the threading backend. Note that individual tests might exceed this
- limit by calling MultithreadInfo::set_thread_limit(), or by manually
- creating additional threads. Defaults to 3.</pre>
+ - Specifies the maximal number of worker threads that can should be
+ used by the threading backend. Note that individual tests might
+ exceed this limit by calling MultithreadInfo::set_thread_limit(), or
+ by manually creating additional threads. The special value 0
+ enforces no limit. Defaults to 0.</pre>
<hr />
<div class="right">
<a href="http://validator.w3.org/check?uri=referer" target="_top">