]> https://gitweb.dealii.org/ - dealii.git/commitdiff
Limit concurrency for non-MPI tests.
authorWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 30 Apr 2014 13:41:30 +0000 (13:41 +0000)
committerWolfgang Bangerth <bangerth@math.tamu.edu>
Wed, 30 Apr 2014 13:41:30 +0000 (13:41 +0000)
git-svn-id: https://svn.dealii.org/trunk@32867 0785d39b-7218-0410-832d-ea1e28bc413d

tests/tests.h

index 0760341b2f0c41d0b330fd2d3a7c1cff5af32bdb..ef37ca2046a016c9758b4900e5b45f7f451029db 100644 (file)
@@ -25,6 +25,7 @@
 #include <deal.II/base/exceptions.h>
 #include <deal.II/base/utilities.h>
 #include <deal.II/base/thread_management.h>
+#include <deal.II/base/multithread_info.h>
 #include <cmath>
 #include <cstdlib>
 #include <fstream>
@@ -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 <petscsys.h>
 

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.