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

@ -182,7 +182,7 @@ int main(int argc, char *argv[])
// MPI barrier
bool barrier = true;
Pstream::scatter(barrier);
Pstream::broadcast(barrier);
}

View File

@ -138,8 +138,8 @@ int main()
maxFirstEqOp<label>()(maxIndexed, item);
}
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;
@ -156,8 +156,8 @@ int main()
maxIndexed = maxFirstOp<label>()(maxIndexed, item);
}
Pstream::combineAllGather(minIndexed, minFirstEqOp<label>());
Pstream::combineAllGather(maxIndexed, maxFirstEqOp<label>());
Pstream::combineReduce(minIndexed, minFirstEqOp<label>());
Pstream::combineReduce(maxIndexed, maxFirstEqOp<label>());
Info<< "Min indexed: " << minIndexed << nl
<< "Max indexed: " << maxIndexed << nl;

View File

@ -60,7 +60,7 @@ int main(int argc, char *argv[])
Info<< "Reading " << file << nl << endl;
decomposedBlockData data
(
Pstream::worldComm,
UPstream::worldComm,
IOobject
(
file,

View File

@ -204,7 +204,7 @@ int main(int argc, char *argv[])
labelPair inOut;
pointField allCcs(globalNumbering.gather(mesh.cellCentres()));
inOut[0] = allCcs.size();
Pstream::scatter(allCcs);
Pstream::broadcast(allCcs);
inOut[1] = allCcs.size();
Pout<< " " << inOut << endl;

View File

@ -234,11 +234,7 @@ int main(int argc, char *argv[])
Pout<< "hashed: " << hashed << nl;
Pstream::mapCombineGather
(
hashed,
plusEqOp<scalarMinMax>()
);
Pstream::mapCombineReduce(hashed, plusEqOp<scalarMinMax>());
Info<< "reduced: " << hashed << nl;

View File

@ -167,7 +167,7 @@ int main(int argc, char *argv[])
(
localValue,
sumOp<scalar>(),
Pstream::msgType(),
UPstream::msgType(),
comm
);
Pout<< "sum :" << sum << endl;

View File

@ -125,13 +125,13 @@ int main(int argc, char *argv[])
scalar data1 = 1.0;
label request1 = -1;
{
Foam::reduce(data1, sumOp<scalar>(), Pstream::msgType(), request1);
Foam::reduce(data1, sumOp<scalar>(), UPstream::msgType(), request1);
}
scalar data2 = 0.1;
label request2 = -1;
{
Foam::reduce(data2, sumOp<scalar>(), Pstream::msgType(), request2);
Foam::reduce(data2, sumOp<scalar>(), UPstream::msgType(), request2);
}

View File

@ -661,8 +661,8 @@ void countExtrudePatches
}
// Synchronise decision. Actual numbers are not important, just make
// sure that they're > 0 on all processors.
Pstream::listCombineAllGather(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineAllGather(zoneZonePatch, plusEqOp<label>());
Pstream::listCombineReduce(zoneSidePatch, plusEqOp<label>());
Pstream::listCombineReduce(zoneZonePatch, plusEqOp<label>());
}
@ -1848,7 +1848,7 @@ int main(int argc, char *argv[])
const primitiveFacePatch extrudePatch(std::move(zoneFaces), mesh.points());
Pstream::listCombineAllGather(isInternal, orEqOp<bool>());
Pstream::listCombineReduce(isInternal, orEqOp<bool>());
// Check zone either all internal or all external faces
checkZoneInside(mesh, zoneNames, zoneID, extrudeMeshFaces, isInternal);
@ -2309,7 +2309,7 @@ int main(int argc, char *argv[])
}
// Reduce
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>());
Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
forAll(localToGlobalRegion, localRegionI)
{

View File

@ -729,7 +729,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseSurfaceTrees
}
}
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(surfaceHits, eI)
{
@ -816,7 +816,7 @@ Foam::label Foam::conformalVoronoiMesh::synchroniseEdgeTrees
}
}
Pstream::listCombineAllGather(hits, plusEqOp<labelHashSet>());
Pstream::listCombineReduce(hits, plusEqOp<labelHashSet>());
forAll(featureEdgeHits, eI)
{

View File

@ -416,10 +416,12 @@ void extractSurface
// Allocate zone/patch for all patches
HashTable<label> compactZoneID(1024);
if (Pstream::master())
{
forAllConstIters(patchSize, iter)
{
label sz = compactZoneID.size();
compactZoneID.insert(iter.key(), sz);
compactZoneID.insert(iter.key(), compactZoneID.size());
}
}
Pstream::broadcast(compactZoneID);
@ -431,7 +433,7 @@ void extractSurface
label patchi = bMesh.findPatchID(iter.key());
if (patchi != -1)
{
patchToCompactZone[patchi] = iter();
patchToCompactZone[patchi] = iter.val();
}
}

View File

@ -588,11 +588,7 @@ Foam::label Foam::checkTopology
}
}
Pstream::listCombineAllGather
(
regionDisconnected,
andEqOp<bool>()
);
Pstream::listCombineReduce(regionDisconnected, andEqOp<bool>());
}

View File

@ -714,7 +714,7 @@ void syncPoints
}
// Combine - globally consistent
Pstream::listCombineAllGather(sharedPts, cop);
Pstream::listCombineReduce(sharedPts, cop);
// Now we will all have the same information. Merge it back with
// my local information.

View File

@ -1114,7 +1114,7 @@ label findCorrespondingRegion
}
}
Pstream::listCombineAllGather(cellsInZone, plusEqOp<label>());
Pstream::listCombineReduce(cellsInZone, plusEqOp<label>());
// Pick region with largest overlap of zoneI
label regionI = findMax(cellsInZone);

View File

@ -223,7 +223,7 @@ bool writeOptionalMeshObject
// Make sure all know if there is a valid class name
wordList classNames(1, io.headerClassName());
Pstream::combineAllGather(classNames, uniqueEqOp<word>());
Pstream::combineReduce(classNames, uniqueEqOp<word>());
// Check for correct type
if (classNames[0] == T::typeName)
@ -429,7 +429,7 @@ int main(int argc, char *argv[])
)
);
Pstream::combineAllGather(lagrangianDirs, uniqueEqOp<fileName>());
Pstream::combineReduce(lagrangianDirs, uniqueEqOp<fileName>());
if (!lagrangianDirs.empty())
{
@ -466,7 +466,7 @@ int main(int argc, char *argv[])
)
);
Pstream::combineAllGather(cloudDirs, uniqueEqOp<fileName>());
Pstream::combineReduce(cloudDirs, uniqueEqOp<fileName>());
forAll(cloudDirs, i)
{
@ -492,7 +492,7 @@ int main(int argc, char *argv[])
);
// Combine with all other cloud objects
Pstream::combineAllGather(cloudFields, uniqueEqOp<word>());
Pstream::combineReduce(cloudFields, uniqueEqOp<word>());
for (const word& name : cloudFields)
{

View File

@ -89,10 +89,11 @@ void Foam::parLagrangianDistributor::findClouds
}
// Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
Foam::sort(cloudNames); // Consistent order
objectNames.setSize(cloudNames.size());
objectNames.clear();
objectNames.resize(cloudNames.size());
for (const fileName& localCloudName : localCloudDirs)
{
@ -124,11 +125,11 @@ void Foam::parLagrangianDistributor::findClouds
}
}
// Synchronise objectNames
forAll(objectNames, i)
// Synchronise objectNames (per cloud)
for (wordList& objNames : objectNames)
{
Pstream::combineGather(objectNames[i], ListOps::uniqueEqOp<word>());
Pstream::broadcast(objectNames[i]);
Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
Foam::sort(objNames); // Consistent order
}
}
@ -291,7 +292,7 @@ Foam::parLagrangianDistributor::distributeLagrangianPositions
nsTransPs[sendProcI] = subMap[sendProcI].size();
}
// Send sizes across. Note: blocks.
Pstream::combineAllGather(sizes, Pstream::listEq());
Pstream::combineReduce(sizes, Pstream::listEq());
labelListList constructMap(Pstream::nProcs());
label constructSize = 0;

