]> https://gitweb.dealii.org/ - dealii.git/commitdiff
remove TimerOutput error spam 9025/head
authorTimo Heister <timo.heister@gmail.com>
Fri, 8 Nov 2019 19:25:49 +0000 (14:25 -0500)
committerTimo Heister <timo.heister@gmail.com>
Fri, 8 Nov 2019 19:25:49 +0000 (14:25 -0500)
TimerOutput produces output on each MPI rank when an exception is
thrown. This makes looking at output with 100k MPI ranks somewhat
annoying. Fix this by only outputting on rank 0.
This assumes that also rank 0 triggers this exception, which might not
be true. In that case, we would likely deadlock anyways...

source/base/timer.cc

index 1e7cedd05b0c05e8d3441d78918f2eb2734928c0..f83ba7d1a6ba186c145d1b3a197ca881a8349d19 100644 (file)
@@ -389,18 +389,18 @@ TimerOutput::~TimerOutput()
   if (std::uncaught_exception() == true && mpi_communicator != MPI_COMM_SELF)
 #  endif
     {
-      std::cerr << "---------------------------------------------------------"
-                << std::endl
-                << "TimerOutput objects finalize timed values printed to the"
-                << std::endl
-                << "screen by communicating over MPI in their destructors."
-                << std::endl
-                << "Since an exception is currently uncaught, this" << std::endl
-                << "synchronization (and subsequent output) will be skipped to"
-                << std::endl
-                << "avoid a possible deadlock." << std::endl
-                << "---------------------------------------------------------"
-                << std::endl;
+      const unsigned int myid =
+        Utilities::MPI::this_mpi_process(mpi_communicator);
+      if (myid == 0)
+        std::cerr
+          << "---------------------------------------------------------\n"
+          << "TimerOutput objects finalize timed values printed to the\n"
+          << "screen by communicating over MPI in their destructors.\n"
+          << "Since an exception is currently uncaught, this\n"
+          << "synchronization (and subsequent output) will be skipped\n"
+          << "to avoid a possible deadlock.\n"
+          << "---------------------------------------------------------"
+          << std::endl;
     }
   else
     {

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.