From 7006056eaea94394e6e75e7b2c7f4dfa2f63f0ba Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Thu, 29 Feb 2024 18:35:03 +0100 Subject: [PATCH] ENH: remove blocking communication for gather patterns ENH: eliminate unnecessary duplicate communicator - in globalMeshData previously had a comm_dup hack to avoid clashes with deltaCoeffs calculations. However, this was largely due to a manual implementation of reduce() that used point-to-point communication. This has since been updated to use an MPI_Allreduce and now an MPI_Allgather, neither of which need this hack. --- .../test/IndirectList/Test-IndirectList.C | 19 +-- .../test/parallel-nbx2/Test-parallel-nbx2.C | 8 +- applications/test/parallel/Test-parallel.C | 20 ++- .../test/router/{Gather => }/Gather.H | 29 ++-- .../test/router/{Gather => }/Gather.txx | 79 ++++------- applications/test/router/Gather/GatherBase.H | 102 -------------- .../test/router/Gather/GatherBase.txx | 115 ---------------- applications/test/treeComms/Test-treeComms.C | 12 +- .../manipulation/createPatch/createPatch.C | 13 +- .../splitMeshRegions/splitMeshRegions.C | 8 +- .../Lists/SortableList/ParSortableList.C | 8 +- src/OpenFOAM/db/IOstreams/Pstreams/IPstream.H | 2 +- src/OpenFOAM/db/IOstreams/Pstreams/OPstream.H | 25 +--- .../db/IOstreams/Pstreams/OPstreams.C | 11 +- .../Pstreams/PstreamExchangeConsensus.C | 4 +- .../db/IOstreams/Pstreams/UOPstream.H | 12 +- .../polyMesh/globalMeshData/globalMeshData.C | 49 ++----- .../mapDistributeBaseTemplates.C | 6 +- src/OpenFOAM/meshes/polyMesh/polyMesh.H | 1 + .../polyMesh/syncTools/syncToolsTemplates.C | 6 +- .../vtk/output/foamVtkPatchWriterTemplates.C | 22 +-- .../fvMeshDistribute/fvMeshDistribute.C | 1 - .../field/externalCoupled/externalCoupled.C | 65 +++++---- .../field/externalCoupled/externalCoupled.H | 26 ++-- .../externalCoupledTemplates.C | 130 ++++++------------ .../lagrangian/dataCloud/dataCloudTemplates.C | 24 ++-- .../meshRefinement/meshRefinementTemplates.C | 19 +-- .../output/vtk/patch/foamVtkPatchMeshWriter.C | 40 +++--- .../surface/isoSurface/isoSurfacePoint.C | 11 +- 29 files changed, 272 insertions(+), 595 deletions(-) rename applications/test/router/{Gather => }/Gather.H (82%) rename applications/test/router/{Gather => }/Gather.txx (54%) delete mode 100644 applications/test/router/Gather/GatherBase.H delete mode 100644 applications/test/router/Gather/GatherBase.txx diff --git a/applications/test/IndirectList/Test-IndirectList.C b/applications/test/IndirectList/Test-IndirectList.C index dae630976a..bf174fc570 100644 --- a/applications/test/IndirectList/Test-IndirectList.C +++ b/applications/test/IndirectList/Test-IndirectList.C @@ -6,7 +6,7 @@ \\/ M anipulation | ------------------------------------------------------------------------------- Copyright (C) 2011 OpenFOAM Foundation - Copyright (C) 2017-2022 OpenCFD Ltd. + Copyright (C) 2017-2024 OpenCFD Ltd. ------------------------------------------------------------------------------- License This file is part of OpenFOAM. @@ -156,29 +156,24 @@ int main(int argc, char *argv[]) os.writeEntry("idl3", idl3); } - if (Pstream::parRun()) + if (UPstream::parRun()) { - if (Pstream::master()) + if (UPstream::master()) { Pout<< "full: " << flatOutput(idl3.values()) << nl << "send: " << flatOutput(idl3) << endl; - for (const int proci : Pstream::subProcs()) + for (const int proci : UPstream::subProcs()) { - OPstream toSlave(Pstream::commsTypes::scheduled, proci); - toSlave << idl3; + OPstream::send(idl3, proci); } } else { // From master - IPstream fromMaster - ( - Pstream::commsTypes::scheduled, - Pstream::masterNo() - ); + List