View File

@ -51,14 +51,9 @@ Foam::wordList Foam::parLagrangianDistributor::filterObjects
: objects.names<Container>(selectedFields)
);
// Parallel synchronise
// - Combine names from all processors
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
// Sort for consistent order on all processors
Foam::sort(fieldNames);
// Parallel synchronise - combine names from all processors
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Foam::sort(fieldNames); // Consistent order
return fieldNames;
}

View File

@ -132,7 +132,7 @@ void createTimeDirs(const fileName& path)
//Pstream::parRun(oldParRun); // Restore parallel state
masterTimeDirs = localTimeDirs;
}
Pstream::scatter(masterTimeDirs);
Pstream::broadcast(masterTimeDirs);
//DebugVar(masterTimeDirs);
//DebugVar(localTimeDirs);
@ -1168,7 +1168,7 @@ int main(int argc, char *argv[])
bool nfs = true;
{
List<fileName> roots(1, args.rootPath());
Pstream::combineAllGather(roots, ListOps::uniqueEqOp<fileName>());
Pstream::combineReduce(roots, ListOps::uniqueEqOp<fileName>());
nfs = (roots.size() == 1);
}
@ -1203,7 +1203,7 @@ int main(int argc, char *argv[])
}
}
// If master changed to decompose mode make sure all nodes know about it
Pstream::scatter(decompose);
Pstream::broadcast(decompose);
// If running distributed we have problem of new processors not finding
@ -1288,7 +1288,7 @@ int main(int argc, char *argv[])
// use the times list from the master processor
// and select a subset based on the command-line options
instantList timeDirs = timeSelector::select(runTime.times(), args);
Pstream::scatter(timeDirs);
Pstream::broadcast(timeDirs);
if (timeDirs.empty())
{
@ -2067,7 +2067,7 @@ int main(int argc, char *argv[])
args
)[0].value();
}
Pstream::scatter(masterTime);
Pstream::broadcast(masterTime);
Info<< "Setting time to that of master or undecomposed case : "
<< masterTime << endl;
runTime.setTime(masterTime, 0);

View File

