Buffers for inter-processor communications streams (UOPstream, UIPstream). More...
#include <PstreamBuffers.H>
Public Member Functions | |
| ClassName ("PstreamBuffers") | |
| PstreamBuffers (UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, int tag=UPstream::msgType(), int communicator=UPstream::worldComm, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY) | |
| Construct given communication type (default: nonBlocking), message tag, communicator (default: worldComm), IO format (default: binary). | |
| PstreamBuffers (int communicator, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, int tag=UPstream::msgType(), IOstreamOption::streamFormat fmt=IOstreamOption::BINARY) | |
| Construct given communicator, communication type (default: nonBlocking), message tag, IO format (default: binary). | |
| PstreamBuffers (int communicator, int tag, UPstream::commsTypes commsType=UPstream::commsTypes::nonBlocking, IOstreamOption::streamFormat fmt=IOstreamOption::BINARY) | |
| Construct given communicator, message tag, communication type (default: nonBlocking), IO format (default: binary). | |
| ~PstreamBuffers () | |
| Destructor - checks that all data have been consumed. | |
| IOstreamOption::streamFormat | format () const noexcept |
| The associated buffer format (ascii | binary). | |
| UPstream::commsTypes | commsType () const noexcept |
| The communications type of the stream. | |
| int | tag () const noexcept |
| The transfer message tag. | |
| int | comm () const noexcept |
| The communicator index. | |
| int | nProcs () const noexcept |
| Number of ranks associated with PstreamBuffers. | |
| UPstream::rangeType | allProcs () const noexcept |
| Range of ranks indices associated with PstreamBuffers. | |
| UPstream::rangeType | subProcs () const noexcept |
| Range of sub-processes indices associated with PstreamBuffers. | |
| bool | finished () const noexcept |
| True if finishedSends() or finishedNeighbourSends() has been called. | |
| bool | allowClearRecv () const noexcept |
| Is clearStorage of individual receive buffer by external hooks allowed? (default: true). | |
| bool | hasSendData () const |
| True if any (local) send buffers have data. | |
| bool | hasRecvData () const |
| True if any (local) recv buffers have unconsumed data. Must call finishedSends() or other finished.. method first! | |
| label | sendDataCount (const label proci) const |
| Number of send bytes for the specified processor. | |
| label | recvDataCount (const label proci) const |
| Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other finished.. method first! | |
| labelList | recvDataCounts () const |
| Number of unconsumed receive bytes for all processors. Must call finishedSends() or other finished.. method first! | |
| label | maxRecvCount () const |
| Maximum receive size from any rocessor rank. Must call finishedSends() or other finished.. method first! | |
| label | maxNonLocalRecvCount () const |
| Maximum receive size, excluding current processor rank Must call finishedSends() or other finished.. method first! | |
| label | maxNonLocalRecvCount (const label excludeProci) const |
| Maximum receive size, excluding the specified processor rank Must call finishedSends() or other finished.. method first! | |
| const UList< char > | peekRecvData (const label proci) const |
| Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other finished.. method first! | |
| void | clear () |
| Clear all send/recv buffers and reset states. | |
| void | clearSends () |
| Clear all send buffers (does not remove buffer storage). | |
| void | clearRecvs () |
| Clear all recv buffer and positions (does not remove buffer storage). | |
| void | clearSend (const label proci) |
| Clear an individual send buffer (eg, data not required). | |
| void | clearRecv (const label proci) |
| Clear an individual receive buffer (eg, data not required). | |
| void | clearStorage () |
| Clear storage for all send/recv buffers and reset states. | |
| bool | allowClearRecv (bool on) noexcept |
| Change allowClearRecv, return previous value. | |
| void | initRegisterSend () |
| Initialise registerSend() bookkeeping by mark all send buffers as 'unregistered'. | |
| void | registerSend (const label proci, const bool toggleOn=true) |
| Toggle an individual send buffer as 'registered'. The setting is sticky (does not turn off). | |
| void | clearUnregistered () |
| Clear any 'unregistered' send buffers. | |
| void | finishedSends (const bool wait=true) |
| Mark the send phase as being finished. | |
| void | finishedSendsNBX (const bool wait=true) |
| Mark the send phase as being finished. | |
| void | finishedSends (labelList &recvSizes, const bool wait=true) |
| Mark the send phase as being finished. Recovers the sizes (bytes) received. | |
| void | finishedSendsNBX (labelList &recvSizes, const bool wait=true) |
| Mark the send phase as being finished. Recovers the sizes (bytes) received. | |
| void | finishedNeighbourSends (const labelUList &neighProcs, const bool wait=true) |
| Mark the send phase as being finished, with communication being limited to a known subset of send/recv ranks. | |
| void | finishedNeighbourSends (const labelUList &neighProcs, labelList &recvSizes, const bool wait=true) |
| Mark the send phase as being finished, with communication being limited to a known subset of send/recv ranks. Recovers the sizes (bytes) received. | |
| bool | finishedSends (bitSet &sendConnections, DynamicList< label > &sendProcs, DynamicList< label > &recvProcs, const bool wait=true) |
| A caching version that uses a limited send/recv connectivity. | |
| void | finishedGathers (const bool wait=true) |
| Mark all sends to master as done. | |
| void | finishedGathers (labelList &recvSizes, const bool wait=true) |
| Mark all sends to master as done. Recovers the sizes (bytes) received. | |
| void | finishedScatters (const bool wait=true) |
| Mark all sends to sub-procs as done. | |
| void | finishedScatters (labelList &recvSizes, const bool wait=true) |
| Mark all sends to sub-procs as done. Recovers the sizes (bytes) received. | |
Static Public Attributes | |
| static int | algorithm |
| Preferred exchange algorithm (may change or be removed in future). | |
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 buffered and non-blocking. Does not make much sense with scheduled since there you would not need these explicit buffers.
Example usage:
There are special versions of finishedSends() for restricted neighbour communication as well as for special one-to-all and all-to-one communication patterns. For example,
Additionally there are some situations that use speculative sends that may not actually be required. In this case, it is possible to mark all sends as initially unregistered and subsequently mark the "real" sends as registered.
For example,
Definition at line 147 of file PstreamBuffers.H.
|
explicit |
Construct given communication type (default: nonBlocking), message tag, communicator (default: worldComm), IO format (default: binary).
Definition at line 292 of file PstreamBuffers.C.
References commsType(), DebugPoutInFunction, Foam::endl(), nProcs(), and tag().
Referenced by PstreamBuffers(), and PstreamBuffers().


