From f7217d12d2137c33c559ea33746ad9efab3b3bc3 Mon Sep 17 00:00:00 2001 From: Peter Boyle Date: Mon, 11 Jul 2022 13:45:31 -0400 Subject: [PATCH] World barrier for clock synch --- Grid/communicator/Communicator_base.h | 1 + Grid/communicator/Communicator_mpi3.cc | 4 ++++ Grid/communicator/Communicator_none.cc | 1 + 3 files changed, 6 insertions(+) diff --git a/Grid/communicator/Communicator_base.h b/Grid/communicator/Communicator_base.h index d4f12f86..cb3b9f0e 100644 --- a/Grid/communicator/Communicator_base.h +++ b/Grid/communicator/Communicator_base.h @@ -107,6 +107,7 @@ public: //////////////////////////////////////////////////////////////////////////////// static int RankWorld(void) ; static void BroadcastWorld(int root,void* data, int bytes); + static void BarrierWorld(void); //////////////////////////////////////////////////////////// // Reduction diff --git a/Grid/communicator/Communicator_mpi3.cc b/Grid/communicator/Communicator_mpi3.cc index 0d0a3443..b5f751b8 100644 --- a/Grid/communicator/Communicator_mpi3.cc +++ b/Grid/communicator/Communicator_mpi3.cc @@ -443,6 +443,10 @@ int CartesianCommunicator::RankWorld(void){ MPI_Comm_rank(communicator_world,&r); return r; } +void CartesianCommunicator::BarrierWorld(void){ + int ierr = MPI_Barrier(communicator_world); + assert(ierr==0); +} void CartesianCommunicator::BroadcastWorld(int root,void* data, int bytes) { int ierr= MPI_Bcast(data, diff --git a/Grid/communicator/Communicator_none.cc b/Grid/communicator/Communicator_none.cc index a0f33ca4..4b533c4b 100644 --- a/Grid/communicator/Communicator_none.cc +++ b/Grid/communicator/Communicator_none.cc @@ -104,6 +104,7 @@ int CartesianCommunicator::RankWorld(void){return 0;} void CartesianCommunicator::Barrier(void){} void CartesianCommunicator::Broadcast(int root,void* data, int bytes) {} void CartesianCommunicator::BroadcastWorld(int root,void* data, int bytes) { } +void CartesianCommunicator::BarrierWorld(void) { } int CartesianCommunicator::RankFromProcessorCoor(Coordinate &coor) { return 0;} void CartesianCommunicator::ProcessorCoorFromRank(int rank, Coordinate &coor){ coor = _processor_coor; } void CartesianCommunicator::ShiftedRanks(int dim,int shift,int &source,int &dest)