OPAL (Object Oriented Parallel Accelerator Library) 2024.2
OPAL
CommMPI Class Reference

#include <CommMPI.h>

Inheritance diagram for CommMPI:
Collaboration diagram for CommMPI:

Public Types

enum  CommErrors { COMM_NOERROR , COMM_ERROR , COMM_NOSEND , COMM_NORECEIVE }
enum  CommTags { COMM_HOSTS_TAG = 32000 , COMM_DIE_TAG , COMM_SEND_TAG }
enum  CommCodes { COMM_ANY_NODE = (-1) , COMM_ANY_TAG = (-1) }

Public Member Functions

 CommMPI (int &argc, char **&argv, int procs=(-1), bool mpiinit=true, MPI_Comm mpicomm=MPI_COMM_WORLD)
virtual ~CommMPI (void)
virtual const char * name () const
virtual void cleanupMessage (void *)
virtual bool raw_send (void *, int size, int node, int tag)
virtual MPI_Request raw_isend (void *, int size, int node, int tag)
virtual MPI_Request raw_ireceive (char *buf, int size, int node, int tag)
virtual int raw_receive (char *, int size, int &node, int &tag)
virtual int raw_probe_receive (char *&, int &node, int &tag)
int getNodes () const
int getContexts (const int n) const
int getProcesses (const int n, const int c) const
int myNode () const
int getError () const
int getReceived () const
bool send (Message *, int node, int tag, bool delmsg=true)
Messagereceive (int &node, int &tag)
Messagereceive_block (int &node, int &tag)
virtual int broadcast_all (Message *, int)
virtual int broadcast_others (Message *, int, bool delmsg=true)
void barrier (void)
int next_tag (int t, int s=1000)
int current_tag (int t, int s=1000)
int reset_tag (int t, int s=1000)

Protected Types

typedef long MsgNum_t
typedef std::map< MsgNum_t, CommSendInfoSentCache_t

Protected Member Functions

virtual bool mysend (Message *, int node, int utag, int etag)
virtual Messagemyreceive (int &node, int &tag, int etag)
virtual void mybarrier (void)
virtual bool resend (void *buf, int size, int node, int etag)
bool add_msg (Message *, int, int)
Messagefind_msg (int &, int &)
int find_msg_length (Message &)
void fill_msg_buffer (void *, Message &, int, int, int)
Messageunpack_message (int &node, int &tag, void *pos)
void add_to_send_cache (void *pos, MsgNum_t mnum, int size, int node)
void request_retransmission (int node, MsgNum_t mnum)
void perform_resend (MsgNum_t mnum)
void unpack_retransmission_request (int nitems, void *pos)
void send_ok_message (int node, MsgNum_t mnum)
void clear_ok_messages (int nitems, void *pos)
void remove_single_ok_message (MsgNum_t mnum)
void process_resend_requests ()

Static Protected Member Functions

static void * makebuffer (int size)
static void freebuffer (void *buf)
static unsigned int wordround (int size)
static void addwordround (void *&pos, int size)
static void pack (void *packdata, void *&pos, int size)
static void unpack (void *&pos, void *packdata, int size)

Protected Attributes

std::vector< MessageDatarecMsgList
int TotalNodes
int myHost
int ErrorStatus
std::vector< int > Contexts
std::vector< std::vector< int > > Processes
MsgNum_t nextMsgNum
SentCache_t sentMsgCache
std::vector< MsgNum_tresendList
std::vector< MsgNum_tsentOKList
std::vector< std::pair< int, MsgNum_t > > informOKList
std::vector< std::pair< int, MsgNum_t > > requestList

Private Member Functions

void * pack_message (Message *msg, int tag, int &buffsize, int node)
TagInfocreate_base_tag (int t, int s=1000)

Private Attributes

MPI_Comm communicator
bool weInitialized
std::map< int, TagInfo, TagCompareTagList

Detailed Description

Definition at line 28 of file CommMPI.h.

Member Typedef Documentation

