From 0cf02eb384d9afab69dd44c95f2ff9dc22dd5082 Mon Sep 17 00:00:00 2001 From: Mark Olesen Date: Mon, 7 Mar 2022 09:40:13 +0100 Subject: [PATCH] ENH: globalIndex with direct gather/broadcast - less communication than gatherList/scatterList ENH: refine send granularity in Pstream::exchange STYLE: ensure PstreamBuffers and defaultCommsType agree - simpler loops for lduSchedule --- .../parallel-chunks/Test-parallel-chunks.C | 51 ++++++---- .../redistributePar/redistributePar.C | 6 +- .../preProcessing/mapFieldsPar/MapVolFields.H | 7 +- .../db/IOstreams/Pstreams/PstreamExchange.C | 37 ++++---- .../GeometricField/GeometricBoundaryField.C | 10 +- .../LduMatrixUpdateMatrixInterfaces.C | 8 +- .../GAMGProcAgglomeration.C | 13 ++- .../pointBoundaryMesh/pointBoundaryMesh.C | 36 ++++---- .../polyBoundaryMesh/polyBoundaryMesh.C | 36 ++++---- .../parallel/globalIndex/globalIndex.C | 28 +++--- .../parallel/globalIndex/globalIndex.H | 92 +++++++++++-------- .../parallel/globalIndex/globalIndexI.H | 21 ++--- src/Pstream/mpi/UPstream.C | 6 +- src/Pstream/mpi/allReduce.H | 17 +++- src/Pstream/mpi/allReduceTemplates.C | 51 +++++++++- .../motionSmoother/motionSmootherAlgo.C | 27 +++--- .../field/mapFields/mapFieldsTemplates.C | 9 +- .../decompositionMethod/decompositionMethod.C | 16 +--- 18 files changed, 275 insertions(+), 196 deletions(-) diff --git a/applications/test/parallel-chunks/Test-parallel-chunks.C b/applications/test/parallel-chunks/Test-parallel-chunks.C index 1dc4cb7380..36a6cc63c8 100644 --- a/applications/test/parallel-chunks/Test-parallel-chunks.C +++ b/applications/test/parallel-chunks/Test-parallel-chunks.C @@ -210,7 +210,7 @@ void broadcast_chunks << "Contiguous data only." << sizeof(T) << Foam::abort(FatalError); } - if (UPstream::maxCommsSize <= int(sizeof(T))) + if (UPstream::maxCommsSize <= 0) { // Do in one go Info<< "send " << sendData.size() << " elements in one go" << endl; @@ -230,48 +230,61 @@ void broadcast_chunks // guaranteed that some processor's sending size is some other // processor's receive size. Also we can ignore any local comms. - // We need to send bytes so the number of iterations: + // We need to send chunks so the number of iterations: // maxChunkSize iterations // ------------ ---------- // 0 0 // 1..maxChunkSize 1 // maxChunkSize+1..2*maxChunkSize 2 - // etc. + // ... - const label maxChunkSize(UPstream::maxCommsSize/sizeof(T)); + const label maxChunkSize + ( + max + ( + static_cast