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 |
| Is clearStorage of individual receive buffer by external hooks allowed? (default: true) More... | |
| bool | hasSendData () const |
| True if any (local) send buffers have data. More... | |
| bool | hasRecvData () const |
| True if any (local) recv buffers have unconsumed data. Must call finishedSends() or other finished.. method first! More... | |
| label | sendDataCount (const label proci) const |
| Number of send bytes for the specified processor. More... | |
| label | recvDataCount (const label proci) const |
| Number of unconsumed receive bytes for the specified processor. Must call finishedSends() or other finished.. method first! More... | |
| labelList | recvDataCounts () const |
| Number of unconsumed receive bytes for all processors. Must call finishedSends() or other finished.. method first! More... | |
| 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! More... | |
| 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) |
| Mark sends as done. Recovers the sizes (bytes) received. More... | |
| 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. More... | |
| 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. More... | |
| 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) |
| Mark sends as done using subset of send/recv ranks and recover the sizes (bytes) received. More... | |
| void | finishedNeighbourSends (const labelUList &neighProcs, labelList &recvSizes, const bool wait=true) |
| Mark sends as done using subset of send/recv ranks and recover the sizes (bytes) received. More... | |
| void | finishedGathers (const bool wait=true) |
| Mark all sends to master as done. More... | |
| void | finishedGathers (labelList &recvSizes, const bool wait=true) |
| Mark all sends to master as done. Recovers the sizes (bytes) received. More... | |
| void | finishedScatters (const bool wait=true) |
| Mark all sends to sub-procs as done. More... | |
| void | finishedScatters (labelList &recvSizes, const bool wait=true) |
| Mark all sends to sub-procs as done. Recovers the sizes (bytes) received. More... | |
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 113 of file PstreamBuffers.H.
|
explicit |
Construct given comms type, message tag, communicator, IO format.
Definition at line 155 of file PstreamBuffers.C.
|
explicit |
Construct given communicator, comms type, message tag, IO format.
Definition at line 175 of file PstreamBuffers.C.
| ~PstreamBuffers | ( | ) |
Destructor - checks that all data have been consumed.
Definition at line 196 of file PstreamBuffers.C.
References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, and Foam::nl.

|
inlinenoexcept |
The associated buffer format (ascii | binary)
Definition at line 237 of file PstreamBuffers.H.
|
inlinenoexcept |
The communications type of the stream.
Definition at line 245 of file PstreamBuffers.H.
Referenced by faBoundaryMesh::calcGeometry(), pointBoundaryMesh::movePoints(), faBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), pointBoundaryMesh::updateMesh(), faBoundaryMesh::updateMesh(), and polyBoundaryMesh::updateMesh().

|
inlinenoexcept |
The transfer message type.
Definition at line 253 of file PstreamBuffers.H.
|
inlinenoexcept |
Communicator.
Definition at line 261 of file PstreamBuffers.H.
Referenced by processorPolyPatch::initGeometry(), processorFaPatch::initGeometry(), processorPolyPatch::initUpdateMesh(), and processorFaPatch::initUpdateMesh().

|
inlinenoexcept |
Number of ranks associated with PstreamBuffers.
Definition at line 272 of file PstreamBuffers.H.
References UList< T >::size().
Referenced by PstreamBuffers::allProcs(), and PstreamBuffers::subProcs().


|
inlinenoexcept |
Range of ranks indices associated with PstreamBuffers.
Definition at line 280 of file PstreamBuffers.H.
References PstreamBuffers::nProcs().
Referenced by globalIndex::get(), zoneDistribute::getDatafromOtherProc(), RecycleInteraction< CloudType >::postEvolve(), zoneDistribute::setUpCommforZone(), and syncObjects::sync().


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


|
inlinenoexcept |
True if finishedSends() or finishedNeighbourSends() has been called.
Definition at line 301 of file PstreamBuffers.H.
Referenced by UIPstreamBase::UIPstreamBase().

