mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
ENH: bundle Pstream:: AllGather methods
- bundles frequently used 'gather/scatter' patterns more consistently. - combineAllGather -> combineGather + broadcast - listCombineAllGather -> listCombineGather + broadcast - mapCombineAllGather -> mapCombineGather + broadcast - allGatherList -> gatherList + scatterList - reduce -> gather + broadcast (ie, allreduce) - The allGatherList currently wraps gatherList/scatterList, but may be replaced with a different algorithm in the future. STYLE: PstreamCombineReduceOps.H is mostly unneeded now
This commit is contained in:
@ -104,12 +104,11 @@ if (timeDirs.size() && doLagrangian)
|
||||
{
|
||||
for (auto& cloudFields : regionCloudFields)
|
||||
{
|
||||
Pstream::mapCombineGather
|
||||
Pstream::mapCombineAllGather
|
||||
(
|
||||
cloudFields,
|
||||
HashTableOps::plusEqOp<word>()
|
||||
);
|
||||
Pstream::broadcast(cloudFields);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -122,7 +122,7 @@ Usage
|
||||
#include "IOobjectList.H"
|
||||
#include "IOmanip.H"
|
||||
#include "OFstream.H"
|
||||
#include "PstreamCombineReduceOps.H"
|
||||
#include "Pstream.H"
|
||||
#include "HashOps.H"
|
||||
#include "regionProperties.H"
|
||||
|
||||
|
||||
@ -187,8 +187,7 @@ int main(int argc, char *argv[])
|
||||
const label maxNProcs = returnReduce(maxIds.size(), maxOp<label>());
|
||||
maxIds.resize(maxNProcs, -1);
|
||||
|
||||
Pstream::listCombineGather(maxIds, maxEqOp<label>());
|
||||
Pstream::broadcast(maxIds);
|
||||
Pstream::listCombineAllGather(maxIds, maxEqOp<label>());
|
||||
|
||||
// From ids to count
|
||||
const labelList numIds = maxIds + 1;
|
||||
|
||||
@ -40,8 +40,7 @@ Foam::Field<T> Foam::channelIndex::regionSum(const Field<T>& cellField) const
|
||||
}
|
||||
|
||||
// Global sum
|
||||
Pstream::listCombineGather(regionField, plusEqOp<T>());
|
||||
Pstream::broadcast(regionField);
|
||||
Pstream::listCombineAllGather(regionField, plusEqOp<T>());
|
||||
|
||||
return regionField;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user