OpenM++ runtime library (libopenm)
openm::MpiExec Class Reference

message passing library main class for MPI-based implementation More...

#include <msgMpiExec.h>

Inheritance diagram for openm::MpiExec:
Collaboration diagram for openm::MpiExec:

Public Member Functions

 MpiExec (int &argc, char **&argv, IFinalState *i_final)
 create message passing interface by MPI_Init. More...
 
 ~MpiExec (void) noexcept
 cleanup message passing resources by MPI_Finalize.
 
int worldSize (void) const noexcept override
 return total number of processes in MPI world communicator. More...
 
int rank (void) const noexcept override
 return current process MPI rank. More...
 
int groupRank (void) const noexcept override
 return rank in modeling group. More...
 
void setCleanExit (bool i_isClean=false) override
 set clean exit flag for normal shutdown messaging else abort MPI. More...
 
void createGroups (int i_groupSize, int i_groupCount) override
 create groups for parallel run of modeling task. More...
 
void bcastValue (int i_groupOne, const type_info &i_type, void *io_value) override
 broadcast value from root to all other processes. More...
 
void bcastSend (int i_groupOne, const type_info &i_type, size_t i_size, void *io_valueArr) override
 send broadcast value array from root to all other processes. More...
 
void bcastReceive (int i_groupOne, const type_info &i_type, size_t i_size, void *io_valueArr) override
 receive broadcasted value array from root process. More...
 
void bcastSendPacked (int i_groupOne, IRowBaseVec &io_rowVec, const IPackedAdapter &i_adapter) override
 send broadcast vector of db rows from root to all other processes. More...
 
void bcastReceivePacked (int i_groupOne, IRowBaseVec &io_rowVec, const IPackedAdapter &i_adapter) override
 receive broadcasted vector of db rows from root. More...
 
void startSend (int i_sendTo, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *i_valueArr) override
 start non-blocking send of value array to i_sendTo process. More...
 
void startSendPacked (int i_sendTo, const IRowBaseVec &i_rowVec, const IPackedAdapter &i_adapter) override
 pack and start non-blocking send of vector of db rows to i_sendTo process. More...
 
bool tryReceive (int i_recvFrom, IRowBaseVec &io_resultRowVec, const IPackedAdapter &i_adapter) const override
 try to non-blocking receive and unpack vector of db rows, return true if completed. More...
 
bool tryReceive (int i_recvFrom, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *io_valueArr) const override
 try to non-blocking receive value array, return true if completed. More...
 
void waitSendAll (void) override
 wait for non-blocking send to be completed. More...
 
- Public Member Functions inherited from openm::IMsgExec
virtual ~IMsgExec (void) noexcept=0
 cleanup message passing resources.
 
bool isRoot (void) const
 if root process then true (root process rank == 0)
 
virtual int worldSize (void) const =0
 return total number of processes in world communicator. More...
 
virtual int rank (void) const =0
 return current process rank. More...
 
virtual int groupRank (void) const =0
 return rank in modeling group. More...
 
virtual void setCleanExit (bool i_isClean=false)=0
 set clean exit flag for normal shutdown of message passing interface. More...
 
virtual void createGroups (int i_groupSize, int i_groupCount)=0
 create groups for parallel run of modeling task. More...
 
virtual void bcastValue (int i_groupOne, const type_info &i_type, void *io_value)=0
 broadcast value from root to all other processes. More...
 
void bcastInt (int i_groupOne, void *io_value)
 broadcast integer value from root to all other processes. More...
 
virtual void bcastSend (int i_groupOne, const type_info &i_type, size_t i_size, void *io_valueArr)=0
 send broadcast value array from root to all other processes. More...
 
virtual void bcastReceive (int i_groupOne, const type_info &i_type, size_t i_size, void *io_valueArr)=0
 receive broadcasted value array from root process. More...
 
virtual void bcastSendPacked (int i_groupOne, IRowBaseVec &io_rowVec, const IPackedAdapter &i_adapter)=0
 send broadcast vector of db rows from root to all other processes. More...
 
