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

#include <Communicate.h>

Inheritance diagram for Communicate:
Collaboration diagram for Communicate:

Classes

struct  MessageData

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

 Communicate (int argc=0, char **argv=NULL, int procs=(-1))
virtual ~Communicate (void)
virtual const char * name () const
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 bool raw_send (void *, int, int, int)
virtual MPI_Request raw_isend (void *, int, int, int)
virtual int raw_receive (char *, int, int &, int &)
virtual MPI_Request raw_ireceive (char *, int, int, int)
virtual int raw_probe_receive (char *&, int &, int &)
virtual int broadcast_all (Message *, int)
virtual int broadcast_others (Message *, int, bool delmsg=true)
void barrier (void)
virtual void cleanupMessage (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

bool add_msg (Message *, int, int)
Messagefind_msg (int &, int &)
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)
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

TagInfocreate_base_tag (int t, int s=1000)

Private Attributes

std::map< int, TagInfo, TagCompareTagList

Detailed Description

Definition at line 112 of file Communicate.h.

Member Typedef Documentation

◆ MsgNum_t

typedef long Communicate::MsgNum_t
protected

Definition at line 269 of file Communicate.h.

◆ SentCache_t

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

Definition at line 275 of file Communicate.h.

Member Enumeration Documentation

◆ CommCodes

Enumerator
COMM_ANY_NODE 
COMM_ANY_TAG 

Definition at line 125 of file Communicate.h.

◆ CommErrors

Enumerator
COMM_NOERROR 
COMM_ERROR 
COMM_NOSEND 
COMM_NORECEIVE 

Definition at line 117 of file Communicate.h.

◆ CommTags

Enumerator
COMM_HOSTS_TAG 
COMM_DIE_TAG 
COMM_SEND_TAG 

Definition at line 120 of file Communicate.h.

Constructor & Destructor Documentation

◆ Communicate()

Communicate::Communicate ( int argc = 0,
char ** argv = NULL,
int procs = (-1) )

Definition at line 69 of file Communicate.cpp.

References COMM_NOERROR, Contexts, ErrorStatus, myHost, nextMsgNum, Processes, and TotalNodes.

Referenced by CommMPI::CommMPI().

◆ ~Communicate()

Communicate::~Communicate ( void )
virtual

Definition at line 84 of file Communicate.cpp.

References sentMsgCache.

Member Function Documentation

◆ add_msg()

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

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 )
protected

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 )
inlinestaticprotected

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 )

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 )
virtual

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 )
virtual

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 Communicate::cleanupMessage ( void * )
virtual

Reimplemented in CommMPI.

Definition at line 451 of file Communicate.cpp.

◆ clear_ok_messages()

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

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 )
protected

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 )
protected

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)
protected

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)
inlinestaticprotected

Definition at line 343 of file Communicate.h.

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

◆ getContexts()

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

Definition at line 147 of file Communicate.h.

References Contexts.

◆ getError()

int Communicate::getError ( ) const
inline

Definition at line 159 of file Communicate.h.

References ErrorStatus.

◆ getNodes()

int Communicate::getNodes ( ) const
inline

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
inline

Definition at line 151 of file Communicate.h.

References c, and Processes.

◆ getReceived()

int Communicate::getReceived ( ) const
inline

Definition at line 163 of file Communicate.h.

References recMsgList.

◆ makebuffer()

void * Communicate::makebuffer ( int size)
inlinestaticprotected

Definition at line 339 of file Communicate.h.

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

◆ mybarrier()

void Communicate::mybarrier ( void )
protectedvirtual

Reimplemented in CommMPI.

Definition at line 158 of file Communicate.cpp.

Referenced by barrier().

◆ myNode()

int Communicate::myNode ( ) const
inline

◆ myreceive()

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

Reimplemented in CommMPI.

Definition at line 148 of file Communicate.cpp.

Referenced by receive(), and receive_block().

◆ mysend()

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

Reimplemented in CommMPI.

Definition at line 138 of file Communicate.cpp.

Referenced by broadcast_all(), broadcast_others(), and send().

◆ name()

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

Reimplemented in CommMPI.

Definition at line 137 of file Communicate.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 )
inlinestaticprotected

Definition at line 364 of file Communicate.h.

References addwordround().

Referenced by fill_msg_buffer().

Here is the call graph for this function:

◆ perform_resend()

void Communicate::perform_resend ( MsgNum_t mnum)
protected

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 ( )
protected

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()

virtual MPI_Request Communicate::raw_ireceive ( char * ,
int ,
int ,
int  )
inlinevirtual

Reimplemented in CommMPI.

Definition at line 204 of file Communicate.h.

◆ raw_isend()

virtual MPI_Request Communicate::raw_isend ( void * ,
int ,
int ,
int  )
inlinevirtual

Reimplemented in CommMPI.

Definition at line 196 of file Communicate.h.

◆ raw_probe_receive()

virtual int Communicate::raw_probe_receive ( char *& ,
int & ,
int &  )
inlinevirtual

Reimplemented in CommMPI.

Definition at line 208 of file Communicate.h.

◆ raw_receive()

virtual int Communicate::raw_receive ( char * ,
int ,
int & ,
int &  )
inlinevirtual

Reimplemented in CommMPI.

Definition at line 200 of file Communicate.h.

◆ raw_send()

virtual bool Communicate::raw_send ( void * ,
int ,
int ,
int  )
inlinevirtual

Reimplemented in CommMPI.

Definition at line 192 of file Communicate.h.

◆ receive()

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

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 )

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)
protected

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 )
protected

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 Communicate::resend ( void * buf,
int size,
int node,
int etag )
protectedvirtual

Reimplemented in CommMPI.

Definition at line 170 of file Communicate.cpp.

Referenced by perform_resend().

◆ 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 )

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 )
protected

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 )
inlinestaticprotected

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 )
protected

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 )
protected

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)
inlinestaticprotected

Definition at line 350 of file Communicate.h.

Referenced by addwordround(), and find_msg_length().

Member Data Documentation

◆ Contexts

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

Definition at line 264 of file Communicate.h.

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

◆ ErrorStatus

int Communicate::ErrorStatus
protected

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
protected

Definition at line 285 of file Communicate.h.

Referenced by process_resend_requests(), and unpack_message().

◆ myHost

int Communicate::myHost
protected

Definition at line 262 of file Communicate.h.

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

◆ nextMsgNum

MsgNum_t Communicate::nextMsgNum
protected

Definition at line 270 of file Communicate.h.

Referenced by Communicate(), and fill_msg_buffer().

◆ Processes

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

Definition at line 265 of file Communicate.h.

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

◆ recMsgList

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

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
protected

Definition at line 288 of file Communicate.h.

Referenced by process_resend_requests(), and unpack_message().

◆ resendList

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

Definition at line 279 of file Communicate.h.

Referenced by process_resend_requests(), and unpack_retransmission_request().

◆ sentMsgCache

SentCache_t Communicate::sentMsgCache
protected

◆ sentOKList

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

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
protected

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