|
inlineexplicit |
Construct given communicator, communication type (default: nonBlocking), message tag, IO format (default: binary).
Definition at line 315 of file PstreamBuffers.H.
References IOstreamOption::BINARY, commsType(), UPstream::msgType(), UPstream::nonBlocking, PstreamBuffers(), and tag().

|
inline |
Construct given communicator, message tag, communication type (default: nonBlocking), IO format (default: binary).
Definition at line 330 of file PstreamBuffers.H.
References IOstreamOption::BINARY, commsType(), UPstream::nonBlocking, PstreamBuffers(), and tag().

| ~PstreamBuffers | ( | ) |
Destructor - checks that all data have been consumed.
Definition at line 321 of file PstreamBuffers.C.
References Foam::abort(), DebugPoutInFunction, Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::nl, and Foam::pos().

| ClassName | ( | "PstreamBuffers" | ) |
|
inlinenoexcept |
The associated buffer format (ascii | binary).
Definition at line 355 of file PstreamBuffers.H.
References Foam::noexcept.
|
inlinenoexcept |
The communications type of the stream.
Definition at line 360 of file PstreamBuffers.H.
References Foam::noexcept.
Referenced by faBoundaryMesh::calcGeometry(), faBoundaryMesh::movePoints(), pointBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), PstreamBuffers(), PstreamBuffers(), PstreamBuffers(), faBoundaryMesh::updateMesh(), pointBoundaryMesh::updateMesh(), and polyBoundaryMesh::updateMesh().