virtual void bcastReceivePacked (int i_groupOne, IRowBaseVec &io_rowVec, const IPackedAdapter &i_adapter)=0
 receive broadcasted vector of db rows from root. More...
 
virtual void startSend (int i_sendTo, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *i_valueArr)=0
 start non-blocking send of value array to i_sendTo process. More...
 
virtual void startSendPacked (int i_sendTo, const IRowBaseVec &i_rowVec, const IPackedAdapter &i_adapter)=0
 pack and start non-blocking send of vector of db rows to i_sendTo process. More...
 
virtual bool tryReceive (int i_recvFrom, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *io_valueArr) const =0
 try to non-blocking receive value array, return true if completed. More...
 
virtual bool tryReceive (int i_recvFrom, IRowBaseVec &io_resultRowVec, const IPackedAdapter &i_adapter) const =0
 try to non-blocking receive and unpack vector of db rows, return true if completed. More...
 
virtual void waitSendAll (void)=0
 wait for non-blocking send to be completed More...
 
- Public Member Functions inherited from openm::MsgExecBase
virtual ~MsgExecBase (void) noexcept
 cleanup message passing resources.
 
int worldSize (void) const
 return total number of processes in MPI world communicator.
 
int rank (void) const
 return current process rank.
 
int groupRank (void) const
 return rank in modeling group.
 
void startSend (int i_sendTo, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *i_valueArr)
 start non-blocking send of value array to i_sendTo process. More...
 
void startSendPacked (int i_sendTo, const IRowBaseVec &i_rowVec, const IPackedAdapter &i_adapter)
 pack and start non-blocking send of vector of db rows to i_sendTo process. More...
 
bool tryReceive (int i_recvFrom, MsgTag i_msgTag, const type_info &i_type, size_t i_size, void *io_valueArr) const
 try to non-blocking receive value array, return return true if completed. More...
 
bool tryReceive (int i_recvFrom, IRowBaseVec &io_resultRowVec, const IPackedAdapter &i_adapter) const
 try to non-blocking receive and unpack vector of db rows, return return true if completed. More...
 
void waitSendAll (void)
 wait for non-blocking send to be completed.
 

Additional Inherited Members

- Static Public Member Functions inherited from openm::IMsgExec
static IMsgExeccreate (int argc, char **argv, IFinalState *i_final)
 create new message passing interface. More...
 
- Static Public Attributes inherited from openm::IMsgExec
static const int rootRank = 0
 root process rank, always zero
 
- Protected Member Functions inherited from openm::MsgExecBase
 MsgExecBase (IFinalState *i_final)
 
- Protected Attributes inherited from openm::MsgExecBase
int worldCommSize
 
int worldRank
 
int group_rank
 
IFinalStatetheFinal = nullptr
 
list< unique_ptr< IMsgSend > > sendLst
 

Detailed Description

message passing library main class for MPI-based implementation

Constructor & Destructor Documentation

◆ MpiExec()

MpiExec::MpiExec ( int &  argc,
char **&  argv,
IFinalState i_final 
)

create message passing interface by MPI_Init.

Parameters
[in,out]argcmain argc to pass to MPI_Init
[in,out]argvmain argv to pass to MPI_Init
[in]IFinalStatefinal model run state interface

Member Function Documentation

◆ bcastReceive()

void MpiExec::bcastReceive ( int  i_groupOne,
const type_info &  i_type,
size_t  i_size,
void *  io_valueArr 
)
overridevirtual

receive broadcasted value array from root process.

Parameters
[in]i_groupOneif zero then worldwide else one-based group number
[in]i_typevalue type
[in]i_sizesize of array (row count)
[in,out]io_valueArrvalue array to send or output buffer to receive

Implements openm::IMsgExec.

◆ bcastReceivePacked()

void MpiExec::bcastReceivePacked ( int  i_groupOne,
IRowBaseVec io_rowVec,
const IPackedAdapter i_adapter 
)
overridevirtual

receive broadcasted vector of db rows from root.