◆ MsgNum_t

typedef long Communicate::MsgNum_t
protectedinherited

Definition at line 269 of file Communicate.h.

◆ SentCache_t

typedef std::map<MsgNum_t, CommSendInfo> Communicate::SentCache_t
protectedinherited

Definition at line 275 of file Communicate.h.

Member Enumeration Documentation

◆ CommCodes

enum Communicate::CommCodes
inherited
Enumerator
COMM_ANY_NODE 
COMM_ANY_TAG 

Definition at line 125 of file Communicate.h.

◆ CommErrors

enum Communicate::CommErrors
inherited
Enumerator
COMM_NOERROR 
COMM_ERROR 
COMM_NOSEND 
COMM_NORECEIVE 

Definition at line 117 of file Communicate.h.

◆ CommTags

enum Communicate::CommTags
inherited
Enumerator
COMM_HOSTS_TAG 
COMM_DIE_TAG 
COMM_SEND_TAG 

Definition at line 120 of file Communicate.h.

Constructor & Destructor Documentation

◆ CommMPI()

CommMPI::CommMPI ( int & argc,
char **& argv,
int procs = (-1),
bool mpiinit = true,
MPI_Comm mpicomm = MPI_COMM_WORLD )

Definition at line 67 of file CommMPI.cpp.

References IpplInfo::abort(), Communicate::COMM_HOSTS_TAG, Communicate::Communicate(), communicator, Communicate::Contexts, endl(), ERRORMSG, INFOMSG, level5(), Communicate::myHost, Communicate::Processes, Communicate::TotalNodes, WARNMSG, and weInitialized.

Here is the call graph for this function:

◆ ~CommMPI()

CommMPI::~CommMPI ( void )
virtual

Definition at line 215 of file CommMPI.cpp.

References Communicate::COMM_ANY_NODE, Communicate::COMM_ANY_TAG, Communicate::COMM_DIE_TAG, Communicate::COMM_SEND_TAG, communicator, endl(), IPPL_ABORT_TAG, IPPL_EXIT_TAG, Communicate::myNode(), myreceive(), Communicate::TotalNodes, WARNMSG, and weInitialized.

Here is the call graph for this function:

Member Function Documentation

◆ add_msg()

bool Communicate::add_msg ( Message * msg,
int node,
int tag )
protectedinherited

Definition at line 97 of file Communicate.cpp.

References recMsgList.

Referenced by broadcast_all(), CommMPI::mysend(), receive(), receive_block(), and send().

◆ add_to_send_cache()

void Communicate::add_to_send_cache ( void * pos,
MsgNum_t mnum,
int size,
int node )
protectedinherited

Definition at line 688 of file Communicate.cpp.

References endl(), ERRORMSG, and sentMsgCache.

Referenced by fill_msg_buffer().

Here is the call graph for this function:

◆ addwordround()

void Communicate::addwordround ( void *& pos,
int size )
inlinestaticprotectedinherited

Definition at line 358 of file Communicate.h.

References wordround().

Referenced by clear_ok_messages(), pack(), unpack(), unpack_message(), and unpack_retransmission_request().

Here is the call graph for this function:

◆ barrier()

void Communicate::barrier ( void )
inherited

Definition at line 439 of file Communicate.cpp.

References mybarrier().

Here is the call graph for this function:

◆ broadcast_all()

int Communicate::broadcast_all ( Message * msg,
int tag )
virtualinherited

Definition at line 384 of file Communicate.cpp.

References add_msg(), COMM_SEND_TAG, getNodes(), myNode(), and mysend().

Here is the call graph for this function:

◆ broadcast_others()

int Communicate::broadcast_others ( Message * msg,
int tag,
bool delmsg = true )
virtualinherited

Definition at line 413 of file Communicate.cpp.

References COMM_SEND_TAG, getNodes(), myNode(), and mysend().

Referenced by reduce(), and reduce_masked().

Here is the call graph for this function:

◆ cleanupMessage()