@ -101,7 +101,7 @@ if (timeDirs.size() && doLagrangian)
{
for (auto& cloudFields : regionCloudFields)
{
Pstream::mapCombineAllGather
Pstream::mapCombineReduce
(
cloudFields,
HashTableOps::plusEqOp<word>()

View File

@ -46,11 +46,9 @@ if (doLagrangian)
if (Pstream::parRun())
{
// Synchronise cloud names
Pstream::combineGather(cloudNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(cloudNames);
Pstream::combineReduce(cloudNames, ListOps::uniqueEqOp<word>());
}
// Consistent order
Foam::sort(cloudNames);
Foam::sort(cloudNames); // Consistent order
for (const word& cloudName : cloudNames)
{

View File

@ -186,7 +186,7 @@ int main(int argc, char *argv[])
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
maxIds.resize(maxNProcs, -1);
Pstream::listCombineAllGather(maxIds, maxEqOp<label>());
Pstream::listCombineReduce(maxIds, maxEqOp<label>());
// From ids to count
const labelList numIds = maxIds + 1;

View File

@ -77,8 +77,7 @@ Foam::label Foam::particleTracksSampler::setTrackFields
if (Pstream::parRun())
{
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
}
for (const word& fieldName : fieldNames)

View File

@ -40,7 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
}
// Global sum
Pstream::listCombineAllGather(regionField, plusEqOp<T>());
Pstream::listCombineReduce(regionField, plusEqOp<T>());
return regionField;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2016 OpenFOAM Foundation
Copyright (C) 2017-2021 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -302,6 +302,8 @@ int main(int argc, char *argv[])
Pstream::mapCombineGather(patchSize, plusEqOp<label>());
Pstream::mapCombineGather(zoneSize, plusEqOp<label>());
if (Pstream::master())
{
// Allocate compact numbering for all patches/faceZones
forAllConstIters(patchSize, iter)
{
@ -312,7 +314,7 @@ int main(int argc, char *argv[])
{
compactZoneID.insert(iter.key(), compactZoneID.size());
}
}
Pstream::broadcast(compactZoneID);
@ -391,13 +393,9 @@ int main(int argc, char *argv[])
// Gather all faces
List<faceList> gatheredFaces(Pstream::nProcs());
gatheredFaces[Pstream::myProcNo()] = allBoundary.localFaces();
forAll(gatheredFaces[Pstream::myProcNo()], i)
for (face& f : gatheredFaces[Pstream::myProcNo()])
{
inplaceRenumber
(
pointToGlobal,
gatheredFaces[Pstream::myProcNo()][i]
);
inplaceRenumber(pointToGlobal, f);
}
Pstream::gatherList(gatheredFaces);

View File

@ -252,7 +252,7 @@ int main(int argc, char *argv[])
dict.add("bounds", bbs);
// Scatter patch information
Pstream::scatter(s.patches());
Pstream::broadcast(s.patches());
// Construct distributedTrisurfaceMesh from components
IOobject notReadIO(io);

View File

@ -202,7 +202,7 @@ void Foam::ParSortableList<Type>::sort()
getPivots(sortedPivots, pivots);
}
Pstream::scatter(pivots);
Pstream::broadcast(pivots);
if (debug)
{

View File

@ -90,12 +90,10 @@ void Foam::IOobjectList::syncNames(wordList& objNames)
if (Pstream::parRun())
{
// Synchronize names
Pstream::combineGather(objNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(objNames);
Pstream::combineReduce(objNames, ListOps::uniqueEqOp<word>());
}
// Consistent order on all processors
Foam::sort(objNames);
Foam::sort(objNames); // Consistent order
}

View File

@ -579,7 +579,7 @@ template<class Type> \
ReturnType gFunc(const UList<Type>& f, const label comm) \
{ \
ReturnType res = Func(f); \
reduce(res, rFunc##Op<ReturnType>(), Pstream::msgType(), comm); \
reduce(res, rFunc##Op<ReturnType>(), UPstream::msgType(), comm); \
return res; \
} \
TMP_UNARY_FUNCTION(ReturnType, gFunc)
@ -611,7 +611,7 @@ typename scalarProduct<Type, Type>::type gSumProd
typedef typename scalarProduct<Type, Type>::type prodType;
prodType result = sumProd(f1, f2);
reduce(result, sumOp<prodType>(), Pstream::msgType(), comm);
reduce(result, sumOp<prodType>(), UPstream::msgType(), comm);
return result;
}
@ -624,7 +624,7 @@ Type gSumCmptProd
)
{
Type SumProd = sumCmptProd(f1, f2);
reduce(SumProd, sumOp<Type>(), Pstream::msgType(), comm);
reduce(SumProd, sumOp<Type>(), UPstream::msgType(), comm);
return SumProd;
}
@ -637,7 +637,7 @@ Type gAverage
{
label n = f.size();
Type s = sum(f);
sumReduce(s, n, Pstream::msgType(), comm);
sumReduce(s, n, UPstream::msgType(), comm);
if (n > 0)
{

View File

@ -172,7 +172,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMinData
result.second() = data[i];
}
Pstream::combineAllGather(result, minFirstEqOp<T1>());
Pstream::combineReduce(result, minFirstEqOp<T1>());
return result;
}
@ -193,7 +193,7 @@ Foam::Tuple2<T1,T2> Foam::FieldOps::findMaxData
result.second() = data[i];
}
Pstream::combineAllGather(result, maxFirstEqOp<T1>());
Pstream::combineReduce(result, maxFirstEqOp<T1>());
return result;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2013-2016 OpenFOAM Foundation
Copyright (C) 2019-2020 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -196,7 +196,7 @@ Foam::procFacesGAMGProcAgglomeration::processorAgglomeration
fineToCoarse = labelUIndList(oldToNew, fineToCoarse)();
}
Pstream::scatter(fineToCoarse, Pstream::msgType(), mesh.comm());
Pstream::broadcast(fineToCoarse, mesh.comm());
UPstream::freeCommunicator(singleCellMeshComm);
return tfineToCoarse;

View File

@ -1934,7 +1934,7 @@ Foam::pointField Foam::globalMeshData::geometricSharedPoints() const
pointField sharedPoints(mesh_.points(), sharedPointLabels());
// Append from all processors, globally consistent
Pstream::combineAllGather(sharedPoints, ListOps::appendEqOp<point>());
Pstream::combineReduce(sharedPoints, ListOps::appendEqOp<point>());
// Merge tolerance
scalar tolDim = matchTol_ * mesh_.bounds().mag();
@ -2730,7 +2730,7 @@ void Foam::globalMeshData::updateMesh()
(
mesh_.nFaces(),
sumOp<label>(),
Pstream::msgType(),
UPstream::msgType(),
comm
);
@ -2743,7 +2743,7 @@ void Foam::globalMeshData::updateMesh()
(
mesh_.nCells(),
sumOp<label>(),
Pstream::msgType(),
UPstream::msgType(),
comm
);
@ -2756,7 +2756,7 @@ void Foam::globalMeshData::updateMesh()
(
mesh_.nPoints(),
sumOp<label>(),
Pstream::msgType(),
UPstream::msgType(),
comm
);

View File

@ -412,7 +412,7 @@ public:
const globalIndex&,
labelList& elements,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType(),
const int tag = UPstream::msgType(),
const label comm = UPstream::worldComm
);
@ -426,7 +426,7 @@ public:
const globalIndex&,
labelListList& cellCells,
List<Map<label>>& compactMap,
const int tag = Pstream::msgType(),
const int tag = UPstream::msgType(),
const label comm = UPstream::worldComm
);

View File

@ -322,7 +322,7 @@ void Foam::syncTools::syncPointMap
}
// Broadcast: send merged values to all
Pstream::scatter(sharedPointValues);
Pstream::broadcast(sharedPointValues);
}
// Merge sharedPointValues (keyed on sharedPointAddr) into
@ -667,7 +667,7 @@ void Foam::syncTools::syncEdgeMap
}
// Broadcast: send merged values to all
Pstream::scatter(sharedEdgeValues);
Pstream::broadcast(sharedEdgeValues);
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2019 OpenCFD Ltd.
Copyright (C) 2019-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -269,7 +269,7 @@ void Foam::globalIndexAndTransform::determineTransforms()
}
transforms_.transfer(localTransforms);
Pstream::scatter(transforms_);
Pstream::broadcast(transforms_);
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2017-2020 OpenCFD Ltd.
Copyright (C) 2017-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -143,14 +143,14 @@ Foam::label Foam::Random::position(const label& start, const label& end)
template<>
Foam::scalar Foam::Random::globalSample01()
{
scalar value(-GREAT);
scalar value(0);
if (Pstream::master())
{
value = scalar01();
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -159,14 +159,14 @@ Foam::scalar Foam::Random::globalSample01()
template<>
Foam::label Foam::Random::globalSample01()
{
label value(labelMin);
label value(0);
if (Pstream::master())
{
value = round(scalar01());
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -175,14 +175,14 @@ Foam::label Foam::Random::globalSample01()
template<>
Foam::scalar Foam::Random::globalGaussNormal()
{
scalar value(-GREAT);
scalar value(0);
if (Pstream::master())
{
value = GaussNormal<scalar>();
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -191,14 +191,14 @@ Foam::scalar Foam::Random::globalGaussNormal()
template<>
Foam::label Foam::Random::globalGaussNormal()
{
label value(labelMin);
label value(0);
if (Pstream::master())
{
value = GaussNormal<label>();
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -211,14 +211,14 @@ Foam::scalar Foam::Random::globalPosition
const scalar& end
)
{
scalar value(-GREAT);
scalar value(0);
if (Pstream::master())
{
value = position<scalar>(start, end);
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -231,14 +231,14 @@ Foam::label Foam::Random::globalPosition
const label& end
)
{
label value(labelMin);
label value(0);
if (Pstream::master())
{
value = position<label>(start, end);
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2015 OpenFOAM Foundation
Copyright (C) 2018 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -92,14 +92,14 @@ void Foam::Random::shuffle(UList<Type>& values)
template<class Type>
Type Foam::Random::globalSample01()
{
Type value = -GREAT*pTraits<Type>::one;
Type value(Zero);
if (Pstream::master())
{
value = sample01<Type>();
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -108,14 +108,14 @@ Type Foam::Random::globalSample01()
template<class Type>
Type Foam::Random::globalGaussNormal()
{
Type value = -GREAT*pTraits<Type>::one;
Type value(Zero);
if (Pstream::master())
{
value = GaussNormal<Type>();
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -124,14 +124,14 @@ Type Foam::Random::globalGaussNormal()
template<class Type>
Type Foam::Random::globalPosition(const Type& start, const Type& end)
{
Type value = -GREAT*pTraits<Type>::one;
Type value(Zero);
if (Pstream::master())
{
value = position<Type>(start, end);
}
Pstream::scatter(value);
Pstream::broadcast(value);
return value;
}
@ -140,14 +140,12 @@ Type Foam::Random::globalPosition(const Type& start, const Type& end)
template<class Type>
void Foam::Random::globalRandomise01(Type& value)
{
value = -GREAT*pTraits<Type>::one;
if (Pstream::master())
{
value = sample01<Type>();
}
Pstream::scatter(value);
Pstream::broadcast(value);
}

View File

@ -228,7 +228,7 @@ void Foam::extrudePatchMesh::extrudeMesh(polyPatchList& regionPatches)
}
// Reduce
Pstream::mapCombineAllGather(globalSum, plusEqOp<point>());
Pstream::mapCombineReduce(globalSum, plusEqOp<point>());
forAll(localToGlobalRegion, localRegionI)
{

View File

@ -216,7 +216,7 @@ Foam::wordList Foam::fvMeshDistribute::mergeWordList(const wordList& procNames)
}
}
}
Pstream::scatter(mergedNames);
Pstream::broadcast(mergedNames);
return mergedNames;
}

View File

@ -436,7 +436,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
// Get the minimum per level over all processors. Note minimum so if
// cells are not cubic we use the smallest edge side.
Pstream::listCombineAllGather(typEdgeLenSqr, minEqOp<scalar>());
Pstream::listCombineReduce(typEdgeLenSqr, minEqOp<scalar>());
if (debug)
{
@ -470,7 +470,7 @@ Foam::scalar Foam::hexRef8::getLevel0EdgeLength() const
}
}
Pstream::listCombineAllGather(maxEdgeLenSqr, maxEqOp<scalar>());
Pstream::listCombineReduce(maxEdgeLenSqr, maxEqOp<scalar>());
if (debug)
{

View File

@ -263,7 +263,7 @@ public:
virtual bool open
(
const fileName& file,
bool parallel = Pstream::parRun()
bool parallel = UPstream::parRun()
);
//- End the file contents and close the file after writing.

View File

@ -118,7 +118,7 @@ void Foam::faGlobalMeshData::updateMesh()
sharedPointLabels_ = sharedPointLabels.toc();
Pstream::combineAllGather(globalList, plusEqOp<labelField>());
Pstream::combineReduce(globalList, plusEqOp<labelField>());
nGlobalPoints_ = 0;
for (label i=0; i<globalList.size(); ++i)

View File

@ -164,7 +164,7 @@ void Foam::turbulentDFSEMInletFvPatchVectorField::initialisePatch()
sumTriMagSf_ = Zero;
sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf);
Pstream::listCombineAllGather(sumTriMagSf_, maxEqOp<scalar>());
Pstream::listCombineReduce(sumTriMagSf_, maxEqOp<scalar>());
for (label i = 1; i < triMagSf.size(); ++i)
{

View File

@ -1042,7 +1042,7 @@ void Foam::fvMeshSubset::reset
// Get patch sizes (up to nextPatchID).
// Note that up to nextPatchID the globalPatchMap is an identity so
// no need to index through that.
Pstream::listCombineAllGather(globalPatchSizes, plusEqOp<label>());
Pstream::listCombineReduce(globalPatchSizes, plusEqOp<label>());
// Now all processors have all the patchnames.
// Decide: if all processors have the same patch names and size is zero

View File

@ -223,7 +223,7 @@ bool Foam::functionObjects::Curle::execute()
pDash /= 4*mathematical::pi;
Pstream::listCombineAllGather(pDash, plusEqOp<scalar>());
Pstream::listCombineReduce(pDash, plusEqOp<scalar>());
if (surfaceWriterPtr_)
{

View File

@ -188,8 +188,8 @@ void Foam::DMDModels::STDMD::compress()
q.subColumn(i) = EVecs.subColumn(permutation[i]);
}
}
Pstream::scatter(G_);
Pstream::scatter(q);
Pstream::broadcast(G_);
Pstream::broadcast(q);
// Update "Q"
Q_ = Q_*q;
@ -357,8 +357,8 @@ reducedKoopmanOperator()
A1 = RxInv_*RMatrix(MatrixTools::pinv(Rx*(G_^Rx)));
Rx.clear();
}
Pstream::scatter(RxInv_);
Pstream::scatter(A1);
Pstream::broadcast(RxInv_);
Pstream::broadcast(A1);
Info<< tab << "Computing A2" << endl;
SMatrix A2(Qupper_ & Qlower_);
@ -452,15 +452,15 @@ bool Foam::DMDModels::STDMD::eigendecomposition(SMatrix& Atilde)
evals_ = cp;
}
}
Pstream::scatter(fail);
Pstream::broadcast(fail);
if (fail)
{
return false;
}
Pstream::scatter(evals_);
Pstream::scatter(evecs_);
Pstream::broadcast(evals_);
Pstream::broadcast(evecs_);
return true;
}
@ -503,8 +503,8 @@ void Foam::DMDModels::STDMD::frequencies()
it = std::find_if(std::next(it), freqs_.cend(), margin);
}
}
Pstream::scatter(freqs_);
Pstream::scatter(freqsi_);
Pstream::broadcast(freqs_);
Pstream::broadcast(freqsi_);
}
@ -567,7 +567,7 @@ void Foam::DMDModels::STDMD::amplitudes()
}
}
}
Pstream::scatter(amps_);
Pstream::broadcast(amps_);
}
@ -648,8 +648,8 @@ void Foam::DMDModels::STDMD::magnitudes()
std::sort(magsi_.begin(), magsi_.end(), descend);
}
Pstream::scatter(mags_);
Pstream::scatter(magsi_);
Pstream::broadcast(mags_);
Pstream::broadcast(magsi_);
}

