From 8ac1d4f7c16209a68a56d5ecda9591b1680f80f2 Mon Sep 17 00:00:00 2001 From: Timo Heister Date: Fri, 8 Nov 2019 14:25:49 -0500 Subject: [PATCH] remove TimerOutput error spam 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 | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/source/base/timer.cc b/source/base/timer.cc index 1e7cedd05b..f83ba7d1a6 100644 --- a/source/base/timer.cc +++ b/source/base/timer.cc @@ -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 { -- 2.39.5