|
inlinenoexcept |
The transfer message tag.
Definition at line 365 of file PstreamBuffers.H.
References Foam::noexcept.
Referenced by PstreamBuffers(), PstreamBuffers(), and PstreamBuffers().

|
inlinenoexcept |
|
inlinenoexcept |
Number of ranks associated with PstreamBuffers.
Definition at line 375 of file PstreamBuffers.H.
References Foam::noexcept.
Referenced by finishedSends(), processorFaPatch::initGeometry(), processorPolyPatch::initGeometry(), processorFaPatch::initUpdateMesh(), processorPolyPatch::initUpdateMesh(), and PstreamBuffers().

|
inlinenoexcept |
Range of ranks indices associated with PstreamBuffers.
Definition at line 383 of file PstreamBuffers.H.
References Foam::noexcept.
Referenced by distributedTriSurfaceMesh::distribute(), RecycleInteraction< CloudType >::postEvolve(), and syncObjects::sync().

|
inlinenoexcept |
Range of sub-processes indices associated with PstreamBuffers.
Definition at line 392 of file PstreamBuffers.H.
References Foam::noexcept.
Referenced by masterUncollatedFileOperation::readHeader().

|
noexcept |
True if finishedSends() or finishedNeighbourSends() has been called.
Definition at line 846 of file PstreamBuffers.C.
References Foam::noexcept.
Referenced by hasRecvData(), initRegisterSend(), maxNonLocalRecvCount(), peekRecvData(), recvDataCount(), recvDataCounts(), and UIPstreamBase::UIPstreamBase().

|
noexcept |
Is clearStorage of individual receive buffer by external hooks allowed? (default: true).
Definition at line 852 of file PstreamBuffers.C.
References Foam::noexcept.
| bool hasSendData | ( | ) | const |
True if any (local) send buffers have data.
Definition at line 475 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 488 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, finished(), and forAll.

| Foam::label sendDataCount | ( | const label | proci | ) | const |
Number of send bytes for the specified processor.
Definition at line 512 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 518 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and finished().
Referenced by distributedTriSurfaceMesh::distribute(), masterUncollatedFileOperation::NewIFstream(), RecycleInteraction< CloudType >::postEvolve(), masterUncollatedFileOperation::read(), box::setRefineFlags(), syncTools::syncEdgeMap(), and syncTools::syncPointMap().


| Foam::labelList recvDataCounts | ( | ) | const |
Number of unconsumed receive bytes for all processors. Must call finishedSends() or other finished.. method first!
Definition at line 541 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, finished(), forAll, and Foam::Zero.
Referenced by fvMeshDistribute::distribute().


| Foam::label maxRecvCount | ( | ) | const |
Maximum receive size from any rocessor rank. Must call finishedSends() or other finished.. method first!
Definition at line 599 of file PstreamBuffers.C.
References maxNonLocalRecvCount().

| Foam::label maxNonLocalRecvCount | ( | ) | const |
Maximum receive size, excluding current processor rank Must call finishedSends() or other finished.. method first!
Definition at line 606 of file PstreamBuffers.C.
References maxNonLocalRecvCount(), and UPstream::myProcNo().
Referenced by maxNonLocalRecvCount(), and maxRecvCount().


| Foam::label maxNonLocalRecvCount | ( | const label | excludeProci | ) | const |
Maximum receive size, excluding the specified processor rank Must call finishedSends() or other finished.. method first!
Definition at line 569 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, finished(), forAll, and Foam::max().

| 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 613 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, finished(), and Foam::pos().