View File

@ -87,8 +87,8 @@ bool Foam::functionObjects::columnAverage::columnAverageField
}
// Global sum
Pstream::listCombineAllGather(regionField, plusEqOp<Type>());
Pstream::listCombineAllGather(regionCount, plusEqOp<label>());
Pstream::listCombineReduce(regionField, plusEqOp<Type>());
Pstream::listCombineReduce(regionCount, plusEqOp<label>());
forAll(regionField, regioni)
{

View File

@ -430,7 +430,7 @@ void Foam::functionObjects::externalCoupled::initCoupling()
|| isFile(dir/"patchFaces");
}
Pstream::scatter(geomExists);
Pstream::broadcast(geomExists);
if (!geomExists)
{

View File

@ -333,7 +333,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing
// Create map from new regions to slots in particles list
// - filter through new-to-new addressing to identify new particles
Pstream::listCombineAllGather(newToNewRegion, maxEqOp<label>());
Pstream::listCombineReduce(newToNewRegion, maxEqOp<label>());
label nParticle = -1;
labelHashSet newRegions;
@ -352,7 +352,7 @@ void Foam::functionObjects::extractEulerianParticles::calculateAddressing
// Accumulate old region data or create a new particle if there is no
// mapping from the old-to-new region
Pstream::listCombineAllGather(oldToNewRegion, maxEqOp<label>());
Pstream::listCombineReduce(oldToNewRegion, maxEqOp<label>());
List<eulerianParticle> newParticles(newRegionToParticleMap.size());
forAll(oldToNewRegion, oldRegioni)

View File

@ -66,7 +66,7 @@ static Map<Type> regionSum(const regionSplit& regions, const Field<Type>& fld)
regionToSum(regioni, Type(Zero)) += fld[celli];
}
Pstream::mapCombineAllGather(regionToSum, plusEqOp<Type>());
Pstream::mapCombineReduce(regionToSum, plusEqOp<Type>());
return regionToSum;
}
@ -214,7 +214,7 @@ Foam::functionObjects::regionSizeDistribution::findPatchRegions
// Make sure all the processors have the same set of regions
Pstream::mapCombineAllGather(patchRegions, minEqOp<label>());
Pstream::mapCombineReduce(patchRegions, minEqOp<label>());
return patchRegions;
}

