OPAL (Object Oriented Parallel Accelerator Library)  2.2.0
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,
CommSendInfo
SentCache_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

typedef long Communicate::MsgNum_t
protected

Definition at line 269 of file Communicate.h.

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

Definition at line 275 of file Communicate.h.

Member Enumeration Documentation

Enumerator
COMM_ANY_NODE 
COMM_ANY_TAG 

Definition at line 125 of file Communicate.h.

Enumerator
COMM_NOERROR 
COMM_ERROR 
COMM_NOSEND 
COMM_NORECEIVE 

Definition at line 117 of file Communicate.h.

Enumerator
COMM_HOSTS_TAG 
COMM_DIE_TAG 
COMM_SEND_TAG 

Definition at line 120 of file Communicate.h.

Constructor & Destructor Documentation

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

Definition at line 70 of file Communicate.cpp.

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

Communicate::~Communicate ( void  )
virtual

Definition at line 85 of file Communicate.cpp.

References sentMsgCache.

Member Function Documentation

bool Communicate::add_msg ( Message msg,
int  node,
int  tag 
)
protected
void Communicate::add_to_send_cache ( void *  pos,
MsgNum_t  mnum,
int  size,
int  node 
)
protected

Definition at line 689 of file Communicate.cpp.

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

Referenced by fill_msg_buffer().

Here is the call graph for this function:

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:

void Communicate::barrier ( void  )
int Communicate::broadcast_all ( Message msg,
int  tag 
)
virtual
int Communicate::broadcast_others ( Message msg,
int  tag,
bool  delmsg = true 
)
virtual
void Communicate::cleanupMessage ( void *  )
virtual

Reimplemented in CommSHMEMPI, CommMPI, and CommPM.

Definition at line 452 of file Communicate.cpp.

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

Definition at line 802 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:

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

Definition at line 111 of file Communicate.cpp.

References COMM_ANY_NODE, COMM_ANY_TAG, and recMsgList.

Referenced by receive(), and receive_block().

int Communicate::find_msg_length ( Message msg)
protected

Definition at line 457 of file Communicate.cpp.

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

Referenced by CommPM::mysend(), CommSHMEMPI::pack_message(), and CommMPI::pack_message().

Here is the call graph for this function:

static void Communicate::freebuffer ( void *  buf)
inlinestaticprotected
int Communicate::getContexts ( const int  n) const
inline

Definition at line 147 of file Communicate.h.

References Contexts, and Hypervolume::n.

Referenced by IpplInfo::getContexts().

int Communicate::getError ( ) const
inline

Definition at line 159 of file Communicate.h.

References ErrorStatus.

int Communicate::getNodes ( ) const
inline
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.

Referenced by IpplInfo::getProcesses().

int Communicate::getReceived ( ) const
inline

Definition at line 163 of file Communicate.h.

References recMsgList.

Referenced by operator<<().

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

Reimplemented in CommMPI, CommSHMEMPI, and CommPM.

Definition at line 159 of file Communicate.cpp.

Referenced by barrier().

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

Reimplemented in CommMPI, CommSHMEMPI, and CommPM.

Definition at line 149 of file Communicate.cpp.

Referenced by receive(), and receive_block().

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

Reimplemented in CommMPI, CommSHMEMPI, and CommPM.

Definition at line 139 of file Communicate.cpp.

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

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

Reimplemented in CommSHMEMPI, CommMPI, and CommPM.

Definition at line 137 of file Communicate.h.

Referenced by operator<<().

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:

void Communicate::perform_resend ( MsgNum_t  mnum)
protected

Definition at line 765 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:

void Communicate::process_resend_requests ( )
protected

Definition at line 866 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:

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

Reimplemented in CommMPI.

Definition at line 204 of file Communicate.h.

virtual MPI_Request Communicate::raw_isend ( void *  ,
int  ,
int  ,
int   
)
inlinevirtual
virtual int Communicate::raw_probe_receive ( char *&  ,
int &  ,
int &   
)
inlinevirtual
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().

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

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

Definition at line 241 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:

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