| void clear | ( | ) |
Clear all send/recv buffers and reset states.
Does not remove the buffer storage.
Definition at line 394 of file PstreamBuffers.C.
References clearRecvs(), and clearSends().
Referenced by fvMeshDistribute::distribute(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), inverseDistance::markPatchesAsHoles(), and trackingInverseDistance::markPatchesAsHoles().


| void clearSends | ( | ) |
Clear all send buffers (does not remove buffer storage).
Definition at line 375 of file PstreamBuffers.C.
Referenced by clear().

| void clearRecvs | ( | ) |
Clear all recv buffer and positions (does not remove buffer storage).
Definition at line 384 of file PstreamBuffers.C.
References Foam::Zero.
Referenced by clear().

| void clearSend | ( | const label | proci | ) |
Clear an individual send buffer (eg, data not required).
Definition at line 415 of file PstreamBuffers.C.
| void clearRecv | ( | const label | proci | ) |
Clear an individual receive buffer (eg, data not required).
Does not remove the buffer storage.
Definition at line 426 of file PstreamBuffers.C.
| void clearStorage | ( | ) |
Clear storage for all send/recv buffers and reset states.
Definition at line 433 of file PstreamBuffers.C.
References Foam::Zero.
|
noexcept |
Change allowClearRecv, return previous value.
Definition at line 858 of file PstreamBuffers.C.
| void initRegisterSend | ( | ) |
Initialise registerSend() bookkeeping by mark all send buffers as 'unregistered'.
Usually called immediately after construction or clear().
Definition at line 451 of file PstreamBuffers.C.
References finished().
Referenced by syncTools::syncEdgeMap(), and syncTools::syncPointMap().


| void registerSend | ( | const label | proci, |
| const bool | toggleOn = true ) |
Toggle an individual send buffer as 'registered'. The setting is sticky (does not turn off).
Definition at line 465 of file PstreamBuffers.C.
Referenced by syncTools::syncEdgeMap(), and syncTools::syncPointMap().

| void clearUnregistered | ( | ) |
Clear any 'unregistered' send buffers.
Definition at line 402 of file PstreamBuffers.C.
| void finishedSends | ( | const bool | wait = true | ) |
Mark the send phase as being finished.
Non-blocking mode: populates receive buffers using all-to-all or NBX (depending on tuning parameters).
| wait | wait for requests to complete (in non-blocking mode) |
Definition at line 641 of file PstreamBuffers.C.
References DebugPoutInFunction, and Foam::endl().
Referenced by faBoundaryMesh::calcGeometry(), distributedTriSurfaceMesh::distribute(), fvMeshDistribute::distribute(), mapDistributeBase::distribute(), mapDistributeBase::distribute(), mapDistributeBase::distribute(), refinementHistory::distribute(), box::doRefineBoxes(), finishedSends(), finishedSendsNBX(), inverseDistance::markDonors(), trackingInverseDistance::markDonors(), inverseDistance::markPatchesAsHoles(), trackingInverseDistance::markPatchesAsHoles(), faBoundaryMesh::movePoints(), pointBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), masterUncollatedFileOperation::NewIFstream(), RecycleInteraction< CloudType >::postEvolve(), mapDistributeBase::send(), box::setRefineFlags(), syncObjects::sync(), faBoundaryMesh::updateMesh(), pointBoundaryMesh::updateMesh(), and polyBoundaryMesh::updateMesh().


| void finishedSendsNBX | ( | const bool | wait = true | ) |
Mark the send phase as being finished.
Non-blocking mode: populates receive buffers using NBX.
| wait | wait for requests to complete (in non-blocking mode) |
Definition at line 654 of file PstreamBuffers.C.
References DebugPoutInFunction, and Foam::endl().
Referenced by finishedSendsNBX().