View File

@ -800,7 +800,7 @@ bool Foam::functionObjects::streamLineBase::writeToFile()
// File names generated on the master but setProperty needed everywher
Pstream::scatter(outputFileNames);
Pstream::broadcast(outputFileNames);
forAllConstIters(outputFileNames, iter)
{

View File

@ -470,7 +470,7 @@ void Foam::functionObjects::propellerInfo::updateSampleDiskCells()
}
}
Pstream::listCombineAllGather(pointMask_, orEqOp<bool>());
Pstream::listCombineReduce(pointMask_, orEqOp<bool>());
}
@ -785,7 +785,7 @@ Foam::tmp<Foam::Field<Type>> Foam::functionObjects::propellerInfo::interpolate
}
}
Pstream::listCombineAllGather(field, maxEqOp<Type>());
Pstream::listCombineReduce(field, maxEqOp<Type>());
return tfield;
}

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2018-2021 OpenCFD Ltd.
Copyright (C) 2018-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -56,11 +56,8 @@ Foam::wordList Foam::functionObjects::vtkCloud::writeFields
// Thus need to resolve names between all processors.
wordList fieldNames(obrTmp.names<IOField<Type>>());
Pstream::combineGather(fieldNames, ListOps::uniqueEqOp<word>());
Pstream::broadcast(fieldNames);
// Consistent order on all processors
Foam::sort(fieldNames);
Pstream::combineReduce(fieldNames, ListOps::uniqueEqOp<word>());
Foam::sort(fieldNames); // Consistent order
for (const word& fieldName : fieldNames)
{

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;

View File

@ -104,7 +104,7 @@ void Foam::Cloud<ParticleType>::writeCloudUniformProperties() const
labelList np(Pstream::nProcs(), Zero);
np[Pstream::myProcNo()] = ParticleType::particleCount_;
Pstream::listCombineAllGather(np, maxEqOp<label>());
Pstream::listCombineReduce(np, maxEqOp<label>());
uniformPropsDict.add
(

View File

@ -361,8 +361,7 @@ void Foam::ParticleZoneInfo<CloudType>::write()
{
// Find number of particles per proc
labelList allMaxIDs(maxIDs_);
Pstream::listCombineGather(allMaxIDs, maxEqOp<label>());
Pstream::broadcast(allMaxIDs);
Pstream::listCombineReduce(allMaxIDs, maxEqOp<label>());
// Combine into single list
label n = returnReduce(data_.size(), sumOp<label>());

View File

@ -120,7 +120,7 @@ void Foam::CellZoneInjection<CloudType>::setPositions
globalPositions.localStart(Pstream::myProcNo())
) = positions;
Pstream::listCombineAllGather(allPositions, minEqOp<point>());
Pstream::listCombineReduce(allPositions, minEqOp<point>());
// Gather local cell tet and tet-point Ids, but leave non-local ids set -1
SubList<label>

View File

@ -6,7 +6,7 @@
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2011-2017 OpenFOAM Foundation
Copyright (C) 2015-2021 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -417,7 +417,7 @@ Foam::label Foam::InflationInjection<CloudType>::parcelsToInject
newParticles_ = combinedNewParticles;
}
Pstream::scatter(newParticles_);
Pstream::broadcast(newParticles_);
}
return newParticles_.size();

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -62,8 +62,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
{
List<List<label>> procTag(Pstream::nProcs());
procTag[Pstream::myProcNo()].transfer(tag);
Pstream::gatherList(procTag);
Pstream::scatterList(procTag);
Pstream::allGatherList(procTag);
tag =
ListListOps::combine<List<label>>
(
@ -72,8 +71,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<point>> procPosition(Pstream::nProcs());
procPosition[Pstream::myProcNo()].transfer(position);
Pstream::gatherList(procPosition);
Pstream::scatterList(procPosition);
Pstream::allGatherList(procPosition);
position =
ListListOps::combine<List<point>>
(
@ -82,8 +80,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<vector>> procU(Pstream::nProcs());
procU[Pstream::myProcNo()].transfer(U);
Pstream::gatherList(procU);
Pstream::scatterList(procU);
Pstream::allGatherList(procU);
U =
ListListOps::combine<List<vector>>
(
@ -92,8 +89,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<scalar>> procSOI(Pstream::nProcs());
procSOI[Pstream::myProcNo()].transfer(soi);
Pstream::gatherList(procSOI);
Pstream::scatterList(procSOI);
Pstream::allGatherList(procSOI);
soi =
ListListOps::combine<List<scalar>>
(
@ -102,8 +98,7 @@ void Foam::InjectedParticleDistributionInjection<CloudType>::initialise()
List<List<scalar>> procD(Pstream::nProcs());
procD[Pstream::myProcNo()].transfer(d);
Pstream::gatherList(procD);
Pstream::scatterList(procD);
Pstream::allGatherList(procD);
d =
ListListOps::combine<List<scalar>>
(

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2015-2020 OpenCFD Ltd.
Copyright (C) 2015-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -62,8 +62,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
{
List<List<scalar>> procTime(Pstream::nProcs());
procTime[Pstream::myProcNo()].transfer(time);
Pstream::gatherList(procTime);
Pstream::scatterList(procTime);
Pstream::allGatherList(procTime);
time =
ListListOps::combine<List<scalar>>
(
@ -72,8 +71,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
List<List<point>> procPosition(Pstream::nProcs());
procPosition[Pstream::myProcNo()].transfer(position);
Pstream::gatherList(procPosition);
Pstream::scatterList(procPosition);
Pstream::allGatherList(procPosition);
position =
ListListOps::combine<List<point>>
(
@ -82,8 +80,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
List<List<scalar>> procD(Pstream::nProcs());
procD[Pstream::myProcNo()].transfer(diameter);
Pstream::gatherList(procD);
Pstream::scatterList(procD);
Pstream::allGatherList(procD);
diameter =
ListListOps::combine<List<scalar>>
(
@ -92,8 +89,7 @@ void Foam::InjectedParticleInjection<CloudType>::initialise()
List<List<vector>> procU(Pstream::nProcs());
procU[Pstream::myProcNo()].transfer(U);
Pstream::gatherList(procU);
Pstream::scatterList(procU);
Pstream::allGatherList(procU);
U =
ListListOps::combine<List<vector>>
(

View File

@ -114,7 +114,7 @@ void Foam::patchInjectionBase::updateMesh(const polyMesh& mesh)
sumTriMagSf_ = Zero;
sumTriMagSf_[Pstream::myProcNo() + 1] = sum(triMagSf);
Pstream::listCombineAllGather(sumTriMagSf_, maxEqOp<scalar>());
Pstream::listCombineReduce(sumTriMagSf_, maxEqOp<scalar>());
for (label i = 1; i < triMagSf.size(); i++)
{

View File

@ -181,7 +181,7 @@ inline Foam::scalar Foam::SprayCloud<CloudType>::penetration
}
}
Pstream::scatter(distance);
Pstream::broadcast(distance);
return distance;
}

View File

@ -880,7 +880,7 @@ Foam::List<Foam::scalar> Foam::lumpedPointMovement::areas
}
}
Pstream::listCombineAllGather(zoneAreas, plusEqOp<scalar>());
Pstream::listCombineReduce(zoneAreas, plusEqOp<scalar>());
return zoneAreas;
}
@ -1008,8 +1008,8 @@ bool Foam::lumpedPointMovement::forcesAndMoments
Info<<"No pressure field" << endl;
}
Pstream::listCombineAllGather(forces, plusEqOp<vector>());
Pstream::listCombineAllGather(moments, plusEqOp<vector>());
Pstream::listCombineReduce(forces, plusEqOp<vector>());
Pstream::listCombineReduce(moments, plusEqOp<vector>());
return true;
}

View File

@ -1973,7 +1973,7 @@ Foam::autoPtr<Foam::mapDistributePolyMesh> Foam::meshRefinement::balance
labelList nProcCells(distributor.countCells(distribution));
Pout<< "Wanted distribution:" << nProcCells << endl;
Pstream::listCombineAllGather(nProcCells, plusEqOp<label>());
Pstream::listCombineReduce(nProcCells, plusEqOp<label>());
Pout<< "Wanted resulting decomposition:" << endl;
forAll(nProcCells, proci)

View File

@ -823,7 +823,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::createZoneBaffles
if (nTotalBaffles > 0)
{
Pstream::listCombineAllGather(nBaffles, plusEqOp<label>());
Pstream::listCombineReduce(nBaffles, plusEqOp<label>());
Info<< nl
<< setf(ios_base::left)
@ -1953,7 +1953,7 @@ void Foam::meshRefinement::findCellZoneTopo
// - region numbers are identical on all processors
// - keepRegion is identical ,,
// - cellZones are identical ,,
Pstream::listCombineAllGather(regionToCellZone, maxEqOp<label>());
Pstream::listCombineReduce(regionToCellZone, maxEqOp<label>());
// Find the region containing the keepPoint
@ -2003,7 +2003,7 @@ void Foam::meshRefinement::findCellZoneTopo
// - cellZones are identical ,,
// This done at top of loop to account for geometric matching
// not being synchronised.
Pstream::listCombineAllGather(regionToCellZone, maxEqOp<label>());
Pstream::listCombineReduce(regionToCellZone, maxEqOp<label>());
bool changed = false;
@ -5862,7 +5862,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
// 2.Combine faceZoneNames allocated on different processors
Pstream::mapCombineAllGather(zonesToFaceZone, eqOp<word>());
Pstream::mapCombineReduce(zonesToFaceZone, eqOp<word>());
// 3. Allocate faceZones from (now synchronised) faceZoneNames
@ -6085,7 +6085,7 @@ Foam::autoPtr<Foam::mapPolyMesh> Foam::meshRefinement::zonify
nPosOrientation.find(faceToConnectedZone[faceI])() += n;
}
}
Pstream::mapCombineAllGather(nPosOrientation, plusEqOp<label>());
Pstream::mapCombineReduce(nPosOrientation, plusEqOp<label>());
Info<< "Split " << nFreeStanding << " free-standing zone faces"

View File

@ -3263,9 +3263,9 @@ void Foam::snappyRefineDriver::deleteSmallRegions
nCellsPerRegion[regioni]++;
nCellsPerZone[zonei]++;
}
Pstream::listCombineAllGather(nCellsPerRegion, plusEqOp<label>());
Pstream::listCombineAllGather(regionToZone, maxEqOp<label>());
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>());
Pstream::listCombineReduce(nCellsPerRegion, plusEqOp<label>());
Pstream::listCombineReduce(regionToZone, maxEqOp<label>());
Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
// Mark small regions. Note that all processors have the same information

View File

@ -282,9 +282,9 @@ Foam::externalFileCoupler::waitForMaster() const
}
}
label intAction(action);
Pstream::scatter(intAction); // Also acts as MPI barrier
// Send to sub-ranks. Also acts as an MPI barrier
int intAction(action);
Pstream::broadcast(intAction);
return Time::stopAtControls(intAction);
}
@ -326,9 +326,9 @@ Foam::externalFileCoupler::waitForSlave() const
Log << type() << ": found lock file " << lck << endl;
}
label intAction(action);
Pstream::scatter(intAction); // Also acts as MPI barrier
// Send to sub-ranks. Also acts as an MPI barrier
int intAction(action);
Pstream::broadcast(intAction);
return Time::stopAtControls(intAction);
}

