From 642f25c5cf6476bc0259fefc6c7218b1cfe8e2b5 Mon Sep 17 00:00:00 2001
From: "Peter W. Draper" <p.w.draper@durham.ac.uk>
Date: Thu, 11 Jul 2019 13:20:01 +0100
Subject: [PATCH] Add a barrier before setting the step start time, we need to
 do this to synchronize the ticks between ranks

---
 src/engine.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/engine.c b/src/engine.c
index a42ead2d87..80ac6401dc 100644
--- a/src/engine.c
+++ b/src/engine.c
@@ -3691,6 +3691,11 @@ void engine_step(struct engine *e) {
   struct clocks_time time1, time2;
   clocks_gettime(&time1);
 
+#if defined(SWIFT_MPIUSE_REPORTS) && defined(WITH_MPI)
+  /* We may want to compare times across ranks, so make sure all steps start
+   * at the same time, just different ticks. */
+  MPI_Barrier(MPI_COMM_WORLD);
+#endif
   e->tic_step = getticks();
 
   if (e->nodeID == 0) {
-- 
GitLab