| void finishedSends | ( | labelList & | recvSizes, |
| const bool | wait = true ) |
Mark the send phase as being finished. Recovers the sizes (bytes) received.
Non-blocking mode: populates receive buffers using all-to-all or NBX (depending on tuning parameters).
| [out] | recvSizes | the sizes (bytes) received |
| wait | wait for requests to complete (in non-blocking mode) |
Definition at line 667 of file PstreamBuffers.C.
References UPstream::commsTypeNames, DebugPoutInFunction, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, UPstream::nonBlocking, and List< T >::resize_nocopy().

| void finishedSendsNBX | ( | labelList & | recvSizes, |
| const bool | wait = true ) |
Mark the send phase as being finished. Recovers the sizes (bytes) received.
Non-blocking mode: populates receive buffers using NBX.
| [out] | recvSizes | the sizes (bytes) received |
| wait | wait for requests to complete (in non-blocking mode) |
References finishedGathers(), finishedNeighbourSends(), finishedScatters(), finishedSends(), and finishedSendsNBX().

| void finishedNeighbourSends | ( | const labelUList & | neighProcs, |
| const bool | wait = true ) |
Mark the send phase as being finished, with communication being limited to a known subset of send/recv ranks.
Non-blocking mode: populates receive buffers.
| neighProcs | ranks used for sends/recvs |
| wait | wait for requests to complete (in non-blocking mode) |
Definition at line 709 of file PstreamBuffers.C.
Referenced by finishedSendsNBX(), syncTools::syncBoundaryFaceList(), syncTools::syncEdgeMap(), and syncTools::syncPointMap().

| void finishedNeighbourSends | ( | const labelUList & | neighProcs, |
| labelList & | recvSizes, | ||
| const bool | wait = true ) |
Mark the send phase as being finished, with communication being limited to a known subset of send/recv ranks. Recovers 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 non-blocking mode) |
Definition at line 698 of file PstreamBuffers.C.
| 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 | inter-rank connections (on/off) for sending ranks |
| sendProcs | ranks used for sends |
| recvProcs | ranks used for recvs |
| wait | wait for requests to complete (in non-blocking mode) |
Definition at line 720 of file PstreamBuffers.C.
References DynamicList< T, SizeMin >::clear(), finishedSends(), forAll, nProcs(), DynamicList< T, SizeMin >::push_back(), UPstream::reduceOr(), PackedList< Width >::resize(), bitSet::set(), and PackedList< Width >::size().

| void finishedGathers | ( | const bool | wait = true | ) |
Mark all sends to master as done.
Non-blocking mode: populates receive buffers. Can use recvDataCount, maxRecvCount etc to recover sizes received.
| wait | wait for requests to complete (in non-blocking mode) |
Definition at line 785 of file PstreamBuffers.C.
Referenced by finishedSendsNBX(), lduPrimitiveMesh::gather(), and energySpectrum::write().

| void finishedGathers | ( | labelList & | recvSizes, |
| const bool | wait = true ) |
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 non-blocking mode) |
Definition at line 799 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 recvDataCount, maxRecvCount etc to recover sizes received.
| wait | wait for requests to complete (in non-blocking mode) |
Definition at line 792 of file PstreamBuffers.C.
Referenced by finishedSendsNBX(), masterUncollatedFileOperation::read(), and masterUncollatedFileOperation::readHeader().

| void finishedScatters | ( | labelList & | recvSizes, |
| const bool | wait = true ) |
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 non-blocking mode) |
Definition at line 821 of file PstreamBuffers.C.
References UPstream::commsTypeNames, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and UPstream::nonBlocking.

|
friend |
Definition at line 279 of file PstreamBuffers.H.
References UOPstreamBase.
Referenced by UOPstreamBase.
|
friend |
Definition at line 280 of file PstreamBuffers.H.
References UIPstreamBase.
Referenced by UIPstreamBase.
|
static |
Preferred exchange algorithm (may change or be removed in future).
Definition at line 294 of file PstreamBuffers.H.
Referenced by argList::parse(), and registerOptSwitch().