View File

@ -668,7 +668,7 @@ void Foam::mappedPatchBase::findSamples
// Find nearest - globally consistent
Pstream::listCombineAllGather
Pstream::listCombineReduce
(
nearest,
nearestWorldEqOp(),

View File

@ -5,7 +5,7 @@
\\ / A nd | www.openfoam.com
\\/ M anipulation |
-------------------------------------------------------------------------------
Copyright (C) 2021 OpenCFD Ltd.
Copyright (C) 2021-2022 OpenCFD Ltd.
-------------------------------------------------------------------------------
License
This file is part of OpenFOAM.
@ -241,12 +241,7 @@ void Foam::multiWorldConnections::createComms()
if (Pstream::parRun())
{
Pstream::combineGather
(
allConnections,
worldConnectBitOrEq()
);
Pstream::scatter(allConnections);
Pstream::combineReduce(allConnections, worldConnectBitOrEq());
}
// Check for mismatched connections

View File

@ -70,7 +70,7 @@ bool writeTopoSet
const topoSet& set,
const vtk::outputOptions opts,
const fileName& file,
bool parallel = Pstream::parRun()
bool parallel = UPstream::parRun()
);
@ -83,7 +83,7 @@ bool writeFaceSet
const faceSet& set,
const vtk::outputOptions opts,
const fileName& file,
bool parallel = Pstream::parRun()
bool parallel = UPstream::parRun()
);
@ -96,7 +96,7 @@ bool writeCellSetFaces
const cellSet& set,
const vtk::outputOptions opts,
const fileName& file,
bool parallel = Pstream::parRun()
bool parallel = UPstream::parRun()
);
@ -109,7 +109,7 @@ bool writePointSet
const pointSet& set,
const vtk::outputOptions opts,
const fileName& file,
bool parallel = Pstream::parRun()
bool parallel = UPstream::parRun()
);

