Loading...
Searching...
No Matches
Foam::PstreamGlobals Namespace Reference

Global functions and variables for working with parallel streams, but principally for MPI. More...

Typedefs

typedef Foam::FixedList< int, 17 > DataTypeCountLookupTable
typedef Foam::FixedList< MPI_Datatype, 17 > DataTypeLookupTable
typedef Foam::FixedList< MPI_Op, 13 > OpCodesLookupTable

Functions

void initCommunicator (const label index)
 Initialize bookkeeping for MPI communicator index.
void checkCommunicator (int comm, int rank)
 Fatal if communicator is outside the allocated range.
bool warnCommunicator (int comm) noexcept
 True if warn communicator is active and not equal to given communicator.
void initDataTypes ()
 Create mapping into MPIdataTypes_ and define user data types.
void deinitDataTypes ()
 Free any user data types.
bool checkDataTypes ()
 Debugging only: check if data type mappings are non-null.
void printDataTypes (bool all=false)
 Debugging only: print data type names (all or just user-defined).
MPI_Datatype getDataType (UPstream::dataTypes id)
 Lookup of dataTypes enumeration as an MPI_Datatype.
void checkDataType (UPstream::dataTypes id)
 Fatal if data type is not valid.
std::string dataType_name (MPI_Datatype datatype)
 Return MPI internal name for specified MPI_Datatype.
std::string dataType_name (UPstream::dataTypes id)
 Return MPI internal name for dataTypes enumeration.
void initOpCodes ()
 Create mapping into MPIopCodes_.
void deinitOpCodes ()
 Free any user-defined op codes.
bool checkOpCodes ()
 Debugging only: check if op code mappings are non-null.
MPI_Op getOpCode (UPstream::opCodes id)
 Lookup of opCodes enumeration as an MPI_Op.
void checkOpCode (UPstream::opCodes id)
 Fatal if opcode is not valid.
void reset_request (UPstream::Request *req) noexcept
 Reset UPstream::Request to MPI_REQUEST_NULL.
void push_request (MPI_Request request, UPstream::Request *req=nullptr)
 Transcribe MPI_Request to UPstream::Request (does not affect the stack of outstanding requests) or else push onto list of outstanding requests.
bool broadcast_int64 (int64_t &value, int comm, int root=0)
 Broadcast a single int64 value.

Variables

DynamicList< bool > pendingMPIFree_
DynamicList< MPI_Comm > MPICommunicators_
DynamicList< MPI_Request > outstandingRequests_
 Outstanding non-blocking operations.
DataTypeCountLookupTable dataTypesCount_
 Fundamental count for each valid UPstream::dataTypes entry Indexed by UPstream::dataTypes enum.
DataTypeLookupTable MPIdataTypes_
 MPI data types corresponding to fundamental and OpenFOAM types. Indexed by UPstream::dataTypes enum.
OpCodesLookupTable MPIopCodes_
 MPI operation types, indexed by UPstream::opCodes enum.

Detailed Description

Global functions and variables for working with parallel streams, but principally for MPI.

Source files

Typedef Documentation

◆ DataTypeCountLookupTable

Definition at line 65 of file PstreamGlobals.H.

◆ DataTypeLookupTable

typedef Foam::FixedList<MPI_Datatype, 17> DataTypeLookupTable

Definition at line 74 of file PstreamGlobals.H.

◆ OpCodesLookupTable

typedef Foam::FixedList<MPI_Op, 13> OpCodesLookupTable

Definition at line 83 of file PstreamGlobals.H.

Function Documentation

◆ initCommunicator()

void initCommunicator ( const label index)

Initialize bookkeeping for MPI communicator index.

Definition at line 42 of file PstreamGlobals.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, FOAM_UNLIKELY, MPICommunicators_, and pendingMPIFree_.

Here is the call graph for this function:

◆ checkCommunicator()

void checkCommunicator ( int comm,
int rank )
inline

Fatal if communicator is outside the allocated range.

Definition at line 102 of file PstreamGlobals.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, FOAM_UNLIKELY, MPICommunicators_, and Foam::nl.

Here is the call graph for this function:

◆ warnCommunicator()

bool warnCommunicator ( int comm)
inlinenoexcept

True if warn communicator is active and not equal to given communicator.

Definition at line 118 of file PstreamGlobals.H.

References UPstream::warnComm.

◆ initDataTypes()

void initDataTypes ( )

Create mapping into MPIdataTypes_ and define user data types.

Definition at line 67 of file PstreamGlobals.C.

References UPstream::DataTypes_end, defineType, defineUserType, FixedList< int, 17 >::max_size(), and FixedList< MPI_Datatype, 17 >::max_size().

Here is the call graph for this function:

◆ deinitDataTypes()

void deinitDataTypes ( )

Free any user data types.

Definition at line 128 of file PstreamGlobals.C.

References MPIdataTypes_, UPstream::User_begin, and UPstream::User_end.

◆ checkDataTypes()