Parameters
[in]i_groupOneif zero then worldwide else one-based group number
[in,out]io_rowVecvector of db rows to send or vector to push back received db rows
[in]i_adapteradapter to pack and unpack db rows

Implements openm::IMsgExec.

◆ bcastSend()

void MpiExec::bcastSend ( int  i_groupOne,
const type_info &  i_type,
size_t  i_size,
void *  io_valueArr 
)
overridevirtual

send broadcast value array from root to all other processes.

Parameters
[in]i_groupOneif zero then worldwide else one-based group number
[in]i_typevalue type
[in]i_sizesize of array (row count)
[in,out]io_valueArrvalue array to send or output buffer to receive

Implements openm::IMsgExec.

◆ bcastSendPacked()

void MpiExec::bcastSendPacked ( int  i_groupOne,
IRowBaseVec io_rowVec,
const IPackedAdapter i_adapter 
)
overridevirtual

send broadcast vector of db rows from root to all other processes.

Parameters
[in]i_groupOneif zero then worldwide else one-based group number
[in,out]io_rowVecvector of db rows to send or vector to push back received db rows
[in]i_adapteradapter to pack and unpack db rows

Implements openm::IMsgExec.

◆ bcastValue()

void MpiExec::bcastValue ( int  i_groupOne,
const type_info &  i_type,
void *  io_value 
)
overridevirtual

broadcast value from root to all other processes.

Parameters
[in]i_groupOneif zero then worldwide else one-based group number
[in]i_typevalue type
[in,out]io_valuevalue to send or output value to receive

Implements openm::IMsgExec.

◆ createGroups()

void MpiExec::createGroups ( int  i_groupSize,
int  i_groupCount 
)
overridevirtual

create groups for parallel run of modeling task.

Implements openm::IMsgExec.

◆ groupRank()

int openm::MpiExec::groupRank ( void  ) const
inlineoverridevirtualnoexcept

return rank in modeling group.

Implements openm::IMsgExec.

◆ rank()

int openm::MpiExec::rank ( void  ) const
inlineoverridevirtualnoexcept

return current process MPI rank.

Implements openm::IMsgExec.

◆ setCleanExit()

void MpiExec::setCleanExit ( bool  i_isClean = false)
overridevirtual

set clean exit flag for normal shutdown messaging else abort MPI.

Implements openm::IMsgExec.

◆ startSend()

void openm::MpiExec::startSend ( int  i_sendTo,
MsgTag  i_msgTag,
const type_info &  i_type,
size_t  i_size,
void *  i_valueArr 
)
inlineoverridevirtual

start non-blocking send of value array to i_sendTo process.

Implements openm::IMsgExec.

◆ startSendPacked()

void openm::MpiExec::startSendPacked ( int  i_sendTo,
const IRowBaseVec i_rowVec,
const IPackedAdapter i_adapter 
)
inlineoverridevirtual

pack and start non-blocking send of vector of db rows to i_sendTo process.

Implements openm::IMsgExec.

◆ tryReceive() [1/2]

bool openm::MpiExec::tryReceive ( int  i_recvFrom,
IRowBaseVec io_resultRowVec,
const IPackedAdapter i_adapter 
) const
inlineoverridevirtual

try to non-blocking receive and unpack vector of db rows, return true if completed.

Implements openm::IMsgExec.

◆ tryReceive() [2/2]

bool openm::MpiExec::tryReceive ( int  i_recvFrom,
MsgTag  i_msgTag,
const type_info &  i_type,
size_t  i_size,
void *  io_valueArr 
) const
inlineoverridevirtual

try to non-blocking receive value array, return true if completed.

Implements openm::IMsgExec.

◆ waitSendAll()

void openm::MpiExec::waitSendAll ( void  )
inlineoverridevirtual

wait for non-blocking send to be completed.

Implements openm::IMsgExec.

◆ worldSize()

int openm::MpiExec::worldSize ( void  ) const
inlineoverridevirtualnoexcept

return total number of processes in MPI world communicator.

Implements openm::IMsgExec.


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