ENH: more consistent use of broadcast, combineReduce etc.

- broadcast           : (replaces scatter)
  - combineReduce       == combineGather + broadcast
  - listCombineReduce   == listCombineGather + broadcast
  - mapCombineReduce    == mapCombineGather + broadcast
  - allGatherList       == gatherList + scatterList

  Before settling on a more consistent naming convention,
  some intermediate namings were used in OpenFOAM-v2206:

    - combineReduce       (2206: combineAllGather)
    - listCombineReduce   (2206: listCombineAllGather)
    - mapCombineReduce    (2206: mapCombineAllGather)
This commit is contained in:
Mark Olesen
2022-08-23 15:58:32 +02:00
committed by Andrew Heather
parent b9c15b8585
commit 473e14418a
103 changed files with 248 additions and 307 deletions

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2016-2021 OpenCFD Ltd.
Copyright (C) 2016-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -218,9 +218,9 @@ bool Foam::functionObjects::abort::execute()
}
}
// Send to slaves. Also acts as an MPI barrier
label intAction(action);
Pstream::scatter(intAction);
// Send to sub-ranks. Also acts as an MPI barrier
int intAction(action);
Pstream::broadcast(intAction);
action = Time::stopAtControls(intAction);

View File

@ -267,7 +267,7 @@ bool Foam::areaWrite::write()
}
// Parallel consistency (no-op in serial)
Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>());
Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>());
missed.clear();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2019-2021 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -73,16 +73,12 @@ void Foam::areaWrite::performAction
{
fieldNames = areaMesh.thisDb().names<GeoField>(fieldSelection_);
// With syncPar
// Synchronize names
if (Pstream::parRun())
{
// Synchronize names
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
}
// Sort for consistent order on all processors
Foam::sort(fieldNames);
Foam::sort(fieldNames); // Consistent order
}
for (const word& fieldName : fieldNames)

View File

@ -27,7 +27,6 @@ License
#include "parProfiling.H"
#include "addToRunTimeSelectionTable.H"
#include "UPstream.H"
#include "Pstream.H"
#include "PstreamReduceOps.H"
#include "profilingPstream.H"

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2018-2020 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -73,7 +73,7 @@ Foam::label Foam::functionObjects::systemCall::dispatch(const stringList& calls)
// MPI barrier
if (masterOnly_)
{
Pstream::scatter(nCalls);
Pstream::broadcast(nCalls);
}
return nCalls;