From 5e01152779f33992368d9c8b9f7f03854b9c318d Mon Sep 17 00:00:00 2001
From: mattijs <mattijs>
Date: Mon, 29 Apr 2019 09:23:43 +0100
Subject: [PATCH] ENH: Pstream: use commsType to decide whether reduce or
 all-to-all

---
 src/Pstream/mpi/UIPread.C  | 10 ++++++----
 src/Pstream/mpi/UOPwrite.C |  6 ++++--
 2 files changed, 10 insertions(+), 6 deletions(-)

diff --git a/src/Pstream/mpi/UIPread.C b/src/Pstream/mpi/UIPread.C
index 3a380fe5a80..d08721517f1 100644
--- a/src/Pstream/mpi/UIPread.C
+++ b/src/Pstream/mpi/UIPread.C
@@ -97,7 +97,8 @@ Foam::UIPstream::UIPstream
             );
             MPI_Get_count(&status, MPI_BYTE, &messageSize_);
 
-            profilingPstream::addWaitTime();
+            // Assume these are from gathers ...
+            profilingPstream::addGatherTime();
 
             externalBuf_.setCapacity(messageSize_);
             wantedSize = messageSize_;
@@ -202,7 +203,8 @@ Foam::UIPstream::UIPstream(const int fromProcNo, PstreamBuffers& buffers)
             );
             MPI_Get_count(&status, MPI_BYTE, &messageSize_);
 
-            profilingPstream::addWaitTime();
+            // Assume these are from gathers ...
+            profilingPstream::addGatherTime();
 
             externalBuf_.setCapacity(messageSize_);
             wantedSize = messageSize_;
@@ -293,7 +295,7 @@ Foam::label Foam::UIPstream::read
             return 0;
         }
 
-        profilingPstream::addScatterTime();
+        profilingPstream::addGatherTime();
 
         // Check size of message read
 
@@ -344,7 +346,7 @@ Foam::label Foam::UIPstream::read
             return 0;
         }
 
-        profilingPstream::addScatterTime();
+        profilingPstream::addWaitTime();
 
         if (debug)
         {
diff --git a/src/Pstream/mpi/UOPwrite.C b/src/Pstream/mpi/UOPwrite.C
index 968a4753f9d..2fd338ebb2a 100644
--- a/src/Pstream/mpi/UOPwrite.C
+++ b/src/Pstream/mpi/UOPwrite.C
@@ -85,7 +85,8 @@ bool Foam::UOPstream::write
             PstreamGlobals::MPICommunicators_[communicator] //MPI_COMM_WORLD
         );
 
-        profilingPstream::addGatherTime();
+        // Assume these are from scatters ...
+        profilingPstream::addScatterTime();
 
         if (debug)
         {
@@ -107,7 +108,8 @@ bool Foam::UOPstream::write
             PstreamGlobals::MPICommunicators_[communicator] //MPI_COMM_WORLD
         );
 
-        profilingPstream::addWaitTime();
+        // Assume these are from scatters ...
+        profilingPstream::addScatterTime();
 
         if (debug)
         {
-- 
GitLab