|
inlinenoexcept |
Is clearStorage of individual receive buffer by external hooks allowed? (default: true)
Definition at line 310 of file PstreamBuffers.H.
Referenced by Cloud< passivePositionParticle >::move().

| bool hasSendData | ( | ) | const |
True if any (local) send buffers have data.
Definition at line 256 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 269 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, FatalErrorInFunction, and forAll.
Referenced by Cloud< passivePositionParticle >::move(), and RecycleInteraction< CloudType >::postEvolve().


| Foam::label sendDataCount | ( | const label | proci | ) | const |
Number of send bytes for the specified processor.
Definition at line 293 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 299 of file PstreamBuffers.C.
References Foam::exit(), Foam::FatalError, and FatalErrorInFunction.
Referenced by globalIndex::get(), zoneDistribute::getDatafromOtherProc(), Cloud< passivePositionParticle >::move(), 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 322 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 351 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 215 of file PstreamBuffers.C.
Referenced by fvMeshDistribute::distribute(), trackingInverseDistance::markDonors(), inverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), and Cloud< passivePositionParticle >::move().

| void clearRecv | ( | const label | proci | ) |
Clear an individual receive buffer (eg, data not required)
Does not remove the buffer storage.
Definition at line 231 of file PstreamBuffers.C.
| void clearStorage | ( | ) |
Clear individual buffer storage and reset states.
Definition at line 238 of file PstreamBuffers.C.
|
noexcept |
Change allowClearRecv, return previous value.
Definition at line 378 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 386 of file PstreamBuffers.C.
Referenced by faBoundaryMesh::calcGeometry(), fvMeshDistribute::distribute(), distributedTriSurfaceMesh::distribute(), mapDistributeBase::distribute(), box::doRefineBoxes(), PstreamBuffers::finishedNeighbourSends(), globalIndex::get(), zoneDistribute::getDatafromOtherProc(), FaceCellWave< Type, TrackingData >::handleProcPatches(), trackingInverseDistance::markDonors(), inverseDistance::markDonors(), trackingInverseDistance::markPatchesAsHoles(), inverseDistance::markPatchesAsHoles(), pointBoundaryMesh::movePoints(), faBoundaryMesh::movePoints(), polyBoundaryMesh::movePoints(), masterUncollatedFileOperation::NewIFstream(), RecycleInteraction< CloudType >::postEvolve(), masterUncollatedFileOperation::read(), mapDistributeBase::send(), box::setRefineFlags(), zoneDistribute::setUpCommforZone(), syncObjects::sync(), pointBoundaryMesh::updateMesh(), faBoundaryMesh::updateMesh(), and polyBoundaryMesh::updateMesh().

| void finishedSends | ( | labelList & | recvSizes, |
| const bool | wait = true |
||
| ) |
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 394 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 416 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 428 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 452 of file PstreamBuffers.C.
References DynamicList< T, SizeMin >::append(), DynamicList< T, SizeMin >::clear(), forAll, UPstream::reduceOr(), 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 485 of file PstreamBuffers.H.
References PstreamBuffers::finishedSends().
Referenced by Cloud< passivePositionParticle >::move(), 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 507 of file PstreamBuffers.H.
References PstreamBuffers::finishedSends().

| 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 519 of file PstreamBuffers.C.
Referenced by 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 nonBlocking mode) |
Definition at line 532 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 525 of file PstreamBuffers.C.
Referenced by decomposedBlockData::readBlocks(), masterUncollatedFileOperation::readHeader(), and masterUncollatedFileOperation::scatterList().

| 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 nonBlocking mode) |
Definition at line 559 of file PstreamBuffers.C.
References UPstream::commsTypeNames, Foam::endl(), Foam::exit(), Foam::FatalError, FatalErrorInFunction, and UPstream::nonBlocking.

|
friend |
Definition at line 116 of file PstreamBuffers.H.
|
friend |
Definition at line 117 of file PstreamBuffers.H.
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.