View File

@ -139,7 +139,7 @@ Foam::regionSplit2D::regionSplit2D
// Ensure regionToCompactAddr consistent across all processors
// - not concerned about the op (keys are unique)
// - map size will be the number of regions in the set of faces
Pstream::mapCombineAllGather(regionToCompactAddr, minEqOp<label>());
Pstream::mapCombineReduce(regionToCompactAddr, minEqOp<label>());
nRegions_ = regionToCompactAddr.size();

View File

@ -462,7 +462,7 @@ Foam::triSurfaceMesh::triSurfaceMesh(const IOobject& io, const readAction r)
triSurface s2(actualFile);
triSurface::transfer(s2);
}
Pstream::scatter(triSurface::patches());
Pstream::broadcast(triSurface::patches());
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"
@ -587,7 +587,7 @@ Foam::triSurfaceMesh::triSurfaceMesh
triSurface s2(actualFile, surfType, scaleFactor);
triSurface::transfer(s2);
}
Pstream::scatter(triSurface::patches());
Pstream::broadcast(triSurface::patches());
if (debug)
{
Pout<< "triSurfaceMesh(const IOobject& io) :"

View File

@ -85,7 +85,7 @@ void Foam::nearestToCell::combine(topoSet& set, const bool add) const
);
}
Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
for (const auto& near : nearest)
{

View File

@ -176,7 +176,7 @@ void Foam::regionToFace::combine(topoSet& set, const bool add) const
}
// Globally reduce
Pstream::combineAllGather(ni, mappedPatchBase::nearestEqOp());
Pstream::combineReduce(ni, mappedPatchBase::nearestEqOp());
if (verbose_)
{

View File

@ -217,7 +217,7 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const
regionRegions[regioni].unset(regioni);
}
}
Pstream::listCombineAllGather(regionRegions, bitOrEqOp<bitSet>());
Pstream::listCombineReduce(regionRegions, bitOrEqOp<bitSet>());
// Collapse the region connections into a map between each region
// and the lowest numbered region that it connects to
@ -258,7 +258,7 @@ void Foam::planeToFaceZone::combine(faceZoneSet& fzSet, const bool add) const
{
++ regionNFaces[regioni];
}
Pstream::listCombineAllGather(regionNFaces, plusEqOp<label>());
Pstream::listCombineReduce(regionNFaces, plusEqOp<label>());
Info<< " Found " << nRegions << " contiguous regions with "
<< regionNFaces << " faces" << endl;

View File

@ -104,7 +104,7 @@ void Foam::nearestToPoint::combine(topoSet& set, const bool add) const
}
Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
for (const auto& near : nearest)
{

View File

@ -1010,7 +1010,7 @@ Foam::vectorField Foam::NURBS3DVolume::computeControlPointSensitivities
}
// Sum contributions from all processors
Pstream::listCombineAllGather(controlPointDerivs, plusEqOp<vector>());
Pstream::listCombineReduce(controlPointDerivs, plusEqOp<vector>());
return controlPointDerivs;
}
@ -1095,7 +1095,7 @@ Foam::vectorField Foam::NURBS3DVolume::computeControlPointSensitivities
}
}
// Sum contributions from all processors
Pstream::listCombineAllGather(controlPointDerivs, plusEqOp<vector>());
Pstream::listCombineReduce(controlPointDerivs, plusEqOp<vector>());
return controlPointDerivs;
}

View File

@ -377,7 +377,7 @@ void Foam::cellCellStencils::cellVolumeWeight::findHoles
{
// Synchronise region status on processors
// (could instead swap status through processor patches)
Pstream::listCombineAllGather(regionType, maxEqOp<label>());
Pstream::listCombineReduce(regionType, maxEqOp<label>());
// Communicate region status through interpolative cells
labelList cellRegionType(labelUIndList(regionType, cellRegion));
@ -754,7 +754,7 @@ bool Foam::cellCellStencils::cellVolumeWeight::update()
{
nCellsPerZone[zoneID[cellI]]++;
}
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>());
Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
Info<< typeName << " : detected " << nZones

View File

@ -1118,7 +1118,7 @@ void Foam::cellCellStencils::inverseDistance::findHoles
{
// Synchronise region status on processors
// (could instead swap status through processor patches)
Pstream::listCombineAllGather(regionType, maxEqOp<label>());
Pstream::listCombineReduce(regionType, maxEqOp<label>());
DebugInfo<< FUNCTION_NAME << " : Gathered region type" << endl;
@ -1722,7 +1722,7 @@ bool Foam::cellCellStencils::inverseDistance::update()
{
nCellsPerZone[zoneID[cellI]]++;
}
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>());
Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
const boundBox& allBb(mesh_.bounds());

View File

@ -517,7 +517,7 @@ Foam::cellCellStencils::trackingInverseDistance::trackingInverseDistance
{
nCellsPerZone[zoneID[celli]]++;
}
Pstream::listCombineAllGather(nCellsPerZone, plusEqOp<label>());
Pstream::listCombineReduce(nCellsPerZone, plusEqOp<label>());
meshParts_.setSize(nZones);
forAll(meshParts_, zonei)

View File

@ -68,7 +68,7 @@ void Foam::setRefCells
}
}
Pstream::listCombineAllGather(regionNeedReference, orEqOp<bool>());
Pstream::listCombineReduce(regionNeedReference, orEqOp<bool>());
}
@ -188,7 +188,7 @@ void Foam::setRefCells
}
}
Pstream::listCombineAllGather(hasRef, plusEqOp<label>());
Pstream::listCombineReduce(hasRef, plusEqOp<label>());
forAll(hasRef, regionI)
{

View File

@ -480,7 +480,7 @@ void Foam::decompositionMethod::calcCellCells
// Create global cell numbers
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
const globalIndex globalAgglom(nLocalCoarse, Pstream::worldComm, parallel);
const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel);
// Get agglomerate owner on other side of coupled faces
@ -673,7 +673,7 @@ void Foam::decompositionMethod::calcCellCells
// Create global cell numbers
// ~~~~~~~~~~~~~~~~~~~~~~~~~~
const globalIndex globalAgglom(nLocalCoarse, Pstream::worldComm, parallel);
const globalIndex globalAgglom(nLocalCoarse, UPstream::worldComm, parallel);
// Get agglomerate owner on other side of coupled faces

View File