bool checkDataTypes ( )

Debugging only: check if data type mappings are non-null.

Definition at line 151 of file PstreamGlobals.C.

References UPstream::DataTypes_end, and MPIdataTypes_.

◆ printDataTypes()

void printDataTypes ( bool all = false)

Debugging only: print data type names (all or just user-defined).

Definition at line 176 of file PstreamGlobals.C.

References UPstream::Basic_begin, UPstream::Basic_end, dataType_name(), MPIdataTypes_, UPstream::User_begin, and UPstream::User_end.

Here is the call graph for this function:

◆ getDataType()

MPI_Datatype getDataType ( UPstream::dataTypes id)
inline

Lookup of dataTypes enumeration as an MPI_Datatype.

Definition at line 149 of file PstreamGlobals.H.

References MPIdataTypes_.

◆ checkDataType()

void checkDataType ( UPstream::dataTypes id)
inline

Fatal if data type is not valid.

Definition at line 157 of file PstreamGlobals.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and UPstream::invalid.

Here is the call graph for this function:

◆ dataType_name() [1/2]

std::string dataType_name ( MPI_Datatype datatype)

Return MPI internal name for specified MPI_Datatype.

Definition at line 229 of file PstreamGlobals.C.

Referenced by dataType_name(), and printDataTypes().

Here is the caller graph for this function:

◆ dataType_name() [2/2]

std::string dataType_name ( UPstream::dataTypes id)
inline

Return MPI internal name for dataTypes enumeration.

Definition at line 175 of file PstreamGlobals.H.

References dataType_name(), and MPIdataTypes_.

Here is the call graph for this function:

◆ initOpCodes()

void initOpCodes ( )

Create mapping into MPIopCodes_.

Definition at line 257 of file PstreamGlobals.C.

References defineCode, FixedList< MPI_Op, 13 >::max_size(), and UPstream::OpCodes_end.

Here is the call graph for this function:

◆ deinitOpCodes()

void deinitOpCodes ( )

Free any user-defined op codes.

Definition at line 297 of file PstreamGlobals.C.

◆ checkOpCodes()

bool checkOpCodes ( )

Debugging only: check if op code mappings are non-null.

Definition at line 301 of file PstreamGlobals.C.

References MPIopCodes_, and UPstream::OpCodes_end.

◆ getOpCode()

MPI_Op getOpCode ( UPstream::opCodes id)
inline

Lookup of opCodes enumeration as an MPI_Op.

Definition at line 201 of file PstreamGlobals.H.

References MPIopCodes_.

◆ checkOpCode()

void checkOpCode ( UPstream::opCodes id)
inline

Fatal if opcode is not valid.

Definition at line 209 of file PstreamGlobals.H.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, and UPstream::invalid.

Here is the call graph for this function:

◆ reset_request()

void reset_request ( UPstream::Request * req)
inlinenoexcept

Reset UPstream::Request to MPI_REQUEST_NULL.

Does not affect the stack of outstanding requests

Definition at line 227 of file PstreamGlobals.H.

◆ push_request()

void push_request ( MPI_Request request,
UPstream::Request * req = nullptr )
inline

Transcribe MPI_Request to UPstream::Request (does not affect the stack of outstanding requests) or else push onto list of outstanding requests.

Definition at line 238 of file PstreamGlobals.H.

References outstandingRequests_.

◆ broadcast_int64()

bool broadcast_int64 ( int64_t & value,
int comm,
int root = 0 )
inline

Broadcast a single int64 value.

Ensures consistent data types. Used within the following:

  • UIPBstream::bufferIPCrecv()
  • UOPBstream::bufferIPCsend()
  • UOPBstream::send(Foam::zero, ...)

Definition at line 269 of file PstreamGlobals.H.

References MPICommunicators_.

Variable Documentation

◆ pendingMPIFree_

Foam::DynamicList< bool > pendingMPIFree_
extern

Definition at line 26 of file PstreamGlobals.C.

Referenced by initCommunicator().

◆ MPICommunicators_

Foam::DynamicList< MPI_Comm > MPICommunicators_
extern

Definition at line 27 of file PstreamGlobals.C.

Referenced by broadcast_int64(), checkCommunicator(), and initCommunicator().

◆ outstandingRequests_

Foam::DynamicList< MPI_Request > outstandingRequests_
extern

Outstanding non-blocking operations.

Definition at line 28 of file PstreamGlobals.C.

Referenced by push_request().

◆ dataTypesCount_

Fundamental count for each valid UPstream::dataTypes entry Indexed by UPstream::dataTypes enum.

◆ MPIdataTypes_

MPI data types corresponding to fundamental and OpenFOAM types. Indexed by UPstream::dataTypes enum.

Referenced by checkDataTypes(), dataType_name(), deinitDataTypes(), getDataType(), and printDataTypes().

◆ MPIopCodes_

MPI operation types, indexed by UPstream::opCodes enum.

Referenced by checkOpCodes(), and getOpCode().