WARPXM v1.10.0
Loading...
Searching...
No Matches
WxMpiMsg Class Reference

MPI Messenger. More...

#include <wxmpimsg.h>

Inheritance diagram for WxMpiMsg:
WxMsgBase

Detailed Description

MPI Messenger.

Public Member Functions

 WxMpiMsg ()
 Construct a new MPI messenger give a set of communicating processors.
 
int rank () const override
 Rank of process.
 
unsigned numProcs () const override
 Number of processes taking part in messaging.
 
WxMsgBasecreateSubComm (const std::vector< int > &ranks) override
 Split communicator into a child communicator.
 
WxMsgBasesplitComm (int color, int order) override
 See MPI_Comm_split.
 
void barrier () const override
 Block till all processes hit this barrier.
 
void * finishRecv (WxMsgStatus ms) const override
 Finish the receive started by startRecv and return a pointer to the data recieved.
 
void finishSend (WxMsgStatus ms) const override
 Finish the send started by startSend.
 
bool checkRecv (WxMsgStatus ms) const override
 Check status of recieve started by a startRecv.
 
MPI_Comm getMpiComm () const
 Get MPI communicator for this class.
 
- Public Member Functions inherited from WxMsgBase
virtual ~WxMsgBase ()
 Destructor.
 
virtual int rank () const =0
 Rank of process.
 
virtual unsigned numProcs () const =0
 Number of processes taking part in messaging.
 
WxMsgBaseparent () const
 Get parent communicating processor group.
 
virtual WxMsgBasecreateSubComm (const std::vector< int > &ranks)=0
 Split communicator into a child communicator.
 
virtual WxMsgBasesplitComm (int color, int order)=0
 See MPI_Comm_split.
 
virtual void barrier () const =0
 Block till all processes hit this barrier.
 
template<typename T >
void send (const std::vector< T > &array, unsigned recvRank, int tag=-1) const
 Send a std::vector to another rank.
 
template<typename T >
void send (unsigned num, const T *array, unsigned recvRank, int tag=-1) const
 Send an array to another rank.
 
template<typename T >
WxMsgStatus startSend (const std::vector< T > &vec, unsigned recvRank, int tag=-1) const
 Send an vector to another rank.
 
template<typename T >
WxMsgStatus startSend (unsigned num, const T *arr, unsigned recvRank, int tag=-1) const
 Send an array to another rank.
 
virtual void finishSend (WxMsgStatus ms) const =0
 Finish the send started by startSend.
 
template<typename T >
void recv (int num, std::vector< T > &array, unsigned sendRank, int tag=-1) const
 Receive a std::vector from another rank.
 
template<typename T >
void recv (unsigned num, T *array, unsigned sendRank, int tag=-1) const
 Receive an array from another rank.
 
template<typename T >
WxMsgStatus startRecv (unsigned num, unsigned sendRank, int tag=-1) const
 Receive an array from another rank.
 
template<typename T >
WxMsgStatus startRecv (unsigned num, T *arr, unsigned sendRank, int tag=-1) const
 Receive an array from another rank.
 
template<typename T >
WxMsgStatus startRecv (std::vector< T > &vec, unsigned sendRank, int tag=-1) const
 Receive an array from another rank.
 
virtual void * finishRecv (WxMsgStatus ms) const =0
 Finish the receive started by startRecv and return a pointer to the data recieved.
 
virtual bool checkRecv (WxMsgStatus ms) const =0
 Check status of recieve started by a startRecv.
 
template<typename T >
void allReduce (unsigned num, T *sendBuff, T *recvBuff, MPI_Op op) const
 Reduce data to all ranks.
 
template<typename T >
std::vector< T > allReduce (std::vector< T > sendBuff, MPI_Op op) const
 Reduce data to all ranks (vector form)
 
template<typename T >
void broadcast (unsigned num, T *buffer, int root) const
 

Additional Inherited Members

- Public Types inherited from WxMsgBase
typedef WxTypeMap< WxDataTypes_t, WxMsgContainerWxMsgTypeMap_t
 
- Public Attributes inherited from WxMsgBase
WxMsgTypeMap_t _msgTypeMap
 
- Protected Member Functions inherited from WxMsgBase
 WxMsgBase (int sendTag=0, int recvTag=0, WxMsgBase *parent=0)
 Constructor.
 
template<typename T >
void addMsg (WxMsgTmpl< T > *b)
 Add a new messager : the derived class should call this to setup WxMsgBase properly.
 

Constructor & Destructor Documentation

◆ WxMpiMsg()

WxMpiMsg::WxMpiMsg ( )

Construct a new MPI messenger give a set of communicating processors.

Parameters
commProcsset of communicating processors

Member Function Documentation

◆ barrier()

void WxMpiMsg::barrier ( ) const
inlineoverridevirtual

Block till all processes hit this barrier.

Implements WxMsgBase.

◆ checkRecv()

bool WxMpiMsg::checkRecv ( WxMsgStatus  ms) const
overridevirtual

Check status of recieve started by a startRecv.

If this call returns true then finishRecv can be called to immediately recieve the data.

Parameters
msmessage status object returned by startRecv
Returns
true it recieve has been completed, false otherwise

Implements WxMsgBase.

◆ createSubComm()

WxMsgBase * WxMpiMsg::createSubComm ( const std::vector< int > &  ranks)
overridevirtual

Split communicator into a child communicator.

Parameters
rankslist of processors in old communicator which are to be in the new communicator
Returns
new communicator

Implements WxMsgBase.

◆ finishRecv()

void * WxMpiMsg::finishRecv ( WxMsgStatus  ms) const
overridevirtual

Finish the receive started by startRecv and return a pointer to the data recieved.

The calling function owns the pointer and is resposible for freeing it.

Parameters
msmessage status object returned by startRecv

Implements WxMsgBase.

◆ finishSend()

void WxMpiMsg::finishSend ( WxMsgStatus  ms) const
overridevirtual

Finish the send started by startSend.

Parameters
msmessage status object returned by startSend

Implements WxMsgBase.

◆ getMpiComm()

MPI_Comm WxMpiMsg::getMpiComm ( ) const
inline

Get MPI communicator for this class.

Returns
MPI communicator

◆ numProcs()

unsigned WxMpiMsg::numProcs ( ) const
inlineoverridevirtual

Number of processes taking part in messaging.

Returns
num of processes

Implements WxMsgBase.

◆ rank()

int WxMpiMsg::rank ( ) const
inlineoverridevirtual

Rank of process.

Returns
this rank

Implements WxMsgBase.

◆ splitComm()

WxMsgBase * WxMpiMsg::splitComm ( int  color,
int  order 
)
overridevirtual

See MPI_Comm_split.

Implements WxMsgBase.


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