@ -419,11 +419,7 @@ void Foam::multiLevelDecomp::decompose
label nPoints = returnReduce(domainPoints.size(), sumOp<label>());
Pstream::listCombineAllGather
(
nOutsideConnections,
plusEqOp<label>()
);
Pstream::listCombineReduce(nOutsideConnections, plusEqOp<label>());
label nPatches = 0;
label nFaces = 0;
for (const label nConnect : nOutsideConnections)
@ -530,7 +526,7 @@ void Foam::multiLevelDecomp::decompose
}
reduce(nPoints, sumOp<label>());
Pstream::listCombineAllGather
Pstream::listCombineReduce
(
nOutsideConnections,
plusEqOp<label>()

View File

@ -101,7 +101,7 @@ void Foam::faMeshReconstructor::calcAddressing
? 0
: singlePatchFaceLabels_.first()
);
Pstream::scatter(patchFirstMeshfacei);
Pstream::broadcast(patchFirstMeshfacei);
for (label& facei : faFaceProcAddr_)
{
@ -169,7 +169,7 @@ void Foam::faMeshReconstructor::calcAddressing
}
// Broadcast the same information everywhere
Pstream::scatter(singlePatchFaceLabels_);
Pstream::broadcast(singlePatchFaceLabels_);
// ------------------
@ -283,7 +283,7 @@ void Foam::faMeshReconstructor::calcAddressing
mpm[mp[i]] = i;
}
}
Pstream::scatter(mpm);
Pstream::broadcast(mpm);
// Rewrite pointToGlobal according to the correct point order
for (label& pointi : pointToGlobal)
@ -299,8 +299,8 @@ void Foam::faMeshReconstructor::calcAddressing
}
// Broadcast the same information everywhere
Pstream::scatter(singlePatchFaces_);
Pstream::scatter(singlePatchPoints_);
Pstream::broadcast(singlePatchFaces_);
Pstream::broadcast(singlePatchPoints_);
// Now have enough global information to determine global edge mappings
@ -383,13 +383,8 @@ void Foam::faMeshReconstructor::calcAddressing
// OR patchEdgeLabels =
// UIndirectList<label>(faEdgeProcAddr_, fap.edgeLabels());
// Collect from all processors
Pstream::combineAllGather
(
patchEdgeLabels,
ListOps::appendEqOp<label>()
);
// Combine from all processors
Pstream::combineReduce(patchEdgeLabels, ListOps::appendEqOp<label>());
// Sorted order will be the original non-decomposed order
Foam::sort(patchEdgeLabels);

View File

@ -142,7 +142,7 @@ void Foam::regionModels::singleLayerRegion::initialise()
}
}
Pstream::listCombineAllGather(passivePatchIDs_, maxEqOp<label>());
Pstream::listCombineReduce(passivePatchIDs_, maxEqOp<label>());
magSf.field() = 0.5*(magSf + passiveMagSf);
magSf.correctBoundaryConditions();

View File

@ -190,7 +190,7 @@ void Foam::RBD::rigidBodyMotion::solve
solver_->solve(tau, fx);
}
Pstream::scatter(motionState_);
Pstream::broadcast(motionState_);
// Update the body-state to correspond to the current joint-state
forwardDynamicsCorrection(motionState_);

View File

@ -166,7 +166,7 @@ void Foam::patchProbes::findElements(const fvMesh& mesh)
// Find nearest - globally consistent
Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
oldPoints_.resize(this->size());

View File

@ -111,7 +111,7 @@ Foam::patchProbes::sample(const VolumeField<Type>& vField) const
}
}
Pstream::listCombineAllGather(values, isNotEqOp<Type>());
Pstream::listCombineReduce(values, isNotEqOp<Type>());
return tvalues;
}
@ -141,7 +141,7 @@ Foam::patchProbes::sample(const SurfaceField<Type>& sField) const
}
}
Pstream::listCombineAllGather(values, isNotEqOp<Type>());
Pstream::listCombineReduce(values, isNotEqOp<Type>());
return tvalues;
}

View File

@ -225,7 +225,7 @@ Foam::probes::sample(const VolumeField<Type>& vField) const
}
}
Pstream::listCombineAllGather(values, isNotEqOp<Type>());
Pstream::listCombineReduce(values, isNotEqOp<Type>());
return tvalues;
}
@ -248,7 +248,7 @@ Foam::probes::sample(const SurfaceField<Type>& sField) const
}
}
Pstream::listCombineAllGather(values, isNotEqOp<Type>());
Pstream::listCombineReduce(values, isNotEqOp<Type>());
return tvalues;
}

View File

@ -84,8 +84,8 @@ void Foam::cloudSet::calcSamples
minFoundProc[i] = foundProc[i];
}
}
Pstream::listCombineAllGather(minFoundProc, minEqOp<label>());
Pstream::listCombineAllGather(maxFoundProc, maxEqOp<label>());
Pstream::listCombineReduce(minFoundProc, minEqOp<label>());
Pstream::listCombineReduce(maxFoundProc, maxEqOp<label>());
DynamicField<point> missingPoints(sampleCoords_.size());

View File

@ -155,7 +155,7 @@ void Foam::patchCloudSet::calcSamples
// Find nearest - globally consistent
Pstream::listCombineAllGather(nearest, mappedPatchBase::nearestEqOp());
Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
if (debug && Pstream::master())

View File

@ -178,11 +178,7 @@ void Foam::patchSeedSet::calcSamples
// 2. Reduce on master. Select nearest processor.
// Find nearest - globally consistent
Pstream::listCombineAllGather
(
nearest,
mappedPatchBase::nearestEqOp()
);
Pstream::listCombineReduce(nearest, mappedPatchBase::nearestEqOp());
// 3. Pick up my local faces that have won

View File

@ -196,7 +196,7 @@ Foam::IOobjectList Foam::sampledSets::preCheckFields(unsigned request)
// Parallel consistency (no-op in serial)
// Probably not needed...
/// Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>());
/// Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>());
DynamicList<label> missed(fieldSelection_.size());

View File

@ -264,7 +264,7 @@ void Foam::shortestPathSet::sync
celli,
Tuple2<point, bool>(origin, findMinDistance)
);
Pstream::combineAllGather
Pstream::combineReduce
(
searchData,
[](ProcData& x, const ProcData& y)

View File

@ -227,7 +227,7 @@ bool Foam::sampledMeshedSurface::update(const meshSearch& meshSearcher)
// See which processor has the nearest. Mark and subset
// ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Pstream::listCombineAllGather(nearest, minFirstEqOp<scalar>{});
Pstream::listCombineReduce(nearest, minFirstEqOp<scalar>{});
labelList cellOrFaceLabels(fc.size(), -1);

View File

@ -119,7 +119,7 @@ Foam::IOobjectList Foam::sampledSurfaces::preCheckFields()
}
// Parallel consistency (no-op in serial)
Pstream::mapCombineAllGather(selected, HashSetOps::plusEqOp<word>());
Pstream::mapCombineReduce(selected, HashSetOps::plusEqOp<word>());
DynamicList<label> missed(fieldSelection_.size());

View File

@ -262,7 +262,7 @@ void Foam::isoSurfacePoint::syncUnseparatedPoints
}
// Globally consistent
Pstream::listCombineAllGather(sharedPts, minEqOp<point>());
Pstream::listCombineReduce(sharedPts, minEqOp<point>());
// Now we will all have the same information. Merge it back with
// my local information.

View File

@ -323,7 +323,7 @@ void Foam::sixDoFRigidBodyMotion::update
}
}
Pstream::scatter(motionState_);
Pstream::broadcast(motionState_);
}

Some files were not shown because too many files have changed in this diff Show More