Foam::PstreamDetail Namespace Reference

Implementation details for UPstream/Pstream/MPI etc. More...

Classes

struct  Request
 

Functions

template<class Type >
void exchangeBuf (const UList< std::pair< int, stdFoam::span< const Type >>> &sends, const UList< std::pair< int, stdFoam::span< Type >>> &recvs, const int tag, const label comm, const bool wait)
 Setup sends and receives, each specified as [rank, span] tuple. More...
 
template<class Type >
void exchangeChunkedBuf (const UList< std::pair< int, stdFoam::span< const Type >>> &sends, const UList< std::pair< int, stdFoam::span< Type >>> &recvs, const int tag, const label comm, const bool wait)
 Chunked exchange of contiguous data. Setup sends and receives, each specified as [rank, span] tuple. More...
 
template<class Container , class Type >
void exchangeContainer (const UList< Container > &sendBufs, UList< Container > &recvBufs, const int tag, const label comm, const bool wait)
 Exchange contiguous data using point-to-point communication. Sends sendBufs, receives into recvBufs. More...
 
template<class Container , class Type >
void exchangeContainer (const Map< Container > &sendBufs, Map< Container > &recvBufs, const int tag, const label comm, const bool wait)
 Exchange contiguous data using point-to-point communication. Sends sendBufs, receives into recvBufs. More...
 
template<class Container , class Type >
void exchangeConsensus (const UList< Container > &sendBufs, UList< Container > &recvBufs, labelUList &recvSizes, const int tag, const label comm)
 Exchange contiguous data using non-blocking consensus exchange (NBX) with optional tracking of the receive sizes. More...
 
template<class Container , class Type >
void exchangeConsensus (const Map< Container > &sendBufs, Map< Container > &recvBufs, const int tag, const label comm)
 Exchange contiguous data using non-blocking consensus exchange (NBX) More...
 
template<class Type >
void broadcast0 (Type *values, int count, MPI_Datatype datatype, const label comm)
 
template<class Type >
void reduce0 (Type *values, int count, MPI_Datatype datatype, MPI_Op optype, const label comm)
 
