UPstream Class Reference

Inter-processor communications stream. More...

Inheritance diagram for UPstream:
[legend]
Collaboration diagram for UPstream:
[legend]

Classes

class  commsStruct
 Structure for communicating between processors. More...
 
class  communicator
 Helper class for allocating/freeing communicators. More...
 
struct  listEq
 combineReduce operator for lists. Used for counting. More...
 

Public Types

enum class  commsTypes : char { blocking , scheduled , nonBlocking }
 Types of communications. More...
 
typedef IntRange< int > rangeType
 Int ranges are used for MPI ranks (processes) More...
 

Public Member Functions

 ClassName ("UPstream")
 
 UPstream (const commsTypes commsType)
 Construct for given communication type. More...
 
commsTypes commsType () const noexcept
 Get the communications type of the stream. More...
 
commsTypes commsType (const commsTypes ct) noexcept
 Set the communications type of the stream. More...
 
template<class T >
Foam::List< TlistGatherValues (const T &localValue, const label comm)
 

Static Public Member Functions

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)
 
static label procNo (const label comm, const int baseProcID)
 
static label procNo (const label myComm, const label currentComm, const int currentProcID)
 
static void addValidParOptions (HashTable< string > &validParOptions)
 
static bool init (int &argc, char **&argv, const bool needsThread)
 Initialisation function called from main. More...
 
static bool initNull ()
 Special purpose initialisation function. 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 std::string &)
 
static void freeTag (const char *, const int tag)
 
static void freeTag (const std::string &, const int tag)
 
static bool parRun (const bool on) noexcept
 Set as parallel run on/off. More...
 
static boolparRun () noexcept
 Test if this a parallel run. More...
 
static bool haveThreads () noexcept
 Have support for threads. More...
 
static label nProcs (const label communicator=worldComm)
 Number of processes in parallel run, and 1 for serial run. More...
 
static constexpr int masterNo () noexcept
 Process index of the master (always 0) More...
 
static bool master (const label communicator=worldComm)
 Am I the master process. More...
 
static int myProcNo (const label communicator=worldComm)
 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 const wordListallWorlds () noexcept
 All worlds. More...
 
static const labelListworldIDs () noexcept
 worldID (index in allWorlds) of all processes More...
 
static label myWorldID ()
 My worldID. More...
 
static const wordmyWorld ()
 My world. More...
 
static rangeType allProcs (const label communicator=worldComm)
 Range of process indices for all processes. More...
 
static rangeType subProcs (const label communicator=worldComm)
 Range of process indices for sub-processes. More...
 
static const List< commsStruct > & linearCommunication (const label communicator=worldComm)
 Communication schedule for linear all-to-master (proc 0) More...
 
static const List< commsStruct > & treeCommunication (const label communicator=worldComm)
 Communication schedule for tree all-to-master (proc 0) More...
 
static const List< commsStruct > & whichCommunication (const label communicator=worldComm)
 
static int & msgType () noexcept
 Message tag of standard messages. More...
 
static void shutdown (int errNo=0)
 Shutdown (finalize) MPI as required. More...
 
static void abort ()
 Call MPI_Abort with no other checks or cleanup. More...
 
static void exit (int errNo=1)
 Shutdown (finalize) MPI as required and exit program with errNo. More...
 
static void allToAll (const UList< int32_t > &sendData, UList< int32_t > &recvData, const label communicator=worldComm)
 Exchange integer data with all processors (in the communicator). More...
 
static void allToAll (const UList< int64_t > &sendData, UList< int64_t > &recvData, const label communicator=worldComm)
 Exchange integer data with all processors (in the communicator). More...
 
static void mpiGather (const char *sendData, int sendCount, char *recvData, int recvCount, const label communicator=worldComm)
 Receive identically-sized char data from all ranks. More...
 
static void mpiScatter (const char *sendData, int sendCount, char *recvData, int recvCount, const label communicator=worldComm)
 Send identically-sized char data to all ranks. More...
 
static void gather (const char *sendData, int sendCount, char *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, const label communicator=worldComm)
 Receive variable length char data from all ranks. More...
 
static void scatter (const char *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, char *recvData, int recvCount, const label communicator=worldComm)
 Send variable length char data to all ranks. More...
 
static void gather (const int32_t *sendData, int sendCount, int32_t *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, const label communicator=worldComm)
 Receive variable length int32_t data from all ranks. More...
 
static void scatter (const int32_t *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, int32_t *recvData, int recvCount, const label communicator=worldComm)
 Send variable length int32_t data to all ranks. More...
 
static void gather (const int64_t *sendData, int sendCount, int64_t *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, const label communicator=worldComm)
 Receive variable length int64_t data from all ranks. More...
 
static void scatter (const int64_t *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, int64_t *recvData, int recvCount, const label communicator=worldComm)
 Send variable length int64_t data to all ranks. More...
 
static void gather (const uint32_t *sendData, int sendCount, uint32_t *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, const label communicator=worldComm)
 Receive variable length uint32_t data from all ranks. More...
 
static void scatter (const uint32_t *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, uint32_t *recvData, int recvCount, const label communicator=worldComm)
 Send variable length uint32_t data to all ranks. More...
 
static void gather (const uint64_t *sendData, int sendCount, uint64_t *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, const label communicator=worldComm)
 Receive variable length uint64_t data from all ranks. More...
 
static void scatter (const uint64_t *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, uint64_t *recvData, int recvCount, const label communicator=worldComm)
 Send variable length uint64_t data to all ranks. More...
 
static void gather (const float *sendData, int sendCount, float *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, const label communicator=worldComm)
 Receive variable length float data from all ranks. More...
 
static void scatter (const float *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, float *recvData, int recvCount, const label communicator=worldComm)
 Send variable length float data to all ranks. More...
 