void CommMPI::cleanupMessage ( void * d)
virtual

Reimplemented from Communicate.

Definition at line 544 of file CommMPI.cpp.

References Communicate::freebuffer().

Referenced by myreceive(), and mysend().

Here is the call graph for this function:

◆ clear_ok_messages()

void Communicate::clear_ok_messages ( int nitems,
void * pos )
protectedinherited

Definition at line 801 of file Communicate.cpp.

References addwordround(), endl(), INFORM_ALL_NODES, PInsist, and sentOKList.

Referenced by unpack_message().

Here is the call graph for this function:

◆ create_base_tag()

TagInfo & TagMaker::create_base_tag ( int t,
int s = 1000 )
inlineprivateinherited

◆ current_tag()

int TagMaker::current_tag ( int t,
int s = 1000 )
inlineinherited

Definition at line 48 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, and DEF_CYCLE_SIZE.

Here is the call graph for this function:

◆ fill_msg_buffer()

void Communicate::fill_msg_buffer ( void * buffer,
Message & msg,
int tag,
int bufsize,
int node )
protectedinherited

Definition at line 483 of file Communicate.cpp.

References add_to_send_cache(), ADDIPPLSTAT, crc(), Message::MsgItem::data(), IPPL_MSG_OK_TAG, IPPL_RETRANSMIT_TAG, Message::item(), myNode(), nextMsgNum, Message::MsgItem::numBytes(), Message::MsgItem::numElems(), pack(), IpplInfo::retransmit(), Message::size(), and IpplInfo::useChecksums().

Referenced by CommMPI::pack_message().

Here is the call graph for this function:

◆ find_msg()

Message * Communicate::find_msg ( int & node,
int & tag )
protectedinherited

Definition at line 110 of file Communicate.cpp.

References COMM_ANY_NODE, COMM_ANY_TAG, and recMsgList.

Referenced by receive(), and receive_block().

◆ find_msg_length()

int Communicate::find_msg_length ( Message & msg)
protectedinherited

Definition at line 456 of file Communicate.cpp.

References Message::item(), Message::MsgItem::numBytes(), Message::size(), IpplInfo::useChecksums(), and wordround().

Referenced by CommMPI::pack_message().

Here is the call graph for this function:

◆ freebuffer()

void Communicate::freebuffer ( void * buf)
inlinestaticprotectedinherited

Definition at line 343 of file Communicate.h.

Referenced by CommMPI::cleanupMessage(), and CommMPI::mysend().

◆ getContexts()

int Communicate::getContexts ( const int n) const
inlineinherited

Definition at line 147 of file Communicate.h.

References Contexts.

◆ getError()

int Communicate::getError ( ) const
inlineinherited

Definition at line 159 of file Communicate.h.

References ErrorStatus.

◆ getNodes()

int Communicate::getNodes ( ) const
inlineinherited

Definition at line 143 of file Communicate.h.

References TotalNodes.

Referenced by broadcast_all(), broadcast_others(), reduce(), reduce_masked(), scatter(), and send().

◆ getProcesses()

int Communicate::getProcesses ( const int n,
const int c ) const
inlineinherited

Definition at line 151 of file Communicate.h.

References c, and Processes.

◆ getReceived()

int Communicate::getReceived ( ) const
inlineinherited

Definition at line 163 of file Communicate.h.

References recMsgList.

◆ makebuffer()

void * Communicate::makebuffer ( int size)
inlinestaticprotectedinherited

Definition at line 339 of file Communicate.h.

Referenced by CommMPI::myreceive(), CommMPI::mysend(), and CommMPI::pack_message().

◆ mybarrier()

void CommMPI::mybarrier ( void )
protectedvirtual

Reimplemented from Communicate.

Definition at line 502 of file CommMPI.cpp.

References communicator.

◆ myNode()

int Communicate::myNode ( ) const
inlineinherited

◆ myreceive()

Message * CommMPI::myreceive ( int & node,
int & tag,
int etag )
protectedvirtual

