From: Wolfgang Bangerth Date: Wed, 30 Apr 2014 13:41:30 +0000 (+0000) Subject: Limit concurrency for non-MPI tests. X-Git-Tag: v8.2.0-rc1~529 X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=467a6aee492870dc40987995bd3c1b8b173d5f49;p=dealii.git Limit concurrency for non-MPI tests. git-svn-id: https://svn.dealii.org/trunk@32867 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/tests/tests.h b/tests/tests.h index 0760341b2f..ef37ca2046 100644 --- a/tests/tests.h +++ b/tests/tests.h @@ -25,6 +25,7 @@ #include #include #include +#include #include #include #include @@ -147,6 +148,29 @@ void unify_pretty_function (const std::string &filename) // ------------------------------ Functions used in initializing subsystems ------------------- +/* + * If we run 64 tests at the same time on a 64-core system, and + * each of them runs 64 threads, then we get astronomical loads. + * Limit concurrency to a fixed (small) number of threads, independent + * of the core count. + * + * Note that we can't do this if we run in MPI mode because then + * MPI_InitFinalize already calls this function. Since every test + * calls MPI_InitFinalize itself, we can't adjust the thread count + * for this here. + */ +#ifndef DEAL_II_WITH_MPI +struct LimitConcurrency +{ + LimitConcurrency () + { + multithread_info.set_thread_limit (5); + } +} limit_concurrency; +#endif + + + #ifdef DEAL_II_WITH_PETSC #include