static void gather (const double *sendData, int sendCount, double *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, const label communicator=worldComm)
 Receive variable length double data from all ranks. More...
 
static void scatter (const double *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, double *recvData, int recvCount, const label communicator=worldComm)
 Send variable length double data to all ranks. More...
 
template<class T >
static List< TlistGatherValues (const T &localValue, const label communicator=worldComm)
 Gather individual values into list locations. More...
 
template<class T >
static T listScatterValues (const UList< T > &allValues, const label communicator=worldComm)
 Scatter individual values from list locations. More...
 
static bool broadcast (char *buf, const std::streamsize bufSize, const label communicator=worldComm, const int rootProcNo=masterNo())
 
static constexpr int firstSlave () noexcept
 Process index of first sub-process. More...
 
static int lastSlave (const label communicator=worldComm)
 Process index of last sub-process. More...
 

Static Public Attributes

static const Enum< commsTypescommsTypeNames
 Names of the communication types. More...
 
static bool floatTransfer
 
static int nProcsSimpleSum
 Number of processors to change from linear to tree communication. More...
 
static commsTypes defaultCommsType
 Default commsType. More...
 
static int nPollProcInterfaces
 Number of polling cycles in processor updates. More...
 
static int maxCommsSize
 Optional maximum message size (bytes) More...
 
static const int mpiBufferSize
 MPI buffer-size (bytes) More...
 
static label worldComm
 Default communicator (all processors) More...
 
static label warnComm
 Debugging: warn for use of any communicator differing from warnComm. More...
 

Detailed Description

Inter-processor communications stream.

Source files

Definition at line 58 of file UPstream.H.

Member Typedef Documentation

◆ rangeType

typedef IntRange<int> rangeType

Int ranges are used for MPI ranks (processes)

Definition at line 63 of file UPstream.H.

Member Enumeration Documentation

◆ commsTypes

enum class commsTypes : char
strong

Types of communications.

Enumerator
blocking 

"blocking"

scheduled 

"scheduled"

nonBlocking 

"nonBlocking"

Definition at line 66 of file UPstream.H.

Constructor & Destructor Documentation

◆ UPstream()

UPstream ( const commsTypes  commsType)
inlineexplicit

Construct for given communication type.

Definition at line 302 of file UPstream.H.

Member Function Documentation

◆ ClassName()

ClassName ( "UPstream"  )

◆ allocateCommunicator()

Foam::label allocateCommunicator ( const label  parent,
const labelList subRanks,
const bool  doPstream = true 
)
static

Allocate a new communicator.

Definition at line 107 of file UPstream.C.

