From: heister Date: Thu, 18 Apr 2013 18:45:56 +0000 (+0000) Subject: fix TimerOutput wall_time in parallel not being synchronized as one expects. X-Git-Url: https://gitweb.dealii.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c0f999cd6fde3ae5ece81f0343044b3e60ddf391;p=dealii-svn.git fix TimerOutput wall_time in parallel not being synchronized as one expects. git-svn-id: https://svn.dealii.org/trunk@29333 0785d39b-7218-0410-832d-ea1e28bc413d --- diff --git a/deal.II/doc/news/changes.h b/deal.II/doc/news/changes.h index 7884f7c326..99f39f441c 100644 --- a/deal.II/doc/news/changes.h +++ b/deal.II/doc/news/changes.h @@ -64,6 +64,13 @@ this function.
    +
  1. Fixed: TimerOutput constructed with an MPI_COMM in wall_time + mode now constructs synchronized Timer objects. This gives reliable + parallel benchmark timings. +
    + (Timo Heister, 2013/04/18) +
  2. +
  3. New: The step-49 tutorial program now also has a discussion on what to do once you have a coarse mesh and want to refine it.
    diff --git a/deal.II/include/deal.II/base/timer.h b/deal.II/include/deal.II/base/timer.h index 9450b20a6d..d9f36d9b7e 100644 --- a/deal.II/include/deal.II/base/timer.h +++ b/deal.II/include/deal.II/base/timer.h @@ -409,6 +409,8 @@ public: */ void enter_section (const std::string §ion_name); + //TODO: make some of these functions DEPRECATED (I would keep enter/exit_section) + /** * Leave a section. If no name is given, * the last section that was entered is diff --git a/deal.II/source/base/timer.cc b/deal.II/source/base/timer.cc index a1be012b22..2c0b9cf2f9 100644 --- a/deal.II/source/base/timer.cc +++ b/deal.II/source/base/timer.cc @@ -350,6 +350,14 @@ TimerOutput::enter_subsection (const std::string §ion_name) if (sections.find (section_name) == sections.end()) { +#ifdef DEAL_II_WITH_MPI + if (mpi_communicator != MPI_COMM_SELF) + { + sections[section_name].timer = Timer(mpi_communicator, true); + } +#endif + + sections[section_name].total_cpu_time = 0; sections[section_name].total_wall_time = 0; sections[section_name].n_calls = 0;