template<class Type >
void allReduce (Type *values, int count, MPI_Datatype datatype, MPI_Op optype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 
template<class Type >
void allToAll (const UList< Type > &sendData, UList< Type > &recvData, MPI_Datatype datatype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 
template<class Type >
void allToAllv (const Type *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, Type *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, MPI_Datatype datatype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 
template<class Type >
void allToAllConsensus (const UList< Type > &sendData, UList< Type > &recvData, MPI_Datatype datatype, const int tag, const label comm)
 
template<class Type >
void allToAllConsensus (const Map< Type > &sendData, Map< Type > &recvData, MPI_Datatype datatype, const int tag, const label comm)
 
template<class Type >
void gather (const Type *sendData, Type *recvData, int count, MPI_Datatype datatype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 
template<class Type >
void scatter (const Type *sendData, Type *recvData, int count, MPI_Datatype datatype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 
template<class Type >
void gatherv (const Type *sendData, int sendCount, Type *recvData, const UList< int > &recvCounts, const UList< int > &recvOffsets, MPI_Datatype datatype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 
template<class Type >
void scatterv (const Type *sendData, const UList< int > &sendCounts, const UList< int > &sendOffsets, Type *recvData, int recvCount, MPI_Datatype datatype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 
template<class Type >
void allGather (Type *allData, int count, MPI_Datatype datatype, const label comm, UPstream::Request *req=nullptr, label *requestID=nullptr)
 

Detailed Description

Implementation details for UPstream/Pstream/MPI etc.

Function Documentation

◆ exchangeBuf()

void Foam::PstreamDetail::exchangeBuf ( const UList< std::pair< int, stdFoam::span< const Type >>> &  sends,
const UList< std::pair< int, stdFoam::span< Type >>> &  recvs,
const int  tag,
const label  comm,
const bool  wait 
)

Setup sends and receives, each specified as [rank, span] tuple.

The serial list of tuples can be populated from other lists, from maps of data or subsets of lists/maps etc.

Definition at line 41 of file PstreamExchange.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, UPstream::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), UIPstream::read(), UPstream::waitRequests(), and UOPstream::write().

Here is the call graph for this function:

◆ exchangeChunkedBuf()

void Foam::PstreamDetail::exchangeChunkedBuf ( const UList< std::pair< int, stdFoam::span< const Type >>> &  sends,
const UList< std::pair< int, stdFoam::span< Type >>> &  recvs,
const int  tag,
const label  comm,
const bool  wait 
)

Chunked exchange of contiguous data. Setup sends and receives, each specified as [rank, span] tuple.

The serial list of tuples can be populated from other lists, from maps of data or subsets of lists/maps etc.

Definition at line 128 of file PstreamExchange.C.

References Foam::BitOps::count(), stdFoam::end(), Foam::endl(), UList< T >::first(), Foam::flatOutput(), forAll, Foam::Info, Foam::max(), UPstream::maxCommsSize, UPstream::msgType(), UPstream::myProcNo(), and Foam::reduce().

Here is the call graph for this function:

◆ exchangeContainer() [1/2]

void Foam::PstreamDetail::exchangeContainer ( const UList< Container > &  sendBufs,
UList< Container > &  recvBufs,
const int  tag,
const label  comm,
const bool  wait 
)

Exchange contiguous data using point-to-point communication. Sends sendBufs, receives into recvBufs.

Data provided and received as container all of which have been properly sized before calling

No internal guards or resizing.

Parameters
waitWait for requests to complete

Definition at line 298 of file PstreamExchange.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAll, UPstream::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), UIPstream::read(), UPstream::waitRequests(), and UOPstream::write().

Here is the call graph for this function:

◆ exchangeContainer() [2/2]

void Foam::PstreamDetail::exchangeContainer ( const Map< Container > &  sendBufs,
Map< Container > &  recvBufs,
const int  tag,
const label  comm,
const bool  wait 
)

Exchange contiguous data using point-to-point communication. Sends sendBufs, receives into recvBufs.

Data provided and received as container all of which have been properly sized before calling

No internal guards or resizing.

Parameters
waitWait for requests to complete

Definition at line 383 of file PstreamExchange.C.

References Foam::abort(), Foam::FatalError, FatalErrorInFunction, forAllConstIters(), forAllIters, UPstream::myProcNo(), UPstream::nonBlocking, UPstream::nRequests(), UIPstream::read(), UPstream::waitRequests(), and UOPstream::write().

Here is the call graph for this function:

◆ exchangeConsensus() [1/2]

void Foam::PstreamDetail::exchangeConsensus ( const UList< Container > &  sendBufs,
UList< Container > &  recvBufs,
labelUList recvSizes,
const int  tag,
const label  comm 
)

Exchange contiguous data using non-blocking consensus exchange (NBX) with optional tracking of the receive sizes.

No internal guards or resizing - data containers are all properly sized before calling.

Parameters
[in]sendBufsThe send buffers list (size: numProc)
[out]recvBufsThe recv buffers list (size: numProc)
[out]recvSizesThe recv sizes (size: 0 or numProc). This parameter can be an empty list, in which case the receive sizes are not returned.
tagThe message tag
commThe communicator

Definition at line 61 of file PstreamExchangeConsensus.C.

References Foam::abort(), UPstream::barrier(), UPstream::blocking, Foam::BitOps::count(), Foam::FatalError, FatalErrorInFunction, UPstream::finishedRequest(), UPstream::finishedRequests(), UPstream::is_parallel(), UPstream::is_rank(), UPstream::myProcNo(), UPstream::nonBlocking, UPstream::nProcs(), UPstream::probeMessage(), UIPstream::read(), UList< T >::size(), UPstream::sync, UPstream::tuning_NBX_, UOPstream::write(), and Foam::Zero.

Here is the call graph for this function:

◆ exchangeConsensus() [2/2]

void Foam::PstreamDetail::exchangeConsensus ( const Map< Container > &  sendBufs,
Map< Container > &  recvBufs,
const int  tag,
const label  comm 
)

Exchange contiguous data using non-blocking consensus exchange (NBX)

No internal guards - the sending Map corresponds to a segment of 0-numProc.

Parameters
[in]sendBufsThe send buffers map (addr: 0-numProc)
[out]recvBufsThe recv buffers map
tagThe message tag
commThe communicator

Definition at line 247 of file PstreamExchangeConsensus.C.

References UPstream::barrier(), UPstream::blocking, Foam::BitOps::count(), HashTable< T, label, Hash< label > >::find(), UPstream::finishedRequest(), UPstream::finishedRequests(), forAllConstIters(), forAllIters, UPstream::is_parallel(), UPstream::is_rank(), UPstream::myProcNo(), UPstream::nonBlocking, UPstream::probeMessage(), UIPstream::read(), HashTable< T, label, Hash< label > >::size(), UPstream::sync, and UOPstream::write().

Here is the call graph for this function:

◆ broadcast0()

void Foam::PstreamDetail::broadcast0 ( Type *  values,
int  count,
MPI_Datatype  datatype,
const label  comm 
)

◆ reduce0()

void Foam::PstreamDetail::reduce0 ( Type *  values,
int  count,
MPI_Datatype  datatype,
MPI_Op  optype,
const label  comm 
)

◆ allReduce()

void Foam::PstreamDetail::allReduce ( Type *  values,
int  count,
MPI_Datatype  datatype,
MPI_Op  optype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)

◆ allToAll()

void Foam::PstreamDetail::allToAll ( const UList< Type > &  sendData,
UList< Type > &  recvData,
MPI_Datatype  datatype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)

Referenced by Pstream::exchangeSizes().

Here is the caller graph for this function:

◆ allToAllv()

void Foam::PstreamDetail::allToAllv ( const Type *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
Type *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
MPI_Datatype  datatype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)

◆ allToAllConsensus() [1/2]

void Foam::PstreamDetail::allToAllConsensus ( const UList< Type > &  sendData,
UList< Type > &  recvData,
MPI_Datatype  datatype,
const int  tag,
const label  comm 
)

Referenced by Pstream::exchangeSizes().

Here is the caller graph for this function:

◆ allToAllConsensus() [2/2]

void Foam::PstreamDetail::allToAllConsensus ( const Map< Type > &  sendData,
Map< Type > &  recvData,
MPI_Datatype  datatype,
const int  tag,
const label  comm 
)

◆ gather()

void Foam::PstreamDetail::gather ( const Type *  sendData,
Type *  recvData,
int  count,
MPI_Datatype  datatype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)

◆ scatter()

void Foam::PstreamDetail::scatter ( const Type *  sendData,
Type *  recvData,
int  count,
MPI_Datatype  datatype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)

◆ gatherv()

void Foam::PstreamDetail::gatherv ( const Type *  sendData,
int  sendCount,
Type *  recvData,
const UList< int > &  recvCounts,
const UList< int > &  recvOffsets,
MPI_Datatype  datatype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)

◆ scatterv()

void Foam::PstreamDetail::scatterv ( const Type *  sendData,
const UList< int > &  sendCounts,
const UList< int > &  sendOffsets,
Type *  recvData,
int  recvCount,
MPI_Datatype  datatype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)

◆ allGather()

void Foam::PstreamDetail::allGather ( Type *  allData,
int  count,
MPI_Datatype  datatype,
const label  comm,
UPstream::Request req = nullptr,
label *  requestID = nullptr 
)