Buffers for inter-processor communications streams (UOPstream, UIPstream). More...
Public Member Functions | |
PstreamBuffers (const UPstream::commsTypes commsType, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY) | |
Construct given comms type, message tag, communicator, IO format. More... | |
PstreamBuffers (const label comm, const UPstream::commsTypes commsType, const int tag=UPstream::msgType(), IOstreamOption::streamFormat fmt=IOstreamOption::BINARY) | |
Construct given communicator, comms type, message tag, IO format. More... | |
~PstreamBuffers () | |
Destructor - checks that all data have been consumed. More... | |
IOstreamOption::streamFormat | format () const noexcept |
The associated buffer format (ascii | binary) More... | |
UPstream::commsTypes | commsType () const noexcept |
The communications type of the stream. More... | |
int | tag () const noexcept |
The transfer message type. More... | |
label | comm () const noexcept |
Communicator. More... | |
label | nProcs () const noexcept |
Number of ranks associated with PstreamBuffers. More... | |
UPstream::rangeType | allProcs () const noexcept |
Range of ranks indices associated with PstreamBuffers. More... | |
UPstream::rangeType | subProcs () const noexcept |
Range of sub-processes indices associated with PstreamBuffers. More... | |
bool | finished () const noexcept |
True if finishedSends() or finishedNeighbourSends() has been called. More... | |
bool | allowClearRecv () const noexcept |
bool | hasSendData () const |
True if any (local) send buffers have data. More... | |
bool | hasRecvData () const |
label | sendDataCount (const label proci) const |
Number of send bytes for the specified processor. More... | |
label | recvDataCount (const label proci) const |
labelList | recvDataCounts () const |
const UList< char > | peekRecvData (const label proci) const |
void | clear () |
Clear individual buffers and reset states. More... | |
void | clearRecv (const label proci) |
Clear an individual receive buffer (eg, data not required) More... | |
void | clearStorage () |
Clear individual buffer storage and reset states. More... | |
bool | allowClearRecv (bool on) noexcept |
Change allowClearRecv, return previous value. More... | |
void | finishedSends (const bool wait=true) |
Mark sends as done. More... | |
void | finishedSends (labelList &recvSizes, const bool wait=true) |
void | finishedSends (const labelUList &sendProcs, const labelUList &recvProcs, const bool wait=true) |
void | finishedSends (const labelUList &sendProcs, const labelUList &recvProcs, labelList &recvSizes, const bool wait=true) |
bool | finishedSends (bitSet &sendConnections, DynamicList< label > &sendProcs, DynamicList< label > &recvProcs, const bool wait=true) |
A caching version that uses a limited send/recv connectivity. More... | |
void | finishedNeighbourSends (const labelUList &neighProcs, const bool wait=true) |
void | finishedNeighbourSends (const labelUList &neighProcs, labelList &recvSizes, const bool wait=true) |
void | finishedGathers (const bool wait=true) |
Mark all sends to master as done. More... | |
void | finishedGathers (labelList &recvSizes, const bool wait=true) |
void | finishedScatters (const bool wait=true) |
Mark all sends to sub-procs as done. More... | |
void | finishedScatters (labelList &recvSizes, const bool wait=true) |
Friends | |
class | UOPstreamBase |
class | UIPstreamBase |
Buffers for inter-processor communications streams (UOPstream, UIPstream).
Use UOPstream to stream data into buffers, call finishedSends() to notify that data is in buffers and then use IUPstream to get data out of received buffers. Works with both blocking and nonBlocking. Does not make much sense with scheduled since there you would not need these explicit buffers.
Example usage:
There are additional special versions of finishedSends() for restricted neighbour communication as well as for special one-to-all and all-to-one communication patterns. For example,
Definition at line 117 of file PstreamBuffers.H.
|
explicit |
Construct given comms type, message tag, communicator, IO format.
Definition at line 161 of file PstreamBuffers.C.
|
explicit |
Construct given communicator, comms type, message tag, IO format.
Definition at line 181 of file PstreamBuffers.C.
~PstreamBuffers | ( | ) |
Destructor - checks that all data have been consumed.
Definition at line 203 of file PstreamBuffers.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, and Foam::nl.
|
inlinenoexcept |
The associated buffer format (ascii | binary)
Definition at line 207 of file PstreamBuffers.H.
|
inlinenoexcept |
The communications type of the stream.
Definition at line 213 of file PstreamBuffers.H.
Referenced by faBoundaryMesh::calcGeometry(), faBoundaryMesh::movePoints(), pointBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), faBoundaryMesh::updateMesh(), pointBoundaryMesh::updateMesh(), and polyBoundaryMesh::updateMesh().
|
inlinenoexcept |
The transfer message type.
Definition at line 219 of file PstreamBuffers.H.
|
inlinenoexcept |
Communicator.
Definition at line 225 of file PstreamBuffers.H.
Referenced by processorFaPatch::initGeometry(), processorPolyPatch::initGeometry(), processorFaPatch::initUpdateMesh(), and processorPolyPatch::initUpdateMesh().
|
inlinenoexcept |
Number of ranks associated with PstreamBuffers.
Definition at line 234 of file PstreamBuffers.H.
References UList< T >::size().
Referenced by fvMeshPrimitiveLduAddressing::addAddressing(), surfaceZonesInfo::addCellZonesToMesh(), surfaceZonesInfo::addFaceZonesToMesh(), eagerGAMGProcAgglomeration::agglomerate(), manualGAMGProcAgglomeration::agglomerate(), masterCoarsestGAMGProcAgglomeration::agglomerate(), procFacesGAMGProcAgglomeration::agglomerate(), AMIInterpolation::agglomerate(), Pstream::allGatherList(), PstreamBuffers::allProcs(), sensitivitySurfacePoints::assembleSensitivities(), meshRefinement::balanceAndRefine(), faMesh::boundaryProcs(), faPatch::boundaryProcs(), faMesh::boundaryProcSizes(), faPatch::boundaryProcSizes(), Pstream::broadcast(), Pstream::broadcasts(), mapDistributeBase::calcCompactAddressing(), fieldMinMax::calcMinMaxFieldType(), decomposedBlockData::calcNumProcs(), surfaceNoise::calculate(), meshRefinement::checkCoupledFaceZones(), mappedPatchBase::collectSamples(), Pstream::combineAllGather(), fieldValue::combineFields(), sizeDistribution::combineFields(), Pstream::combineGather(), Pstream::combineScatter(), GAMGAgglomeration::continueAgglomerating(), fvMeshDistribute::countCells(), box::createLODMap(), box::createMap(), Foam::createReconstructMap(), meshRefinement::directionalRefineCandidates(), faMeshDistributor::distribute(), fvMeshDistribute::distribute(), distributedTriSurfaceMesh::distribute(), mapDistributeBase::distribute(), box::doRefineBoxes(), Pstream::exchange(), mapDistributeBase::exchangeAddressing(), mapDistributeBase::exchangeMasks(), Pstream::exchangeSizes(), extendedCentredCellToCellStencil::extendedCentredCellToCellStencil(), extendedCentredCellToFaceStencil::extendedCentredCellToFaceStencil(), extendedCentredFaceToCellStencil::extendedCentredFaceToCellStencil(), extendedUpwindCellToFaceStencil::extendedUpwindCellToFaceStencil(), distributedTriSurfaceMesh::findNearest(), mappedPatchBase::findSamples(), decomposedBlockData::gather(), Pstream::gather(), externalCoupled::gatherAndCombine(), Pstream::gatherList(), decomposedBlockData::gatherSlaveData(), globalIndex::get(), distributedTriSurfaceMesh::getVolumeType(), processorFaPatch::initGeometry(), processorPolyPatch::initGeometry(), viewFactor::initialise(), processorFaPatch::initUpdateMesh(), processorPolyPatch::initUpdateMesh(), Pstream::listCombineAllGather(), Pstream::listCombineGather(), Pstream::listCombineScatter(), UPstream::listGatherValues(), UPstream::listScatterValues(), distributedTriSurfaceMesh::localQueries(), LUscalarMatrix::LUscalarMatrix(), Pstream::mapCombineAllGather(), Pstream::mapCombineGather(), Pstream::mapCombineScatter(), mapDistributeBase::mapDistributeBase(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), masterUncollatedFileOperation::masterOp(), processorTopology::New(), masterUncollatedFileOperation::NewIFstream(), InflationInjection< CloudType >::parcelsToInject(), argList::parse(), ParticleZoneInfo< CloudType >::ParticleZoneInfo(), pointHistory::pointHistory(), RecycleInteraction< CloudType >::postEvolve(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), collatedFileOperation::printBanner(), mapDistributeBase::printLayout(), collatedFileOperation::processorsDir(), masterUncollatedFileOperation::read(), masterUncollatedFileOperation::readHeader(), masterUncollatedFileOperation::readStream(), meshRefinement::refineAndBalance(), meshRefinement::refineCandidates(), Foam::regionSum(), meshRefinement::removeGapCells(), parProfiling::report(), fvMeshSubset::reset(), faMeshBoundaryHalo::reset(), globalIndex::reset(), Pstream::scatter(), Pstream::scatterList(), mapDistributeBase::schedule(), Time::setControls(), zoneDistribute::setUpCommforZone(), ParSortableList< Type >::sort(), PstreamBuffers::subProcs(), inverseDistance::update(), trackingInverseDistance::update(), dynamicOversetFvMesh::updateAddressing(), turbulentDFSEMInletFvPatchVectorField::updateCoeffs(), globalMeshData::updateMesh(), ParticleZoneInfo< CloudType >::write(), decomposedBlockData::writeBlocks(), externalCoupled::writeGeometry(), isoAdvection::writeIsoFaces(), and streamLineBase::writeToFile().
|
inlinenoexcept |
Range of ranks indices associated with PstreamBuffers.
Definition at line 240 of file PstreamBuffers.H.
References PstreamBuffers::nProcs().
Referenced by refinementHistory::distribute(), mapDistributeBase::distribute(), box::doRefineBoxes(), globalIndex::get(), zoneDistribute::getDatafromOtherProc(), viewFactor::initialise(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), RecycleInteraction< CloudType >::postEvolve(), masterUncollatedFileOperation::read(), surfaceNoise::readSurfaceData(), mapDistributeBase::receive(), InteractionLists< ParticleType >::receiveReferredData(), mapDistributeBase::send(), InteractionLists< ParticleType >::sendReferredData(), box::setRefineFlags(), zoneDistribute::setUpCommforZone(), ParSortableList< Type >::sort(), syncObjects::sync(), energySpectrum::write(), box::writeBoxes(), and externalCoupled::writeGeometry().
|
inlinenoexcept |
Range of sub-processes indices associated with PstreamBuffers.
Definition at line 247 of file PstreamBuffers.H.
References PstreamBuffers::nProcs().
Referenced by LUscalarMatrix::LUscalarMatrix(), masterUncollatedFileOperation::NewIFstream(), argList::parse(), masterUncollatedFileOperation::read(), decomposedBlockData::readBlocks(), fieldsDistributor::readFields(), masterUncollatedFileOperation::readHeader(), masterUncollatedFileOperation::scatterList(), mapDistributeBase::schedule(), globalMeshData::sharedPoints(), LUscalarMatrix::solve(), surfaceNoise::surfaceAverage(), syncTools::syncEdgeMap(), syncTools::syncPointMap(), patchWriter::write(), patchMeshWriter::writeNeighIDs(), patchMeshWriter::writePatchIDs(), patchMeshWriter::writePoints(), and surfaceNoise::writeSurfaceData().
|
inlinenoexcept |
True if finishedSends() or finishedNeighbourSends() has been called.
Definition at line 257 of file PstreamBuffers.H.
Referenced by UIPstreamBase::UIPstreamBase().
|
inlinenoexcept |
Is clearStorage of individual receive buffer by external hooks allowed? (default: true)
Definition at line 264 of file PstreamBuffers.H.
Referenced by Cloud< ParticleType >::move().
bool hasSendData | ( | ) | const |
True if any (local) send buffers have data.
Definition at line 263 of file PstreamBuffers.C.
bool hasRecvData | ( | ) | const |
True if any (local) recv buffers have unconsumed data. Must call finishedSends() or other finished.. method first!
Definition at line 276 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and forAll.
Referenced by RecycleInteraction< CloudType >::postEvolve().
Foam::label sendDataCount | ( | const label | proci | ) | const |
Number of send bytes for the specified processor.
Definition at line 300 of file PstreamBuffers.C.
Foam::label recvDataCount | ( | const label | proci | ) | const |
Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other finished.. method first!
Definition at line 306 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
Referenced by globalIndex::get(), zoneDistribute::getDatafromOtherProc(), RecycleInteraction< CloudType >::postEvolve(), and zoneDistribute::setUpCommforZone().
Foam::labelList recvDataCounts | ( | ) | const |
Number of unconsumed receive bytes for all processors. Must call finishedSends() or other finished.. method first!
Definition at line 329 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, forAll, and Foam::Zero.
const Foam::UList< char > peekRecvData | ( | const label | proci | ) | const |
Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other finished.. method first!
The method is only useful in limited situations, such as when PstreamBuffers has been used to fill contiguous data (eg, using OPstream::write).
Definition at line 358 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
void clear | ( | ) |
Clear individual buffers and reset states.
Does not remove the buffer storage.
Definition at line 222 of file PstreamBuffers.C.
Referenced by fvMeshDistribute::distribute(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), and surfaceNoise::readSurfaceData().
void clearRecv | ( | const label | proci | ) |
Clear an individual receive buffer (eg, data not required)
Does not remove the buffer storage.
Definition at line 238 of file PstreamBuffers.C.
void clearStorage | ( | ) |
Clear individual buffer storage and reset states.
Definition at line 245 of file PstreamBuffers.C.
Change allowClearRecv, return previous value.
Definition at line 385 of file PstreamBuffers.C.
void finishedSends | ( | const bool | wait = true | ) |
Mark sends as done.
Non-blocking mode: populates receive buffers (all-to-all).
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 393 of file PstreamBuffers.C.
Referenced by faBoundaryMesh::calcGeometry(), fvMeshDistribute::distribute(), distributedTriSurfaceMesh::distribute(), mapDistributeBase::distribute(), box::doRefineBoxes(), globalIndex::get(), zoneDistribute::getDatafromOtherProc(), FaceCellWave< Type, TrackingData >::handleProcPatches(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), faBoundaryMesh::movePoints(), pointBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), masterUncollatedFileOperation::NewIFstream(), RecycleInteraction< CloudType >::postEvolve(), masterUncollatedFileOperation::read(), mapDistributeBase::send(), box::setRefineFlags(), zoneDistribute::setUpCommforZone(), syncObjects::sync(), faBoundaryMesh::updateMesh(), pointBoundaryMesh::updateMesh(), and polyBoundaryMesh::updateMesh().
Mark sends as done. Recovers the sizes (bytes) received.
Non-blocking mode: populates receive buffers (all-to-all).
[out] | recvSizes | the sizes (bytes) received |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 400 of file PstreamBuffers.C.
References UPstream::commsTypeNames, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and UPstream::nonBlocking.
void finishedSends | ( | const labelUList & | sendProcs, |
const labelUList & | recvProcs, | ||
const bool | wait = true |
||
) |
Mark sends as done using subset of send/recv ranks to exchange data on.
Non-blocking mode: populates receive buffers.
sendProcs | ranks used for sends |
recvProcs | ranks used for recvs |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 422 of file PstreamBuffers.C.
void finishedSends | ( | const labelUList & | sendProcs, |
const labelUList & | recvProcs, | ||
labelList & | recvSizes, | ||
const bool | wait = true |
||
) |
Mark sends as done using subset of send/recv ranks to exchange data on. Recovers the sizes (bytes) received.
Non-blocking mode: populates receive buffers.
sendProcs | ranks used for sends | |
recvProcs | ranks used for recvs | |
[out] | recvSizes | the sizes (bytes) received |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 434 of file PstreamBuffers.C.
References UPstream::commsTypeNames, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and UPstream::nonBlocking.
bool finishedSends | ( | bitSet & | sendConnections, |
DynamicList< label > & | sendProcs, | ||
DynamicList< label > & | recvProcs, | ||
const bool | wait = true |
||
) |
A caching version that uses a limited send/recv connectivity.
Non-blocking mode: populates receive buffers.
sendConnections | on/off for sending ranks |
sendProcs | ranks used for sends |
recvProcs | ranks used for recvs |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 458 of file PstreamBuffers.C.
References DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), forAll, Foam::reduce(), PackedList< Width >::resize(), bitSet::set(), and PackedList< Width >::size().
|
inline |
Mark sends as done using subset of send/recv ranks and recover the sizes (bytes) received.
Non-blocking mode: populates receive buffers.
neighProcs | ranks used for sends/recvs |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 397 of file PstreamBuffers.H.
Referenced by syncTools::syncBoundaryFaceList(), syncTools::syncEdgeMap(), and syncTools::syncPointMap().
|
inline |
Mark sends as done using subset of send/recv ranks and recover the sizes (bytes) received.
Non-blocking mode: it will populate receive buffers.
neighProcs | ranks used for sends/recvs | |
[out] | recvSizes | the sizes (bytes) received |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 416 of file PstreamBuffers.H.
void finishedGathers | ( | const bool | wait = true | ) |
Mark all sends to master as done.
Non-blocking mode: populates receive buffers. Can use recvDataCounts() method to recover sizes received.
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 526 of file PstreamBuffers.C.
Referenced by surfaceNoise::surfaceAverage(), energySpectrum::write(), and surfaceNoise::writeSurfaceData().
Mark all sends to master as done. Recovers the sizes (bytes) received.
Non-blocking mode: populates receive buffers (all-to-one).
[out] | recvSizes | the sizes (bytes) received |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 538 of file PstreamBuffers.C.
References UPstream::commsTypeNames, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and UPstream::nonBlocking.
void finishedScatters | ( | const bool | wait = true | ) |
Mark all sends to sub-procs as done.
Non-blocking mode: populates receive buffers. Can use recvDataCounts() method to recover sizes received.
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 532 of file PstreamBuffers.C.
Referenced by decomposedBlockData::readBlocks(), masterUncollatedFileOperation::readHeader(), surfaceNoise::readSurfaceData(), and masterUncollatedFileOperation::scatterList().
Mark all sends to sub-procs as done. Recovers the sizes (bytes) received.
Non-blocking mode: populates receive buffers (all-to-one).
[out] | recvSizes | the sizes (bytes) received |
wait | wait for requests to complete (in nonBlocking mode) |
Definition at line 565 of file PstreamBuffers.C.
References UPstream::commsTypeNames, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and UPstream::nonBlocking.
|
friend |
Definition at line 120 of file PstreamBuffers.H.
|
friend |
Definition at line 121 of file PstreamBuffers.H.