From 7619ab36e78240d51d634cf7c29f2b6d3aa63105 Mon Sep 17 00:00:00 2001 From: bangerth Date: Wed, 30 Apr 2014 13:41:30 +0000 Subject: [PATCH] Limit concurrency for non-MPI tests. git-svn-id: https://svn.dealii.org/trunk@32867 0785d39b-7218-0410-832d-ea1e28bc413d --- tests/tests.h | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) 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 -- 2.39.5