aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/CallFunction.cc
diff options
context:
space:
mode:
authorIan Hinder <ian.hinder@aei.mpg.de>2012-04-28 19:55:36 +0200
committerBarry Wardell <barry.wardell@gmail.com>2012-09-11 18:23:15 +0100
commit0f599eb6bee8949ca356186dbbbdf7623902052e (patch)
treed26bf67ae0652bfdd0e22957f01ed7f6d0fa580a /Carpet/Carpet/src/CallFunction.cc
parent4e8d66f62882f5f3596d8f10762d6ac399d86ef1 (diff)
Add parameter sync_barriers to insert an MPI barrier before every sync
This causes each process to wait for all the others to reach this point in the execution. This will happen anyway (for most of the processes) during the sync, and adding this barrier means that this time is not included in the sync timer. Also add a new timer to time this barrier.
Diffstat (limited to 'Carpet/Carpet/src/CallFunction.cc')
-rw-r--r--Carpet/Carpet/src/CallFunction.cc27
1 files changed, 27 insertions, 0 deletions
diff --git a/Carpet/Carpet/src/CallFunction.cc b/Carpet/Carpet/src/CallFunction.cc
index 40e2ce0fc..fdb0bb7fd 100644
--- a/Carpet/Carpet/src/CallFunction.cc
+++ b/Carpet/Carpet/src/CallFunction.cc
@@ -417,6 +417,33 @@ namespace Carpet {
vector<int> const & sync_groups,
Timer & sync_timer)
{
+ DECLARE_CCTK_PARAMETERS;
+
+ if (sync_barriers) {
+ // Create an ID that is almost unique for this scheduled
+ // function call
+ stringstream buf;
+ buf << cctkGH->cctk_iteration << "\n";
+ buf << attribute->meta
+ << attribute->meta_early
+ << attribute->meta_late
+ << attribute->global
+ << attribute->global_early
+ << attribute->global_late
+ << attribute->level
+ << attribute->singlemap
+ << attribute->local << "\n";
+ buf << attribute->where << "\n";
+ buf << attribute->thorn << "\n";
+ buf << attribute->routine << " sync\n";
+ string const str = buf.str();
+ int const id = adler32(str.c_str(), str.length());
+ static Timer barrier_timer ("sync_barrier");
+ barrier_timer.start();
+ Carpet::NamedBarrier (NULL, id, "Carpet::Sync");
+ barrier_timer.stop();
+ }
+
sync_timer.start();
SyncProlongateGroups (cctkGH, sync_groups);
sync_timer.stop();