Reimplemented from Communicate.

Definition at line 413 of file CommMPI.cpp.

References IpplInfo::abort(), cleanupMessage(), communicator, endl(), ERRORMSG, Communicate::makebuffer(), MAX_MPI_ERRS, Communicate::TotalNodes, Communicate::unpack_message(), and Message::useCommunicate().

Referenced by ~CommMPI().

Here is the call graph for this function:

◆ mysend()

bool CommMPI::mysend ( Message * msg,
int node,
int utag,
int etag )
protectedvirtual

Reimplemented from Communicate.

Definition at line 311 of file CommMPI.cpp.

References Communicate::add_msg(), cleanupMessage(), communicator, Communicate::freebuffer(), IpplMessageCounter::getInstance(), Communicate::makebuffer(), pack_message(), PACKSIZE, IpplMessageCounter::registerMessage(), IpplInfo::retransmit(), Communicate::unpack_message(), and Message::useCommunicate().

Here is the call graph for this function:

◆ name()

virtual const char * CommMPI::name ( ) const
inlinevirtual

Reimplemented from Communicate.

Definition at line 41 of file CommMPI.h.

◆ next_tag()

int TagMaker::next_tag ( int t,
int s = 1000 )
inlineinherited

Definition at line 39 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, TagMaker::TagInfo::cycleSize, and DEF_CYCLE_SIZE.

Referenced by reduce(), reduce_masked(), and scatter().

Here is the call graph for this function:

◆ pack()

void Communicate::pack ( void * packdata,
void *& pos,
int size )
inlinestaticprotectedinherited

Definition at line 364 of file Communicate.h.

References addwordround().

Referenced by fill_msg_buffer().

Here is the call graph for this function:

◆ pack_message()

void * CommMPI::pack_message ( Message * msg,
int tag,
int & buffsize,
int node )
private

Definition at line 289 of file CommMPI.cpp.

References Communicate::fill_msg_buffer(), Communicate::find_msg_length(), Communicate::makebuffer(), and PACKSIZE.

Referenced by mysend().

Here is the call graph for this function:

◆ perform_resend()

void Communicate::perform_resend ( MsgNum_t mnum)
protectedinherited

Definition at line 764 of file Communicate.cpp.

References COMM_SEND_TAG, endl(), ERRORMSG, myNode(), PInsist, resend(), and sentMsgCache.

Referenced by process_resend_requests().

Here is the call graph for this function:

◆ process_resend_requests()

void Communicate::process_resend_requests ( )
protectedinherited

Definition at line 865 of file Communicate.cpp.

References endl(), INFORM_ALL_NODES, informOKList, perform_resend(), remove_single_ok_message(), request_retransmission(), requestList, resendList, send_ok_message(), and sentOKList.

Referenced by receive(), and receive_block().

Here is the call graph for this function:

◆ raw_ireceive()

MPI_Request CommMPI::raw_ireceive ( char * buf,
int size,
int node,
int tag )
virtual

Reimplemented from Communicate.

Definition at line 586 of file CommMPI.cpp.

References Communicate::COMM_ANY_NODE, Communicate::COMM_ANY_TAG, and communicator.

◆ raw_isend()

MPI_Request CommMPI::raw_isend ( void * data,
int size,
int node,
int tag )
virtual

Reimplemented from Communicate.

Definition at line 559 of file CommMPI.cpp.

References communicator, IpplMessageCounter::getInstance(), and IpplMessageCounter::registerMessage().

Here is the call graph for this function:

◆ raw_probe_receive()

int CommMPI::raw_probe_receive ( char *& data,
int & node,
int & tag )
virtual

Reimplemented from Communicate.

Definition at line 599 of file CommMPI.cpp.

References Communicate::COMM_ANY_NODE, Communicate::COMM_ANY_TAG, and communicator.

◆ raw_receive()

int CommMPI::raw_receive ( char * data,
int size,
int & node,
int & tag )
virtual

Reimplemented from Communicate.

Definition at line 569 of file CommMPI.cpp.

References Communicate::COMM_ANY_NODE, Communicate::COMM_ANY_TAG, and communicator.

◆ raw_send()

bool CommMPI::raw_send ( void * data,
int size,
int node,
int tag )
virtual

Reimplemented from Communicate.

Definition at line 551 of file CommMPI.cpp.

References communicator, IpplMessageCounter::getInstance(), and IpplMessageCounter::registerMessage().

Here is the call graph for this function:

◆ receive()

Message * Communicate::receive ( int & node,
int & tag )
inherited

Definition at line 240 of file Communicate.cpp.

References add_msg(), COMM_ANY_NODE, COMM_ANY_TAG, COMM_NOERROR, COMM_NORECEIVE, COMM_SEND_TAG, ErrorStatus, find_msg(), myNode(), myreceive(), and process_resend_requests().

Here is the call graph for this function:

◆ receive_block()

Message * Communicate::receive_block ( int & node,
int & tag )
inherited

Definition at line 300 of file Communicate.cpp.

References add_msg(), COMM_ANY_NODE, COMM_ANY_TAG, COMM_NOERROR, COMM_NORECEIVE, COMM_SEND_TAG, ErrorStatus, find_msg(), myNode(), myreceive(), PInsist, process_resend_requests(), and IpplInfo::retransmit().

Referenced by reduce(), reduce_masked(), and scatter().

Here is the call graph for this function:

◆ remove_single_ok_message()

void Communicate::remove_single_ok_message ( MsgNum_t mnum)
protectedinherited

Definition at line 839 of file Communicate.cpp.

References endl(), ERRORMSG, INFORM_ALL_NODES, and sentMsgCache.

Referenced by process_resend_requests().

Here is the call graph for this function:

◆ request_retransmission()

void Communicate::request_retransmission ( int node,
MsgNum_t mnum )
protectedinherited

Definition at line 720 of file Communicate.cpp.

References endl(), INFORM_ALL_NODES, IPPL_RETRANSMIT_TAG, Message::put(), and send().

Referenced by process_resend_requests().

Here is the call graph for this function:

◆ resend()

bool CommMPI::resend ( void * buf,
int size,
int node,
int etag )
protectedvirtual

Reimplemented from Communicate.

Definition at line 511 of file CommMPI.cpp.

References communicator, IpplMessageCounter::getInstance(), Communicate::myNode(), PInsist, and IpplMessageCounter::registerMessage().

Here is the call graph for this function:

◆ reset_tag()

int TagMaker::reset_tag ( int t,
int s = 1000 )
inlineinherited

Definition at line 56 of file TagMaker.h.

References TagMaker::TagInfo::base, create_base_tag(), TagMaker::TagInfo::current, and DEF_CYCLE_SIZE.

Here is the call graph for this function:

◆ send()

bool Communicate::send ( Message * msg,
int node,
int tag,
bool delmsg = true )
inherited

Definition at line 181 of file Communicate.cpp.

References add_msg(), COMM_ERROR, COMM_NOERROR, COMM_NOSEND, COMM_SEND_TAG, endl(), ERRORMSG, ErrorStatus, getNodes(), myNode(), and mysend().

Referenced by reduce(), reduce_masked(), request_retransmission(), scatter(), and send_ok_message().

Here is the call graph for this function:

◆ send_ok_message()

void Communicate::send_ok_message ( int node,
MsgNum_t mnum )
protectedinherited

Definition at line 785 of file Communicate.cpp.

References endl(), INFORM_ALL_NODES, IPPL_MSG_OK_TAG, Message::put(), and send().

Referenced by process_resend_requests().

Here is the call graph for this function:

◆ unpack()

void Communicate::unpack ( void *& pos,
void * packdata,
int size )
inlinestaticprotectedinherited

Definition at line 371 of file Communicate.h.

References addwordround().

Here is the call graph for this function:

◆ unpack_message()

Message * Communicate::unpack_message ( int & node,
int & tag,
void * pos )
protectedinherited

Definition at line 555 of file Communicate.cpp.

References ADDIPPLSTAT, addwordround(), clear_ok_messages(), crc(), endl(), ERRORMSG, informOKList, IPPL_ABORT_TAG, IPPL_EXIT_TAG, IPPL_MSG_OK_TAG, IPPL_RETRANSMIT_TAG, IpplInfo::myNode(), PInsist, Message::putmsg(), requestList, IpplInfo::retransmit(), Message::setCopy(), Message::setDelete(), unpack_retransmission_request(), and IpplInfo::useChecksums().

Referenced by CommMPI::myreceive(), and CommMPI::mysend().

Here is the call graph for this function:

◆ unpack_retransmission_request()

void Communicate::unpack_retransmission_request ( int nitems,
void * pos )
protectedinherited

Definition at line 738 of file Communicate.cpp.

References addwordround(), endl(), INFORM_ALL_NODES, PInsist, and resendList.

Referenced by unpack_message().

Here is the call graph for this function:

◆ wordround()

unsigned int Communicate::wordround ( int size)
inlinestaticprotectedinherited

Definition at line 350 of file Communicate.h.

Referenced by addwordround(), and find_msg_length().

Member Data Documentation

◆ communicator

MPI_Comm CommMPI::communicator
private

◆ Contexts

std::vector<int> Communicate::Contexts
protectedinherited

Definition at line 264 of file Communicate.h.

Referenced by CommMPI::CommMPI(), Communicate(), and getContexts().

◆ ErrorStatus

int Communicate::ErrorStatus
protectedinherited

Definition at line 263 of file Communicate.h.

Referenced by Communicate(), getError(), receive(), receive_block(), and send().

◆ informOKList

std::vector<std::pair<int,MsgNum_t> > Communicate::informOKList
protectedinherited

Definition at line 285 of file Communicate.h.

Referenced by process_resend_requests(), and unpack_message().

◆ myHost

int Communicate::myHost
protectedinherited

Definition at line 262 of file Communicate.h.

Referenced by CommMPI::CommMPI(), Communicate(), and myNode().

◆ nextMsgNum

MsgNum_t Communicate::nextMsgNum
protectedinherited

Definition at line 270 of file Communicate.h.

Referenced by Communicate(), and fill_msg_buffer().

◆ Processes

std::vector< std::vector<int> > Communicate::Processes
protectedinherited

Definition at line 265 of file Communicate.h.

Referenced by CommMPI::CommMPI(), Communicate(), and getProcesses().

◆ recMsgList

std::vector<MessageData> Communicate::recMsgList
protectedinherited

Definition at line 258 of file Communicate.h.

Referenced by add_msg(), find_msg(), and getReceived().

◆ requestList

std::vector<std::pair<int,MsgNum_t> > Communicate::requestList
protectedinherited

Definition at line 288 of file Communicate.h.

Referenced by process_resend_requests(), and unpack_message().

◆ resendList

std::vector<MsgNum_t> Communicate::resendList
protectedinherited

Definition at line 279 of file Communicate.h.

Referenced by process_resend_requests(), and unpack_retransmission_request().

◆ sentMsgCache

SentCache_t Communicate::sentMsgCache
protectedinherited

◆ sentOKList

std::vector<MsgNum_t> Communicate::sentOKList
protectedinherited

Definition at line 282 of file Communicate.h.

Referenced by clear_ok_messages(), and process_resend_requests().

◆ TagList

std::map<int, TagInfo, TagCompare> TagMaker::TagList
privateinherited

Definition at line 87 of file TagMaker.h.

Referenced by create_base_tag().

◆ TotalNodes

int Communicate::TotalNodes
protectedinherited

◆ weInitialized

bool CommMPI::weInitialized
private

Definition at line 99 of file CommMPI.h.

Referenced by CommMPI(), and ~CommMPI().


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