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

@ -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)
{