References Foam::abort(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, forAll, Foam::Pout, and UList< T >::size().

Referenced by eagerGAMGProcAgglomeration::agglomerate(), manualGAMGProcAgglomeration::agglomerate(), masterCoarsestGAMGProcAgglomeration::agglomerate(), procFacesGAMGProcAgglomeration::agglomerate(), and globalMeshData::updateMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeCommunicator()

void freeCommunicator ( const label  communicator,
const bool  doPstream = true 
)
static

Free a previously allocated communicator.

Definition at line 173 of file UPstream.C.

References Foam::endl(), and Foam::Pout.

Referenced by globalMeshData::updateMesh(), collatedFileOperation::~collatedFileOperation(), UPstream::communicator::~communicator(), eagerGAMGProcAgglomeration::~eagerGAMGProcAgglomeration(), hostCollatedFileOperation::~hostCollatedFileOperation(), manualGAMGProcAgglomeration::~manualGAMGProcAgglomeration(), masterCoarsestGAMGProcAgglomeration::~masterCoarsestGAMGProcAgglomeration(), masterUncollatedFileOperation::~masterUncollatedFileOperation(), OFstreamCollator::~OFstreamCollator(), and procFacesGAMGProcAgglomeration::~procFacesGAMGProcAgglomeration().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ freeCommunicators()

void freeCommunicators ( const bool  doPstream)
static

Free all communicators.

Definition at line 201 of file UPstream.C.

References forAll.

◆ baseProcNo()

int baseProcNo ( const label  myComm,
const int  procID 
)
static

Return physical processor number (i.e. processor number in worldComm) given communicator and procssor

Definition at line 213 of file UPstream.C.

References splitCell::parent().

Referenced by UPstream::procNo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ procNo() [1/2]

Foam::label procNo ( const label  comm,
const int  baseProcID 
)
static

Return processor number in communicator (given physical processor number) (= reverse of baseProcNo)

Definition at line 229 of file UPstream.C.

References UList< T >::find(), and UPstream::procNo().

Referenced by UPstream::procNo().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ procNo() [2/2]

Foam::label procNo ( const label  myComm,
const label  currentComm,
const int  currentProcID 
)
static

Return processor number in communicator (given processor number and communicator)

Definition at line 246 of file UPstream.C.

References UPstream::baseProcNo(), and UPstream::procNo().

Here is the call graph for this function:

◆ addValidParOptions()

void addValidParOptions ( HashTable< string > &  validParOptions)
static

Add the valid option this type of communications library adds/requires on the command line

Definition at line 33 of file UPstream.C.

◆ init()

bool init ( int &  argc,
char **&  argv,
const bool  needsThread 
)
static

Initialisation function called from main.

Spawns sub-processes and initialises inter-communication

Definition at line 47 of file UPstream.C.

References Foam::endl(), Foam::exit(), Foam::FatalError, and FatalErrorInFunction.

Here is the call graph for this function:

◆ initNull()

bool initNull ( )
static

Special purpose initialisation function.

Performs a basic MPI_Init without any other setup. Only used for applications that need MPI communication when OpenFOAM is running in a non-parallel mode.

Note
Behaves as a no-op if MPI has already been initialized. Fatal if MPI has already been finalized.

Definition at line 37 of file UPstream.C.

References Foam::endl(), and WarningInFunction.

Here is the call graph for this function:

◆ nRequests()

Foam::label nRequests ( )
static

Get number of outstanding requests.

Definition at line 90 of file UPstream.C.

Referenced by GAMGAgglomeration::agglomerateLduAddressing(), lduMatrix::Amul(), dynamicOversetFvMesh::correctBoundaryConditions(), dynamicOversetFvMesh::correctCoupledBoundaryConditions(), metisLikeDecomp::decomposeGeneral(), faMeshDistributor::distribute(), mapDistributeBase::distribute(), GeometricBoundaryField< Type, PatchField, GeoMesh >::evaluate(), calculatedProcessorFvPatchField< Type >::evaluate(), processorFvPatchField< Type >::evaluate(), Foam::evaluateConstraintTypes(), GeometricBoundaryField< Type, PatchField, GeoMesh >::evaluateCoupled(), mapDistributeBase::exchangeMasks(), Pstream::exchangeSizes(), globalIndex::gather(), globalIndex::gatherValues(), GAMGProcAgglomeration::globalCellCells(), calculatedProcessorFvPatchField< Type >::initEvaluate(), processorFvPatchField< Type >::initEvaluate(), calculatedProcessorFvPatchField< Type >::initInterfaceMatrixUpdate(), processorFvPatchField< Type >::initInterfaceMatrixUpdate(), lduCalculatedProcessorField< Type >::initInterfaceMatrixUpdate(), processorGAMGInterfaceField::initInterfaceMatrixUpdate(), calculatedProcessorGAMGInterfaceField::initInterfaceMatrixUpdate(), calculatedProcessorFvPatchField< Type >::ready(), processorFvPatchField< Type >::ready(), lduCalculatedProcessorField< Type >::ready(), lduMatrix::residual(), globalIndex::scatter(), nonBlockingGaussSeidelSmoother::smooth(), GaussSeidelSmoother::smooth(), symGaussSeidelSmoother::smooth(), syncTools::syncBoundaryFaceList(), syncTools::syncFaceList(), lduMatrix::Tmul(), calculatedProcessorFvPatchField< Type >::updateInterfaceMatrix(), processorFvPatchField< Type >::updateInterfaceMatrix(), lduCalculatedProcessorField< Type >::updateInterfaceMatrix(), processorGAMGInterfaceField::updateInterfaceMatrix(), calculatedProcessorGAMGInterfaceField::updateInterfaceMatrix(), and OFstreamCollator::write().

Here is the caller graph for this function:

◆ resetRequests()

void resetRequests ( const label  sz)
static

Truncate number of outstanding requests.

Definition at line 96 of file UPstream.C.

Referenced by lduMatrix::updateMatrixInterfaces().

Here is the caller graph for this function:

◆ waitRequests()

◆ waitRequest()

void waitRequest ( const label  i)
static

◆ finishedRequest()

bool finishedRequest ( const label  i)
static

Non-blocking comms: has request i finished?

Definition at line 108 of file UPstream.C.

References NotImplemented.

Referenced by calculatedProcessorFvPatchField< Type >::ready(), processorFvPatchField< Type >::ready(), and lduCalculatedProcessorField< Type >::ready().

Here is the caller graph for this function:

◆ allocateTag() [1/2]

int allocateTag ( const char *  s)
static

Definition at line 754 of file UPstream.C.

References Foam::endl(), Foam::PstreamGlobals::freedTags_, Foam::PstreamGlobals::nTags_, Foam::Pout, DynamicList< T, SizeMin >::remove(), and s().

Here is the call graph for this function:

◆ allocateTag() [2/2]

int allocateTag ( const std::string &  s)
static

Definition at line 776 of file UPstream.C.

References Foam::endl(), Foam::PstreamGlobals::freedTags_, Foam::PstreamGlobals::nTags_, Foam::Pout, DynamicList< T, SizeMin >::remove(), and s().

Here is the call graph for this function:

◆ freeTag() [1/2]

void freeTag ( const char *  s,
const int  tag 
)
static

Definition at line 798 of file UPstream.C.

References DynamicList< T, SizeMin >::append(), Foam::endl(), Foam::PstreamGlobals::freedTags_, Foam::Pout, and s().

Here is the call graph for this function:

◆ freeTag() [2/2]

void freeTag ( const std::string &  s,
const int  tag 
)
static

Definition at line 809 of file UPstream.C.

References DynamicList< T, SizeMin >::append(), Foam::endl(), Foam::PstreamGlobals::freedTags_, Foam::Pout, and s().

Here is the call graph for this function:

◆ parRun() [1/2]

static bool parRun ( const bool  on)
inlinestaticnoexcept

Set as parallel run on/off.

Returns
the previous value

Definition at line 424 of file UPstream.H.

◆ parRun() [2/2]

static bool & parRun ( )
inlinestaticnoexcept

Test if this a parallel run.

Modify access is deprecated

Definition at line 433 of file UPstream.H.

Referenced by snappyLayerDriver::addLayers(), snappyLayerDriver::addLayersSinglePass(), unwatchedIOdictionary::addWatch(), regIOobject::addWatch(), GAMGAgglomeration::agglomerateLduAddressing(), Pstream::allGatherList(), Cloud< ParcelType >::autoMap(), meshRefinement::balance(), Pstream::broadcast(), Pstream::broadcasts(), AMIInterpolation::calcDistribution(), addPatchCellLayer::calcExtrudeInfo(), processorFaPatch::calcGeometry(), processorPolyPatch::calcGeometry(), processorCyclicPolyPatch::calcGeometry(), surfaceNoise::calculate(), waveMethod::calculate(), cyclicAMIPolyPatch::canResetAMI(), FaceCellWave< Type, TrackingData >::cellToFace(), OppositeFaceCellWave< Type, TrackingData >::cellToFace(), IOobjectList::checkNames(), faBoundaryMesh::checkParallelSync(), polyBoundaryMesh::checkParallelSync(), AMIInterpolation::checkSymmetricWeights(), Pstream::combineAllGather(), fieldValue::combineFields(), Pstream::combineGather(), Pstream::combineScatter(), dynamicOversetFvMesh::correctBoundaryConditions(), dynamicOversetFvMesh::correctCoupledBoundaryConditions(), meshRefinement::countEdgeFaces(), processorFaPatch::coupled(), processorFaePatchField< Type >::coupled(), processorFaPatchField< Type >::coupled(), processorFvPatchField< Type >::coupled(), cyclicACMIFvsPatchField< Type >::coupled(), processorFvsPatchField< Type >::coupled(), processorCyclicFvsPatchField< Type >::coupled(), cyclicACMIFvPatch::coupled(), cyclicAMIFvPatch::coupled(), processorFvPatch::coupled(), cyclicAMIPointPatch::coupled(), processorPointPatchField< Type >::coupled(), processorCyclicPointPatchField< Type >::coupled(), processorPolyPatch::coupled(), multiWorldConnections::createComms(), simpleGeomDecomp::decompose(), decompositionMethod::decompose(), metisLikeDecomp::decomposeGeneral(), conformalVoronoiMesh::decomposition(), processorFaPatch::delta(), processorFvPatch::delta(), masterUncollatedFileOperation::dirPath(), faMeshDistributor::distribute(), fvMeshDistribute::distribute(), distributedTriSurfaceMesh::distribute(), refinementHistory::distribute(), mapDistributeBase::distribute(), distributedTriSurfaceMesh::distributedTriSurfaceMesh(), faMeshBoundaryHalo::distributeSparse(), snappyLayerDriver::doLayers(), snappyRefineDriver::doRefine(), PointEdgeWave< Type, TrackingData >::edgeToPoint(), GeometricBoundaryField< Type, PatchField, GeoMesh >::evaluate(), processorFaPatchField< Type >::evaluate(), calculatedProcessorFvPatchField< Type >::evaluate(), processorFvPatchField< Type >::evaluate(), Foam::evaluateConstraintTypes(), GeometricBoundaryField< Type, PatchField, GeoMesh >::evaluateCoupled(), Pstream::exchange(), mapDistributeBase::exchangeMasks(), Foam::exitNow(), faMeshReconstructor::faMeshReconstructor(), masterUncollatedFileOperation::filePath(), polyMesh::findCell(), masterUncollatedFileOperation::findInstance(), distributedTriSurfaceMesh::findLine(), distributedTriSurfaceMesh::findLineAll(), distributedTriSurfaceMesh::findLineAny(), distributedTriSurfaceMesh::findNearest(), masterUncollatedFileOperation::findTimes(), Pstream::gather(), globalIndex::gather(), PatchTools::gatherAndMerge(), globalIndex::gatherInplace(), globalIndex::gatherInplaceOp(), Pstream::gatherList(), globalIndex::gatherOp(), zoneDistribute::getDatafromOtherProc(), distributedTriSurfaceMesh::getField(), distributedTriSurfaceMesh::getNormal(), distributedTriSurfaceMesh::getRegion(), distributedTriSurfaceMesh::getVolumeType(), GAMGProcAgglomeration::globalCellCells(), lduPrimitiveMesh::globalCellCells(), faMeshBoundaryHalo::haloSize(), InflationInjection< CloudType >::InflationInjection(), faMesh::init(), processorFaPatchField< Type >::initEvaluate(), calculatedProcessorFvPatchField< Type >::initEvaluate(), processorFvPatchField< Type >::initEvaluate(), processorFaPatch::initGeometry(), processorPolyPatch::initGeometry(), extractEulerianParticles::initialiseBins(), processorPolyPatch::initOrder(), processorCyclicPointPatchField< Type >::initSwapAddSeparated(), processorFaPatch::initUpdateMesh(), processorPolyPatch::initUpdateMesh(), collatedFileOperation::isMasterRank(), isoAdvection::isoAdvection(), FaceCellWave< Type, TrackingData >::iterate(), PointEdgeWave< Type, TrackingData >::iterate(), Pstream::listCombineAllGather(), Pstream::listCombineGather(), Pstream::listCombineScatter(), UPstream::listGatherValues(), UPstream::listScatterValues(), fvMeshTools::loadOrCreateMesh(), faMeshTools::loadOrCreateMesh(), masterUncollatedFileOperation::localObjectPath(), fileOperation::lookupAndCacheProcessorsPath(), LUscalarMatrix::LUscalarMatrix(), patchMeanVelocityForce::magUbarAve(), processorFaPatch::makeDeltaCoeffs(), processorFaPatch::makeNonGlobalPatchPoints(), processorFaPatch::makeWeights(), processorFvPatch::makeWeights(), Pstream::mapCombineAllGather(), Pstream::mapCombineGather(), Pstream::mapCombineScatter(), error::master(), masterUncollatedFileOperation::masterOp(), surfaceWriter::merge(), surfaceWriter::mergeFieldTemplate(), globalIndex::mpiGather(), globalIndex::mpiGatherInplace(), globalIndex::mpiGatherInplaceOp(), globalIndex::mpiGatherOp(), polyBoundaryMesh::neighbourEdges(), processorTopology::New(), masterUncollatedFileOperation::NewIFstream(), fvMeshTools::newMesh(), faMeshTools::newMesh(), fileWriter::open(), processorPolyPatch::order(), fieldMinMax::output(), InflationInjection< CloudType >::parcelsToInject(), argList::parse(), pointHistory::pointHistory(), RecycleInteraction< CloudType >::postEvolve(), powerLawLopesdaCostaZone::powerLawLopesdaCostaZone(), collatedFileOperation::processorsDir(), masterUncollatedFileOperation::read(), uncollatedFileOperation::read(), lumpedPointState::readData(), fieldsDistributor::readFields(), Time::readModifiedObjects(), masterUncollatedFileOperation::readObjects(), masterUncollatedFileOperation::readStream(), surfaceNoise::readSurfaceData(), Foam::reduce(), AMIWeights::reportPatch(), fvMeshSubset::reset(), faMeshBoundaryHalo::reset(), globalIndex::reset(), PPCG::scalarSolveCG(), Pstream::scatter(), globalIndex::scatter(), Pstream::scatterList(), mapDistributeBase::schedule(), Time::setControls(), surfaceWriter::setSurface(), zoneDistribute::setUpCommforZone(), globalMeshData::sharedPoints(), shortestPathSet::shortestPathSet(), error::simpleExit(), TDACChemistryModel< ReactionThermo, ThermoType >::solve(), LUscalarMatrix::solve(), messageStream::stream(), Foam::sumReduce(), surfaceWriter::surface(), surfaceNoise::surfaceAverage(), processorCyclicPointPatchField< Type >::swapAddSeparated(), syncObjects::sync(), syncTools::syncEdgeMap(), syncTools::syncPointMap(), triSurfaceMesh::triSurfaceMesh(), mapDistributeBase::unionCombineMasks(), ensightFaces::uniqueMeshPoints(), turbulentDFSEMInletFvPatchVectorField::updateCoeffs(), lduMatrix::updateMatrixInterfaces(), faMesh::updateMesh(), processorFaPatch::updateMesh(), processorPolyPatch::updateMesh(), fileOperation::updateStates(), mergedSurf::use(), energySpectrum::write(), vtkWrite::write(), ParticleZoneInfo< CloudType >::write(), ensightCells::write(), ensightFaces::write(), meshToMeshMethod::writeConnectivity(), AMIWeights::writeFileHeader(), fieldMinMax::writeFileHeader(), isoAdvection::writeIsoFaces(), faMeshReconstructor::writeMesh(), patchMeshWriter::writeNeighIDs(), collatedFileOperation::writeObject(), faMeshTools::writeProcAddressing(), fileWriter::writeProcIDs(), surfaceNoise::writeSurfaceData(), and streamLineBase::writeToFile().

◆ haveThreads()

static bool haveThreads ( )
inlinestaticnoexcept

Have support for threads.

Definition at line 439 of file UPstream.H.

Referenced by OFstreamCollator::write().

Here is the caller graph for this function:

◆ nProcs()

static label nProcs ( const label  communicator = worldComm)
inlinestatic

Number of processes in parallel run, and 1 for serial run.

Definition at line 445 of file UPstream.H.

References UList< T >::size().

Referenced by UPstream::allProcs(), UPstream::commsStruct::commsStruct(), UPstream::subProcs(), and UPstream::whichCommunication().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ masterNo()

◆ master()

static bool master ( const label  communicator = worldComm)
inlinestatic

Am I the master process.

Definition at line 457 of file UPstream.H.

References UPstream::masterNo().

Here is the call graph for this function:

◆ myProcNo()

static int myProcNo ( const label  communicator = worldComm)
inlinestatic

Number of this process (starting from masterNo() = 0)

Definition at line 463 of file UPstream.H.

Referenced by UPstream::myWorldID().

Here is the caller graph for this function:

◆ parent()

static label parent ( const label  communicator)
inlinestatic

Definition at line 468 of file UPstream.H.

◆ procID()

static List< int > & procID ( label  communicator)
inlinestatic

Process ID of given process index.

Definition at line 474 of file UPstream.H.

◆ allWorlds()

static const wordList & allWorlds ( )
inlinestaticnoexcept

All worlds.

Definition at line 483 of file UPstream.H.

Referenced by mappedPatchBase::calcMapping(), mappedPatchBase::masterWorld(), UPstream::myWorld(), argList::parse(), Foam::printDOT(), and mappedPatchBase::sameWorld().

Here is the caller graph for this function:

◆ worldIDs()

static const labelList & worldIDs ( )
inlinestaticnoexcept

worldID (index in allWorlds) of all processes

Definition at line 489 of file UPstream.H.

◆ myWorldID()

static label myWorldID ( )
inlinestatic

My worldID.

Definition at line 495 of file UPstream.H.

References UPstream::myProcNo().

Referenced by mappedPatchBase::calcMapping(), multiWorldConnections::createComms(), mappedPatchBase::masterWorld(), and UPstream::myWorld().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ myWorld()

static const word & myWorld ( )
inlinestatic

My world.

Definition at line 501 of file UPstream.H.

References UPstream::allWorlds(), and UPstream::myWorldID().

Referenced by multiWorldConnections::addConnectionById(), multiWorldConnections::addConnectionByName(), mappedPatchBase::calcMapping(), argList::parse(), mappedPatchBase::sameWorld(), and mappedPatchBase::sampleMesh().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ allProcs()

static rangeType allProcs ( const label  communicator = worldComm)
inlinestatic

Range of process indices for all processes.

Definition at line 508 of file UPstream.H.

References UPstream::nProcs().

Here is the call graph for this function:

◆ subProcs()

static rangeType subProcs ( const label  communicator = worldComm)
inlinestatic

Range of process indices for sub-processes.

Definition at line 515 of file UPstream.H.

References UPstream::nProcs().

Here is the call graph for this function:

◆ linearCommunication()

static const List< commsStruct > & linearCommunication ( const label  communicator = worldComm)
inlinestatic

Communication schedule for linear all-to-master (proc 0)

Definition at line 522 of file UPstream.H.

◆ treeCommunication()

static const List< commsStruct > & treeCommunication ( const label  communicator = worldComm)
inlinestatic

Communication schedule for tree all-to-master (proc 0)

Definition at line 531 of file UPstream.H.

◆ whichCommunication()

static const List< commsStruct > & whichCommunication ( const label  communicator = worldComm)
inlinestatic

Communication schedule for linear/tree all-to-master (proc 0). Chooses based on the value of UPstream::nProcsSimpleSum

Definition at line 541 of file UPstream.H.

References UPstream::nProcs(), and UPstream::nProcsSimpleSum.

Referenced by Pstream::allGatherList(), Pstream::combineAllGather(), Pstream::combineGather(), Pstream::combineScatter(), Pstream::gather(), Pstream::gatherList(), Pstream::listCombineAllGather(), Pstream::listCombineGather(), Pstream::listCombineScatter(), Pstream::mapCombineAllGather(), Pstream::mapCombineGather(), Pstream::mapCombineScatter(), Foam::reduce(), Pstream::scatter(), and Pstream::scatterList().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ msgType()

static int & msgType ( )
inlinestaticnoexcept

Message tag of standard messages.

Definition at line 556 of file UPstream.H.

Referenced by solidAbsorption::a(), mappedPatchBase::calcMapping(), masterUncollatedFileOperation::chMod(), meshRefinement::collectAndPrint(), mappedPatchBase::collectSamples(), extendedCentredCellToCellStencil::compact(), extendedCentredCellToFaceStencil::compact(), extendedCentredFaceToCellStencil::compact(), masterUncollatedFileOperation::cp(), inverseDistance::createStencil(), metisLikeDecomp::decomposeGeneral(), masterUncollatedFileOperation::dirPath(), faMeshDistributor::distribute(), mappedPatchBase::distribute(), solidAbsorption::e(), masterUncollatedFileOperation::exists(), masterUncollatedFileOperation::filePath(), masterUncollatedFileOperation::fileSize(), distributedTriSurfaceMesh::findNearest(), mappedPatchBase::findSamples(), lduPrimitiveMesh::gather(), Foam::gAverage(), distributedTriSurfaceMesh::getVolumeType(), Foam::gSumCmptProd(), Foam::gSumProd(), masterUncollatedFileOperation::highResLastModified(), viewFactor::initialise(), dynamicOversetFvMesh::interpolate(), regionModel::interRegionAMI(), masterUncollatedFileOperation::isDir(), masterUncollatedFileOperation::isFile(), masterUncollatedFileOperation::lastModified(), lduPrimitiveMesh::lduPrimitiveMesh(), masterUncollatedFileOperation::ln(), LUscalarMatrix::LUscalarMatrix(), mappedPatchFieldBase< Type >::mappedField(), mappedPatchFieldBase< Type >::mappedInternalField(), mappedPatchFieldBase< Type >::mappedWeightField(), regionModel::mapRegionPatchField(), regionModel::mapRegionPatchInternalField(), masterUncollatedFileOperation::mkDir(), masterUncollatedFileOperation::mode(), masterUncollatedFileOperation::mv(), masterUncollatedFileOperation::mvBak(), processorTopology::New(), masterUncollatedFileOperation::NewIFstream(), GAMGAgglomeration::procAgglomerateRestrictAddressing(), GAMGAgglomeration::prolongField(), decomposedBlockData::readBlocks(), masterUncollatedFileOperation::readDir(), masterUncollatedFileOperation::readHeader(), masterUncollatedFileOperation::readStream(), lduMesh::reduce(), fvMatrix< Type >::relax(), faMeshBoundaryHalo::reset(), GAMGAgglomeration::restrictField(), mappedPatchBase::reverseDistribute(), masterUncollatedFileOperation::rm(), masterUncollatedFileOperation::rmDir(), mapDistributeBase::schedule(), LUscalarMatrix::solve(), syncObjects::sync(), processorFaPatch::tag(), processorFvPatch::tag(), processorPolyPatch::tag(), processorCyclicPolyPatch::tag(), masterUncollatedFileOperation::type(), dynamicOversetFvMesh::updateAddressing(), mappedFixedInternalValueFvPatchField< Type >::updateCoeffs(), mappedFlowRateFvPatchVectorField::updateCoeffs(), mappedVelocityFluxFixedValueFvPatchField::updateCoeffs(), filmPyrolysisTemperatureCoupledFvPatchScalarField::updateCoeffs(), filmPyrolysisVelocityCoupledFvPatchVectorField::updateCoeffs(), alphatFilmWallFunctionFvPatchScalarField::updateCoeffs(), greyDiffusiveRadiationMixedFvPatchScalarField::updateCoeffs(), MarshakRadiationFvPatchScalarField::updateCoeffs(), MarshakRadiationFixedTemperatureFvPatchScalarField::updateCoeffs(), wideBandDiffusiveRadiationMixedFvPatchScalarField::updateCoeffs(), thermalBaffle1DFvPatchScalarField< solidType >::updateCoeffs(), turbulentTemperatureCoupledBaffleMixedFvPatchScalarField::updateCoeffs(), turbulentTemperatureRadCoupledMixedFvPatchScalarField::updateCoeffs(), globalMeshData::updateMesh(), Sampled< Type >::value(), OFstreamCollator::write(), and decomposedBlockData::writeBlocks().

◆ commsType() [1/2]

commsTypes commsType ( ) const
inlinenoexcept

Get the communications type of the stream.

Definition at line 562 of file UPstream.H.

Referenced by UIPstream::UIPstream(), and UIPstreamBase::UIPstreamBase().

Here is the caller graph for this function:

◆ commsType() [2/2]

commsTypes commsType ( const commsTypes  ct)
inlinenoexcept

Set the communications type of the stream.

Returns
the previous value

Definition at line 569 of file UPstream.H.

◆ shutdown()

void shutdown ( int  errNo = 0)
static

Shutdown (finalize) MPI as required.

Uses MPI_Abort instead of MPI_Finalize if errNo is non-zero

Definition at line 58 of file UPstream.C.

◆ abort()

void abort ( )
static

Call MPI_Abort with no other checks or cleanup.

Definition at line 69 of file UPstream.C.

Referenced by error::simpleExit().

Here is the caller graph for this function:

◆ exit()

void exit ( int  errNo = 1)
static

Shutdown (finalize) MPI as required and exit program with errNo.

Definition at line 62 of file UPstream.C.

◆ allToAll() [1/2]

void allToAll ( const UList< int32_t > &  sendData,
UList< int32_t > &  recvData,
const label  communicator = worldComm 
)
static

Exchange integer data with all processors (in the communicator).

sendData[proci] is the value to send to proci. After return recvData contains the data from the other processors.

Definition at line 48 of file UPstreamAllToAll.C.

Referenced by fvMeshDistribute::distribute(), and Pstream::exchangeSizes().

Here is the caller graph for this function:

◆ allToAll() [2/2]

void allToAll ( const UList< int64_t > &  sendData,
UList< int64_t > &  recvData,
const label  communicator = worldComm 
)
static

Exchange integer data with all processors (in the communicator).

sendData[proci] is the value to send to proci. After return recvData contains the data from the other processors.

Definition at line 49 of file UPstreamAllToAll.C.

◆ mpiGather()

void mpiGather ( const char *  sendData,
int  sendCount,
char *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Receive identically-sized char data from all ranks.

Definition at line 62 of file UPstreamGatherScatter.C.

Referenced by UPstream::listGatherValues().

Here is the caller graph for this function:

◆ mpiScatter()

void mpiScatter ( const char *  sendData,
int  sendCount,
char *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send identically-sized char data to all ranks.

Definition at line 62 of file UPstreamGatherScatter.C.

Referenced by UPstream::listScatterValues().

Here is the caller graph for this function:

◆ gather() [1/7]

void gather ( const char *  sendData,
int  sendCount,
char *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
const label  communicator = worldComm 
)
static

Receive variable length char data from all ranks.

Parameters
sendCountIgnored on master if recvCount[0] == 0
recvDataIgnored on non-root rank
recvCountsIgnored on non-root rank
recvOffsetsIgnored on non-root rank

Definition at line 102 of file UPstreamGatherScatter.C.

Referenced by decomposedBlockData::gather(), decomposedBlockData::gatherSlaveData(), and globalIndex::mpiGather().

Here is the caller graph for this function:

◆ scatter() [1/7]

void scatter ( const char *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
char *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send variable length char data to all ranks.

Parameters
sendDataIgnored on non-root rank
sendCountsIgnored on non-root rank
sendOffsetsIgnored on non-root rank

Definition at line 102 of file UPstreamGatherScatter.C.

Referenced by decomposedBlockData::calcNumProcs().

Here is the caller graph for this function:

◆ gather() [2/7]

void gather ( const int32_t *  sendData,
int  sendCount,
int32_t *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
const label  communicator = worldComm 
)
static

Receive variable length int32_t data from all ranks.

Parameters
sendCountIgnored on master if recvCount[0] == 0
recvDataIgnored on non-root rank
recvCountsIgnored on non-root rank
recvOffsetsIgnored on non-root rank

Definition at line 103 of file UPstreamGatherScatter.C.

◆ scatter() [2/7]

void scatter ( const int32_t *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
int32_t *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send variable length int32_t data to all ranks.

Parameters
sendDataIgnored on non-root rank
sendCountsIgnored on non-root rank
sendOffsetsIgnored on non-root rank

Definition at line 103 of file UPstreamGatherScatter.C.

◆ gather() [3/7]

void gather ( const int64_t *  sendData,
int  sendCount,
int64_t *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
const label  communicator = worldComm 
)
static

Receive variable length int64_t data from all ranks.

Parameters
sendCountIgnored on master if recvCount[0] == 0
recvDataIgnored on non-root rank
recvCountsIgnored on non-root rank
recvOffsetsIgnored on non-root rank

Definition at line 104 of file UPstreamGatherScatter.C.

◆ scatter() [3/7]

void scatter ( const int64_t *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
int64_t *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send variable length int64_t data to all ranks.

Parameters
sendDataIgnored on non-root rank
sendCountsIgnored on non-root rank
sendOffsetsIgnored on non-root rank

Definition at line 104 of file UPstreamGatherScatter.C.

◆ gather() [4/7]

void gather ( const uint32_t *  sendData,
int  sendCount,
uint32_t *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
const label  communicator = worldComm 
)
static

Receive variable length uint32_t data from all ranks.

Parameters
sendCountIgnored on master if recvCount[0] == 0
recvDataIgnored on non-root rank
recvCountsIgnored on non-root rank
recvOffsetsIgnored on non-root rank

Definition at line 105 of file UPstreamGatherScatter.C.

◆ scatter() [4/7]

void scatter ( const uint32_t *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
uint32_t *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send variable length uint32_t data to all ranks.

Parameters
sendDataIgnored on non-root rank
sendCountsIgnored on non-root rank
sendOffsetsIgnored on non-root rank

Definition at line 105 of file UPstreamGatherScatter.C.

◆ gather() [5/7]

void gather ( const uint64_t *  sendData,
int  sendCount,
uint64_t *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
const label  communicator = worldComm 
)
static

Receive variable length uint64_t data from all ranks.

Parameters
sendCountIgnored on master if recvCount[0] == 0
recvDataIgnored on non-root rank
recvCountsIgnored on non-root rank
recvOffsetsIgnored on non-root rank

Definition at line 106 of file UPstreamGatherScatter.C.

◆ scatter() [5/7]

void scatter ( const uint64_t *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
uint64_t *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send variable length uint64_t data to all ranks.

Parameters
sendDataIgnored on non-root rank
sendCountsIgnored on non-root rank
sendOffsetsIgnored on non-root rank

Definition at line 106 of file UPstreamGatherScatter.C.

◆ gather() [6/7]

void gather ( const float *  sendData,
int  sendCount,
float *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
const label  communicator = worldComm 
)
static

Receive variable length float data from all ranks.

Parameters
sendCountIgnored on master if recvCount[0] == 0
recvDataIgnored on non-root rank
recvCountsIgnored on non-root rank
recvOffsetsIgnored on non-root rank

Definition at line 107 of file UPstreamGatherScatter.C.

◆ scatter() [6/7]

void scatter ( const float *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
float *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send variable length float data to all ranks.

Parameters
sendDataIgnored on non-root rank
sendCountsIgnored on non-root rank
sendOffsetsIgnored on non-root rank

Definition at line 107 of file UPstreamGatherScatter.C.

◆ gather() [7/7]

void gather ( const double *  sendData,
int  sendCount,
double *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
const label  communicator = worldComm 
)
static

Receive variable length double data from all ranks.

Parameters
sendCountIgnored on master if recvCount[0] == 0
recvDataIgnored on non-root rank
recvCountsIgnored on non-root rank
recvOffsetsIgnored on non-root rank

Definition at line 108 of file UPstreamGatherScatter.C.

◆ scatter() [7/7]

void scatter ( const double *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
double *  recvData,
int  recvCount,
const label  communicator = worldComm 
)
static

Send variable length double data to all ranks.

Parameters
sendDataIgnored on non-root rank
sendCountsIgnored on non-root rank
sendOffsetsIgnored on non-root rank

Definition at line 108 of file UPstreamGatherScatter.C.

◆ listGatherValues() [1/2]

static List< T > listGatherValues ( const T localValue,
const label  communicator = worldComm 
)
static

Gather individual values into list locations.

On master list length == nProcs, otherwise zero length. If called in non-parallel mode, the returned list length is 1 with localValue.

Referenced by globalIndex::globalIndex(), and globalIndex::reset().

Here is the caller graph for this function:

◆ listScatterValues()

T listScatterValues ( const UList< T > &  allValues,
const label  communicator = worldComm 
)
static

Scatter individual values from list locations.

On master input list length == nProcs, ignored on other procs. If called in non-parallel mode, returns the first list element (or zero).

Definition at line 77 of file UPstreamTemplates.C.

References Foam::abort(), UList< T >::cdata_bytes(), UList< T >::empty(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, splitCell::master(), UPstream::mpiScatter(), PstreamBuffers::nProcs(), UPstream::parRun(), UList< T >::size(), T, and Foam::Zero.

Here is the call graph for this function:

◆ broadcast()

bool broadcast ( char *  buf,
const std::streamsize  bufSize,
const label  communicator = worldComm,
const int  rootProcNo = masterNo() 
)
static

Broadcast buffer contents to all processes in communicator. The sizes must match on all processes.

Returns
True on success

Definition at line 32 of file UPstreamBroadcast.C.

Referenced by Pstream::broadcast(), and globalIndex::mpiGather().

Here is the caller graph for this function:

◆ firstSlave()

static constexpr int firstSlave ( )
inlinestaticconstexprnoexcept

Process index of first sub-process.

Deprecated:
(2020-09) use subProcs() method instead

Definition at line 715 of file UPstream.H.

◆ lastSlave()

static int lastSlave ( const label  communicator = worldComm)
inlinestatic

Process index of last sub-process.

Deprecated:
(2020-09) use subProcs() method instead

Definition at line 722 of file UPstream.H.

◆ listGatherValues() [2/2]

Foam::List< T > listGatherValues ( const T localValue,
const label  comm 
)

Definition at line 31 of file UPstreamTemplates.C.

References Foam::abort(), UList< T >::data_bytes(), Foam::endl(), Foam::FatalError, FatalErrorInFunction, splitCell::master(), UPstream::mpiGather(), PstreamBuffers::nProcs(), UPstream::parRun(), List< T >::resize(), and T.

Here is the call graph for this function:

Member Data Documentation

◆ commsTypeNames

◆ floatTransfer

◆ nProcsSimpleSum

int nProcsSimpleSum
static

Number of processors to change from linear to tree communication.

Definition at line 278 of file UPstream.H.

Referenced by UList< T >::operator[](), argList::parse(), and UPstream::whichCommunication().

◆ defaultCommsType

◆ nPollProcInterfaces

int nPollProcInterfaces
static

Number of polling cycles in processor updates.

Definition at line 284 of file UPstream.H.

Referenced by argList::parse(), and lduMatrix::updateMatrixInterfaces().

◆ maxCommsSize

int maxCommsSize
static

Optional maximum message size (bytes)

Definition at line 287 of file UPstream.H.

Referenced by Pstream::exchange().

◆ mpiBufferSize

const int mpiBufferSize
static

MPI buffer-size (bytes)

Definition at line 290 of file UPstream.H.

Referenced by attachOurBuffers().

◆ worldComm

◆ warnComm


The documentation for this class was generated from the following files: