Inter-processor communications stream. More...
Public Member Functions | |
ClassName ("Pstream") | |
Pstream (const commsTypes commsType, const label bufSize=0) | |
Construct given optional buffer size. More... | |
![]() | |
ClassName ("UPstream") | |
UPstream (const commsTypes commsType) | |
Construct given optional buffer size. More... | |
commsTypes | commsType () const |
Get the communications type of the stream. More... | |
commsTypes | commsType (const commsTypes ct) |
Set the communications type of the stream. More... | |
Static Public Member Functions | |
template<class T , class BinaryOp > | |
static void | gather (const List< commsStruct > &comms, T &Value, const BinaryOp &bop, const int tag, const label comm) |
Gather data. Apply bop to combine Value. More... | |
template<class T , class BinaryOp > | |
static void | gather (T &Value, const BinaryOp &bop, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class T > | |
static void | scatter (const List< commsStruct > &comms, T &Value, const int tag, const label comm) |
Scatter data. Distribute without modification. Reverse of gather. More... | |
template<class T > | |
static void | scatter (T &Value, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class T , class CombineOp > | |
static void | combineGather (const List< commsStruct > &comms, T &Value, const CombineOp &cop, const int tag, const label comm) |
template<class T , class CombineOp > | |
static void | combineGather (T &Value, const CombineOp &cop, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class T > | |
static void | combineScatter (const List< commsStruct > &comms, T &Value, const int tag, const label comm) |
Scatter data. Reverse of combineGather. More... | |
template<class T > | |
static void | combineScatter (T &Value, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class T , class CombineOp > | |
static void | listCombineGather (const List< commsStruct > &comms, List< T > &Value, const CombineOp &cop, const int tag, const label comm) |
template<class T , class CombineOp > | |
static void | listCombineGather (List< T > &Value, const CombineOp &cop, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class T > | |
static void | listCombineScatter (const List< commsStruct > &comms, List< T > &Value, const int tag, const label comm) |
Scatter data. Reverse of combineGather. More... | |
template<class T > | |
static void | listCombineScatter (List< T > &Value, const int tag=Pstream::msgType(), const label comm=Pstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class Container , class CombineOp > | |
static void | mapCombineGather (const List< commsStruct > &comms, Container &Values, const CombineOp &cop, const int tag, const label comm) |
template<class Container , class CombineOp > | |
static void | mapCombineGather (Container &Values, const CombineOp &cop, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class Container > | |
static void | mapCombineScatter (const List< commsStruct > &comms, Container &Values, const int tag, const label comm) |
Scatter data. Reverse of combineGather. More... | |
template<class Container > | |
static void | mapCombineScatter (Container &Values, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class T > | |
static void | gatherList (const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm) |
Gather data but keep individual values separate. More... | |
template<class T > | |
static void | gatherList (List< T > &Values, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class T > | |
static void | scatterList (const List< commsStruct > &comms, List< T > &Values, const int tag, const label comm) |
Scatter data. Reverse of gatherList. More... | |
template<class T > | |
static void | scatterList (List< T > &Values, const int tag=Pstream::msgType(), const label comm=UPstream::worldComm) |
Like above but switches between linear/tree communication. More... | |
template<class Container , class T > | |
static void | exchange (const List< Container > &, List< Container > &, labelListList &sizes, const int tag=UPstream::msgType(), const label comm=UPstream::worldComm, const bool block=true) |
Exchange data. Sends sendData, receives into recvData, sets. More... | |
![]() | |
static label | allocateCommunicator (const label parent, const labelList &subRanks, const bool doPstream=true) |
Allocate a new communicator. More... | |
static void | freeCommunicator (const label communicator, const bool doPstream=true) |
Free a previously allocated communicator. More... | |
static void | freeCommunicators (const bool doPstream) |
Free all communicators. More... | |
static int | baseProcNo (const label myComm, const int procID) |
Return physical processor number (i.e. processor number in. More... | |
static label | procNo (const label comm, const int baseProcID) |
Return processor number in communicator (given physical processor. More... | |
static label | procNo (const label myComm, const label currentComm, const int currentProcID) |
Return processor number in communicator (given processor number. More... | |
static void | addValidParOptions (HashTable< string > &validParOptions) |
Add the valid option this type of communications library. More... | |
static bool | init (int &argc, char **&argv) |
Initialisation function called from main. More... | |
static label | nRequests () |
Get number of outstanding requests. More... | |
static void | resetRequests (const label sz) |
Truncate number of outstanding requests. More... | |
static void | waitRequests (const label start=0) |
Wait until all requests (from start onwards) have finished. More... | |
static void | waitRequest (const label i) |
Wait until request i has finished. More... | |
static bool | finishedRequest (const label i) |
Non-blocking comms: has request i finished? More... | |
static int | allocateTag (const char *) |
static int | allocateTag (const word &) |
static void | freeTag (const char *, const int tag) |
static void | freeTag (const word &, const int tag) |
static bool & | parRun () |
Is this a parallel run? More... | |
static void | setParRun (const label nProcs) |
Set data for parallel running. Special case nProcs=0 to switch off. More... | |
static label | nProcs (const label communicator=0) |
Number of processes in parallel run. More... | |
static int | masterNo () |
Process index of the master. More... | |
static bool | master (const label communicator=0) |
Am I the master process. More... | |
static int | myProcNo (const label communicator=0) |
Number of this process (starting from masterNo() = 0) More... | |
static label | parent (const label communicator) |
static List< int > & | procID (label communicator) |
Process ID of given process index. More... | |
static int | firstSlave () |
Process index of first slave. More... | |
static int | lastSlave (const label communicator=0) |
Process index of last slave. More... | |
static const List< commsStruct > & | linearCommunication (const label communicator=0) |
Communication schedule for linear all-to-master (proc 0) More... | |
static const List< commsStruct > & | treeCommunication (const label communicator=0) |
Communication schedule for tree all-to-master (proc 0) More... | |
static int & | msgType () |
Message tag of standard messages. More... | |
static void | exit (int errnum=1) |
Exit program. More... | |
static void | abort () |
Abort program. More... | |
Protected Attributes | |
DynamicList< char > | buf_ |
Transfer buffer. More... | |
![]() | |
commsTypes | commsType_ |
Communications type of this stream. More... | |
Additional Inherited Members | |
![]() | |
enum | commsTypes { blocking, scheduled, nonBlocking } |
Types of communications. More... | |
![]() | |
static const NamedEnum< commsTypes, 3 > | commsTypeNames |
static bool | floatTransfer |
Should compact transfer be used in which floats replace doubles. More... | |
static int | nProcsSimpleSum |
Number of processors at which the sum algorithm changes from linear. More... | |
static commsTypes | defaultCommsType |
Default commsType. More... | |
static int | nPollProcInterfaces |
Number of polling cycles in processor updates. More... | |
static label | worldComm |
Default communicator (all processors) More... | |
static label | warnComm |
Debugging: warn for use of any communicator differing from warnComm. More... | |
Inter-processor communications stream.
|
inline |
Construct given optional buffer size.
Definition at line 75 of file Pstream.H.
References Pstream::buf_, and DynamicList::setCapacity().
ClassName | ( | "Pstream" | ) |
|
static |
Gather data. Apply bop to combine Value.
from different processors
Definition at line 47 of file gatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), UIPstream::read(), UPstream::scheduled, Foam::T(), and UOPstream::write().
Referenced by Foam::reduce().
|
static |
Like above but switches between linear/tree communication.
Definition at line 127 of file gatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Scatter data. Distribute without modification. Reverse of gather.
Definition at line 147 of file gatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), UIPstream::read(), UPstream::scheduled, Foam::T(), and UOPstream::write().
Referenced by globalIndexAndTransform::determineTransforms(), cachedRandom::globalGaussNormal(), cachedRandom::globalPosition(), cachedRandom::globalRandomise01(), cachedRandom::globalSample01(), Foam::help::groupMarking(), IOdictionary::IOdictionary(), main(), fvMeshTools::newMesh(), InflationInjection< CloudType >::parcelsToInject(), regIOobject::read(), readFields(), IOdictionary::readFile(), Foam::reduce(), Pstream::scatter(), patchInjectionBase::setPositionAndCell(), ParSortableList< Type >::sort(), hexRef8Data::sync(), sixDoFRigidBodyMotion::update(), and fileMonitor::updateStates().
|
static |
Like above but switches between linear/tree communication.
Definition at line 221 of file gatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, Pstream::scatter(), and UPstream::treeCommunication().
|
static |
Definition at line 50 of file combineGatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, UIPstream::read(), UPstream::scheduled, Foam::T(), and UOPstream::write().
Referenced by Foam::combineReduce().
|
static |
Like above but switches between linear/tree communication.
Definition at line 144 of file combineGatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Scatter data. Reverse of combineGather.
Definition at line 178 of file combineGatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, UIPstream::read(), UPstream::scheduled, Foam::T(), and UOPstream::write().
Referenced by Foam::combineReduce().
|
static |
Like above but switches between linear/tree communication.
Definition at line 259 of file combineGatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Definition at line 282 of file combineGatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, UIPstream::read(), UPstream::scheduled, List::size(), and UOPstream::write().
Referenced by meshRefinement::balance(), forces::calcForcesMoment(), viewFactor::calculate(), patchInjection::correct(), patchProbes::findElements(), hexRef8::getLevel0EdgeLength(), injectionModelList::info(), singleLayerRegion::initialise(), patchInjection::patchInjectedMassTotals(), meshRefinement::printMeshInfo(), probes::sample(), patchProbes::sample(), fvMeshSubset::setLargeCellSubset(), syncPoints(), isoSurface::syncUnseparatedPoints(), sampledTriSurfaceMesh::update(), patchInjectionBase::updateMesh(), and fileMonitor::updateStates().
|
static |
Like above but switches between linear/tree communication.
Definition at line 383 of file combineGatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Scatter data. Reverse of combineGather.
Definition at line 417 of file combineGatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, UIPstream::read(), UPstream::scheduled, and UOPstream::write().
Referenced by meshRefinement::balance(), forces::calcForcesMoment(), viewFactor::calculate(), patchProbes::findElements(), hexRef8::getLevel0EdgeLength(), singleLayerRegion::initialise(), meshRefinement::printMeshInfo(), probes::sample(), patchProbes::sample(), fvMeshSubset::setLargeCellSubset(), syncPoints(), isoSurface::syncUnseparatedPoints(), sampledTriSurfaceMesh::update(), patchInjectionBase::updateMesh(), and fileMonitor::updateStates().
|
static |
Like above but switches between linear/tree communication.
Definition at line 498 of file combineGatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Definition at line 535 of file combineGatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, and UPstream::scheduled.
Referenced by extractSurface(), extrudePatchMesh::extrudeMesh(), and meshRefinement::zonify().
|
static |
Like above but switches between linear/tree communication.
Definition at line 602 of file combineGatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Scatter data. Reverse of combineGather.
Definition at line 636 of file combineGatherScatter.C.
References UPstream::commsStruct::above(), UPstream::commsStruct::below(), Foam::endl(), forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, and UPstream::scheduled.
Referenced by extractSurface(), extrudePatchMesh::extrudeMesh(), and meshRefinement::zonify().
|
static |
Like above but switches between linear/tree communication.
Definition at line 687 of file combineGatherScatter.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Gather data but keep individual values separate.
Definition at line 49 of file gatherScatterList.C.
References Foam::abort(), UPstream::commsStruct::above(), UPstream::commsStruct::allBelow(), UPstream::commsStruct::below(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, UIPstream::read(), UPstream::scheduled, List::size(), and UOPstream::write().
Referenced by surfaceZonesInfo::addCellZonesToMesh(), surfaceZonesInfo::addFaceZonesToMesh(), meshSurfaceEngine::calcGlobalBoundaryEdgeLabels(), meshSurfaceEngine::calcGlobalBoundaryFaceLabels(), meshSurfaceEngine::calcGlobalBoundaryPointLabels(), polyMeshGenAddressing::calcGlobalCellLabels(), polyMeshGenAddressing::calcGlobalEdgeLabels(), polyMeshGenAddressing::calcGlobalFaceLabels(), meshOctreeAddressing::calcGlobalLeafLabels(), meshOctreeAddressing::calcGlobalPointLabels(), polyMeshGenAddressing::calcGlobalPointLabels(), distributedTriSurfaceMesh::calcLocalQueries(), meshRefinement::checkCoupledFaceZones(), polyBoundaryMesh::checkParallelSync(), fieldValue::combineFields(), faceSource::combineMeshGeometry(), partTriMesh::createParallelAddressing(), partTetMesh::createParallelAddressing(), createReconstructMap(), globalIndexAndTransform::determineTransforms(), fvMeshDistribute::distribute(), distributedTriSurfaceMesh::distribute(), distributedTriSurfaceMesh::distributedTriSurfaceMesh(), distributedTriSurfaceMesh::distributeSegments(), extractSurface(), boundaryLayers::findPatchesToBeTreatedTogether(), Pstream::gatherList(), globalIndex::globalIndex(), Foam::help::groupMarking(), viewFactor::initialise(), meshOctreeModifier::loadDistribution(), main(), fvMeshDistribute::mergeWordList(), InflationInjection< CloudType >::parcelsToInject(), printMeshData(), distributedTriSurfaceMesh::read(), fvMeshSubset::setLargeCellSubset(), ParSortableList< Type >::sort(), cyclicPeriodicAMIPolyPatch::syncTransforms(), meshOctreeModifier::updateCommunicationPattern(), and externalCoupledFunctionObject::writeGeometry().
|
static |
Like above but switches between linear/tree communication.
Definition at line 190 of file gatherScatterList.C.
References Pstream::gatherList(), UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, and UPstream::treeCommunication().
|
static |
Scatter data. Reverse of gatherList.
Definition at line 205 of file gatherScatterList.C.
References Foam::abort(), UPstream::commsStruct::above(), UPstream::commsStruct::allNotBelow(), UPstream::commsStruct::below(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, UPstream::myProcNo(), UPstream::nProcs(), UPstream::parRun(), Foam::Pout, UIPstream::read(), UPstream::scheduled, List::size(), and UOPstream::write().
Referenced by surfaceZonesInfo::addCellZonesToMesh(), surfaceZonesInfo::addFaceZonesToMesh(), meshSurfaceEngine::calcGlobalBoundaryEdgeLabels(), meshSurfaceEngine::calcGlobalBoundaryFaceLabels(), meshSurfaceEngine::calcGlobalBoundaryPointLabels(), polyMeshGenAddressing::calcGlobalCellLabels(), polyMeshGenAddressing::calcGlobalEdgeLabels(), polyMeshGenAddressing::calcGlobalFaceLabels(), meshOctreeAddressing::calcGlobalLeafLabels(), meshOctreeAddressing::calcGlobalPointLabels(), polyMeshGenAddressing::calcGlobalPointLabels(), distributedTriSurfaceMesh::calcLocalQueries(), meshRefinement::checkCoupledFaceZones(), polyBoundaryMesh::checkParallelSync(), fieldValue::combineFields(), partTriMesh::createParallelAddressing(), partTetMesh::createParallelAddressing(), fvMeshDistribute::distribute(), distributedTriSurfaceMesh::distribute(), distributedTriSurfaceMesh::distributedTriSurfaceMesh(), distributedTriSurfaceMesh::distributeSegments(), boundaryLayers::findPatchesToBeTreatedTogether(), globalIndex::globalIndex(), Foam::help::groupMarking(), meshOctreeModifier::loadDistribution(), main(), fvMeshDistribute::mergeWordList(), distributedTriSurfaceMesh::read(), Pstream::scatterList(), fvMeshSubset::setLargeCellSubset(), cyclicPeriodicAMIPolyPatch::syncTransforms(), and meshOctreeModifier::updateCommunicationPattern().
|
static |
Like above but switches between linear/tree communication.
Definition at line 325 of file gatherScatterList.C.
References UPstream::linearCommunication(), UPstream::nProcs(), UPstream::nProcsSimpleSum, Pstream::scatterList(), and UPstream::treeCommunication().
|
static |
Exchange data. Sends sendData, receives into recvData, sets.
sizes (not bytes). sizes[p0][p1] is what processor p0 has sent to p1. Continuous data only. If block=true will wait for all transfers to finish.
Definition at line 38 of file exchange.C.
References Foam::abort(), Foam::combineReduce(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::read(), List::setSize(), List::size(), T, and write().
|
protected |
Copyright © 2011-2018 OpenFOAM | OPENFOAM® is a registered trademark of OpenCFD Ltd.