OPAL (Object Oriented Parallel Accelerator Library) 2022.1
OPAL
Classes | Public Types | Public Member Functions | Protected Types | Protected Member Functions | Static Protected Member Functions | Protected Attributes | List of all members
Communicate Class Reference

#include <Communicate.h>

Inheritance diagram for Communicate:
Inheritance graph
[legend]
Collaboration diagram for Communicate:
Collaboration graph
[legend]

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 *)
 
- Public Member Functions inherited from TagMaker
 TagMaker (void)
 
virtual ~TagMaker (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
 

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, Processes, and TotalNodes.

◆ ~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, sentMsgCache, and value_type().

Referenced by fill_msg_buffer().

Here is the call graph for this function:

◆ addwordround()

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

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

Referenced by BcastCuts(), and H5PartWrapper::sendFailureMessage().

Here is the call graph for this function:

◆ broadcast_others()

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

◆ cleanupMessage()

void Communicate::cleanupMessage ( void *  )
virtual

Reimplemented in CommMPI.

Definition at line 451 of file Communicate.cpp.

Referenced by Message::~Message().

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

◆ fill_msg_buffer()

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

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

static 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, and Hypervolume::n.

◆ getError()

int Communicate::getError ( ) const
inline

Definition at line 159 of file Communicate.h.

References ErrorStatus.

◆ getNodes()

int Communicate::getNodes ( ) const
inline

◆ getProcesses()

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

Definition at line 151 of file Communicate.h.

References Physics::c, Hypervolume::n, and Processes.

◆ getReceived()

int Communicate::getReceived ( ) const
inline

Definition at line 163 of file Communicate.h.

References recMsgList.

◆ makebuffer()

static void * Communicate::makebuffer ( int  size)
inlinestaticprotected

Definition at line 339 of file Communicate.h.

Referenced by 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.

Referenced by operator<<().

◆ pack()

static 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

◆ raw_probe_receive()

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

◆ raw_receive()

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

Reimplemented in CommMPI.

Definition at line 200 of file Communicate.h.

Referenced by Distribution::writeOutFileEmission().

◆ raw_send()

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

Reimplemented in CommMPI.

Definition at line 192 of file Communicate.h.

Referenced by Distribution::writeOutFileEmission().

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

Referenced by DiscField< Dim >::write().

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 BareField< T, Dim >::accumGuardCells(), ParallelPeriodicFace< T, D, M, C >::apply(), ParallelInterpolationFace< T, D, M, C >::apply(), assign(), DiscField< Dim >::distribute_offsets(), FieldLayout< Dim >::FieldLayout(), FieldDataSource< T, Dim, M, C >::gather_data(), BareField< T, Dim >::getsingle(), BareField< T, Dim >::getsingle_bc(), IndexedReceive(), pap(), DiscConfig::parse_config(), FieldDebugPrint< T, Dim >::print(), FieldPrint< T, Dim >::print(), FieldLayout< Dim >::read(), DiscField< Dim >::read(), DiscField< Dim >::read_meta(), DiscParticle::read_meta(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::rebuild_layout(), H5PartWrapper::receiveFailureMessage(), reduce(), reduce_masked(), IpplParticleBase< PLayout >::resetID(), LossDataSink::saveASCII(), scatter(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::short_swap_particles(), ParallelCyclotronTracker::singleParticleDump(), spap(), ParticleCashedLayout< T, Dim, Mesh >::swap_ghost_particles(), ParticleInteractLayout< T, Dim, Mesh >::swap_ghost_particles(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::swap_particles(), ParticleCashedLayout< T, Dim, Mesh >::update(), ParticleInteractLayout< T, Dim, Mesh >::update(), ParticleUniformLayout< T, Dim >::update(), and DiscParticle::write().

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

◆ send()

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

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

static 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

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

static 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 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 fill_msg_buffer().

◆ Processes

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

Definition at line 265 of file Communicate.h.

Referenced by 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().

◆ TotalNodes

int Communicate::TotalNodes
protected

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