Definition at line 301 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(), BoundaryGeometry::createParticlesOnSurface(), BoundaryGeometry::createPriPart(), DiscField< Dim >::distribute_offsets(), FieldLayout< Dim >::FieldLayout(), BareField< T, Dim >::fillGuardCells(), IpplInfo::find_smp_nodes(), FieldDataSource< T, Dim, M, C >::gather_data(), BareField< T, Dim >::getsingle(), BareField< T, Dim >::getsingle_bc(), IndexedReceive(), pap(), DiscConfig::parse_config(), FieldPrint< T, Dim >::print(), FieldDebugPrint< T, Dim >::print(), FieldBlock< T, Dim, Mesh, Centering >::read(), DiscField< Dim >::read(), FieldLayout< Dim >::read(), DiscParticle::read_meta(), DiscField< Dim >::read_meta(), ParticleSpatialLayout< T, Dim, Mesh >::rebuild_layout(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::rebuild_neighbor_data(), H5PartWrapper::receiveFailureMessage(), ConejoBalancer::receiveVnodeDomains(), ConejoBalancer::receiveVnodesToSend(), ConejoBalancer::receiveWeights(), ParticleLayoutFromGrid::redistribute_particles(), reduce(), reduce_masked(), IpplParticleBase< PLayout >::resetID(), LossDataSink::saveASCII(), scatter(), ParticleSpatialLayout< T, Dim, Mesh >::short_swap_particles(), ParallelCyclotronTracker::singleParticleDump(), spap(), ParticleCashedLayout< T, Dim, Mesh >::swap_ghost_particles(), ParticleInteractLayout< T, Dim, Mesh >::swap_ghost_particles(), ParticleSpatialLayout< T, Dim, Mesh >::swap_particles(), ParticleUniformLayout< T, Dim >::update(), ParticleCashedLayout< T, Dim, Mesh >::update(), ParticleInteractLayout< T, Dim, Mesh >::update(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::update(), FieldView< T, Dim, Mesh, Centering >::update_2D_data(), FieldView< T, Dim, Mesh, Centering >::update_3D_data(), VnodeMultiRepartition(), FieldBlock< T, Dim, Mesh, Centering >::write(), BareField< T, Dim >::write(), and DiscParticle::write().

Here is the call graph for this function:

void Communicate::remove_single_ok_message ( MsgNum_t  mnum)
protected

Definition at line 840 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:

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

Definition at line 721 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:

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

Reimplemented in CommMPI.

Definition at line 171 of file Communicate.cpp.

Referenced by perform_resend().

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

Definition at line 182 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 BareField< T, Dim >::accumGuardCells(), ParallelPeriodicFace< T, D, M, C >::apply(), ParallelInterpolationFace< T, D, M, C >::apply(), assign(), ConejoBalancer::broadcastVnodesToSend(), DiscField< Dim >::distribute_offsets(), BareField< T, Dim >::fillGuardCells(), IpplInfo::find_smp_nodes(), FieldDataSource< T, Dim, M, C >::gather_data(), IndexedSend(), pap(), DiscConfig::parse_config(), FieldPrint< T, Dim >::print(), FieldDebugPrint< T, Dim >::print(), FieldBlock< T, Dim, Mesh, Centering >::read(), DiscField< Dim >::read(), DiscParticle::read_meta(), DiscField< Dim >::read_meta(), ParticleSpatialLayout< T, Dim, Mesh >::rebuild_layout(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::rebuild_neighbor_data(), ParticleLayoutFromGrid::redistribute_particles(), reduce(), reduce_masked(), request_retransmission(), IpplParticleBase< PLayout >::resetID(), LossDataSink::saveASCII(), scatter(), send_ok_message(), ConejoBalancer::sendVnodeDomains(), ConejoBalancer::sendWeights(), ParticleSpatialLayout< T, Dim, Mesh >::short_swap_particles(), spap(), ParticleCashedLayout< T, Dim, Mesh >::swap_ghost_particles(), ParticleInteractLayout< T, Dim, Mesh >::swap_ghost_particles(), ParticleSpatialLayout< T, Dim, Mesh >::swap_particles(), ParticleUniformLayout< T, Dim >::update(), ParticleCashedLayout< T, Dim, Mesh >::update(), ParticleInteractLayout< T, Dim, Mesh >::update(), ParticleSpatialLayout< T, Dim, Mesh, CachingPolicy >::update(), FieldView< T, Dim, Mesh, Centering >::update_2D_data(), FieldView< T, Dim, Mesh, Centering >::update_3D_data(), VnodeMultiRepartition(), FieldBlock< T, Dim, Mesh, Centering >::write(), BareField< T, Dim >::write(), DiscParticle::write(), and DiscField< Dim >::write().

Here is the call graph for this function:

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

Definition at line 786 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:

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:

Message * Communicate::unpack_message ( int &  node,
int &  tag,
void *  pos 
)
protected
void Communicate::unpack_retransmission_request ( int  nitems,
void *  pos 
)
protected

Definition at line 739 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:

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

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

Definition at line 263 of file Communicate.h.

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

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

int Communicate::myHost
protected
MsgNum_t Communicate::nextMsgNum
protected

Definition at line 270 of file Communicate.h.

Referenced by fill_msg_buffer().

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

Definition at line 258 of file Communicate.h.

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

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

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

Definition at line 279 of file Communicate.h.

Referenced by process_resend_requests(), and unpack_retransmission_request().

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

Definition at line 282 of file Communicate.h.

Referenced by clear_ok_messages(), and process_resend_requests().

int Communicate::TotalNodes
protected

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