sc::MessageGrp Class Reference

The MessageGrp abstract class provides a mechanism for moving data and objects between nodes in a parallel machine. More...

#include <util/group/message.h>

Inheritance diagram for sc::MessageGrp:

Inheritance graph
[legend]

List of all members.

Public Types

enum  { AnyType = -1 }
enum  { AnySender = -1 }

Public Member Functions

 MessageGrp (const Ref< KeyVal > &)
int n ()
 Returns the number of processors.
int me ()
 Returns my processor number. In the range [0,n()).
virtual Ref< MessageGrpclone (void)=0
 Returns a copy of this MessageGrp specialization that provides an independent communication context.
virtual void wait (const MessageHandle &handle, MessageInfo *info=0)=0
 Wait for an operation to complete.
virtual int probet (int sender, int type, MessageInfo *info=0)=0
 Ask if a given typed message has been received.
virtual void sync ()
 Synchronize all of the processors.
Ref< MachineTopology > topology ()
 Return the MachineTopology object.
Send Members
Parameters:
target the recipent node number.
data the data.
ndata the number of data.


virtual void send (int target, const double *data, int ndata)
virtual void send (int target, const unsigned int *data, int ndata)
virtual void send (int target, const int *data, int ndata)
virtual void send (int target, const char *data, int nbyte)
virtual void send (int target, const unsigned char *data, int nbyte)
virtual void send (int target, const signed char *data, int nbyte)
virtual void send (int target, const short *data, int ndata)
virtual void send (int target, const long *data, int ndata)
virtual void send (int target, const float *data, int ndata)
void send (int target, double data)
 This sends a single double datum.
void send (int target, int data)
 This sends a single integer datum.
virtual void raw_send (int target, const void *data, int nbyte)=0
Send Members for Typed Messages
Parameters:
target the recipent node number.
type the user-chosen type which is used to match the receive.
data the data.
ndata the number of data.


virtual void sendt (int target, int type, const double *data, int ndata, bool rcvrdy=false)
virtual void sendt (int target, int type, const unsigned int *data, int ndata, bool rcvrdy=false)
virtual void sendt (int target, int type, const int *data, int ndata, bool rcvrdy=false)
virtual void sendt (int target, int type, const char *data, int nbyte, bool rcvrdy=false)
virtual void sendt (int target, int type, const unsigned char *data, int nbyte, bool rcvrdy=false)
virtual void sendt (int target, int type, const signed char *data, int nbyte, bool rcvrdy=false)
virtual void sendt (int target, int type, const short *data, int ndata, bool rcvrdy=false)
virtual void sendt (int target, int type, const long *data, int ndata, bool rcvrdy=false)
virtual void sendt (int target, int type, const float *data, int ndata, bool rcvrdy=false)
void sendt (int target, int type, double data, bool rcvrdy=false)
 This sends a single double datum.
void sendt (int target, int type, int data, bool rcvrdy=false)
 This sends a single integer datum.
virtual void raw_sendt (int target, int type, const void *data, int nbyte, bool rcvrdy=false)=0
Receive Members
Parameters:
sender the sending node number (if -1, any sender will match).
data the data.
ndata the number of data.


virtual void recv (int sender, double *data, int ndata)
virtual void recv (int sender, unsigned int *data, int ndata)
virtual void recv (int sender, int *data, int ndata)
virtual void recv (int sender, char *data, int nbyte)
virtual void recv (int sender, unsigned char *data, int nbyte)
virtual void recv (int sender, signed char *data, int nbyte)
virtual void recv (int sender, short *data, int ndata)
virtual void recv (int sender, long *data, int ndata)
virtual void recv (int sender, float *data, int ndata)
void recv (int sender, double &data)
 This receives a single double datum.
void recv (int sender, int &data)
 This receives a single integer datum.
virtual void raw_recv (int sender, void *data, int nbyte, MessageInfo *info=0)=0
Receive Members for Typed Messages
Parameters:
sender the sending node number (if -1, any sender will match).
type the user-chosen type which is used to match the send.
data the data.
ndata the number of data.


virtual void recvt (int sender, int type, double *data, int ndata)
virtual void recvt (int sender, int type, unsigned int *data, int ndata)
virtual void recvt (int sender, int type, int *data, int ndata)
virtual void recvt (int sender, int type, char *data, int nbyte)
virtual void recvt (int sender, int type, unsigned char *data, int nbyte)
virtual void recvt (int sender, int type, signed char *data, int nbyte)
virtual void recvt (int sender, int type, short *data, int ndata)
virtual void recvt (int sender, int type, long *data, int ndata)
virtual void recvt (int sender, int type, float *data, int ndata)
void recvt (int sender, int type, double &data)
 This receives a single double datum.
void recvt (int sender, int type, int &data)
 This receives a single integer datum.
virtual void raw_recvt (int sender, int type, void *data, int nbyte, MessageInfo *info=0)=0
Non-blocking Send Members
These send routines are nonblocking.

The operation is not complete and the data buffer cannot be reused until a wait completes on the handle.

Parameters:
target the recipent node number.
type the user-chosen type which is used to match the receive.
data the data.
ndata the number of data.
handle set to the handle which must be used with wait to check for completion.
rcvrdy if true, the receive is guaranteed to have been issued. The default is false.
See also:
wait


virtual void nb_sendt (int target, int type, const double *data, int ndata, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const unsigned int *data, int ndata, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const int *data, int ndata, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const char *data, int nbyte, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const unsigned char *data, int nbyte, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const signed char *data, int nbyte, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const short *data, int ndata, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const long *data, int ndata, MessageHandle &handle, bool rcvrdy=false)
virtual void nb_sendt (int target, int type, const float *data, int ndata, MessageHandle &handle, bool rcvrdy=false)
void nb_sendt (int target, int type, double data, MessageHandle &handle, bool rcvrdy=false)
void nb_sendt (int target, int type, int data, MessageHandle &handle, bool rcvrdy=false)
virtual void raw_nb_sendt (int target, int type, const void *data, int nbyte, MessageHandle &, bool rcvrdy=false)=0
Non-blocking Receive Members
These receive routines are nonblocking.

The operation is not complete and the data buffer cannot be used until a wait completes on the handle.

Parameters:
sender the sending node number (if -1, any sender will match).
type the user-chosen type which is used to match the send.
data the data.
ndata the number of data.
handle set to the handle which must be used with wait to check for completion.
See also:
wait


virtual void nb_recvt (int sender, int type, double *data, int ndata, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, unsigned int *data, int ndata, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, int *data, int ndata, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, char *data, int nbyte, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, unsigned char *data, int nbyte, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, signed char *data, int nbyte, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, short *data, int ndata, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, long *data, int ndata, MessageHandle &handle)
virtual void nb_recvt (int sender, int type, float *data, int ndata, MessageHandle &handle)
void nb_recvt (int sender, int type, double &data, MessageHandle &handle)
 This receives a single double datum.
void nb_recvt (int sender, int type, int &data, MessageHandle &handle)
 This receives a single integer datum.
virtual void raw_nb_recvt (int sender, int type, void *data, int nbyte, MessageHandle &)=0
Broadcast Members
Do broadcasts of various types of data.

virtual void bcast (double *data, int ndata, int from=0)
virtual void bcast (unsigned int *data, int ndata, int from=0)
virtual void bcast (int *data, int ndata, int from=0)
virtual void bcast (char *data, int nbyte, int from=0)
virtual void bcast (unsigned char *data, int nbyte, int from=0)
virtual void bcast (signed char *data, int nbyte, int from=0)
virtual void bcast (short *data, int ndata, int from=0)
virtual void bcast (long *data, int ndata, int from=0)
virtual void bcast (float *data, int ndata, int from=0)
virtual void raw_bcast (void *data, int nbyte, int from=0)
void bcast (double &data, int from=0)
void bcast (int &data, int from=0)
Data Collection Members
Collect data distributed on the nodes to a big array replicated on each node.

virtual void raw_collect (const void *part, const int *lengths, void *whole, int bytes_per_datum=1)
void collect (const double *part, const int *lengths, double *whole)
Global Sum Reduction Members
virtual void sum (double *data, int n, double *=0, int target=-1)
virtual void sum (unsigned int *data, int n, unsigned int *=0, int target=-1)
virtual void sum (int *data, int n, int *=0, int target=-1)
virtual void sum (long *data, int n, long *=0, int target=-1)
virtual void sum (char *data, int n, char *=0, int target=-1)
virtual void sum (unsigned char *data, int n, unsigned char *=0, int target=-1)
virtual void sum (signed char *data, int n, signed char *=0, int target=-1)
void sum (double &data)
void sum (int &data)
Global Maximization Members
virtual void max (double *data, int n, double *=0, int target=-1)
virtual void max (int *data, int n, int *=0, int target=-1)
virtual void max (unsigned int *data, int n, unsigned int *=0, int target=-1)
virtual void max (char *data, int n, char *=0, int target=-1)
virtual void max (unsigned char *data, int n, unsigned char *=0, int target=-1)
virtual void max (signed char *data, int n, signed char *=0, int target=-1)
void max (double &data)
void max (int &data)
Global Minimization Members
virtual void min (double *data, int n, double *=0, int target=-1)
virtual void min (int *data, int n, int *=0, int target=-1)
virtual void min (unsigned int *data, int n, unsigned int *=0, int target=-1)
virtual void min (char *data, int n, char *=0, int target=-1)
virtual void min (unsigned char *data, int n, unsigned char *=0, int target=-1)
virtual void min (signed char *data, int n, signed char *=0, int target=-1)
void min (double &data)
void min (int &data)
Global Generic Reduction Members.
virtual void reduce (double *, int n, GrpReduce< double > &, double *scratch=0, int target=-1)
virtual void reduce (int *, int n, GrpReduce< int > &, int *scratch=0, int target=-1)
virtual void reduce (unsigned int *, int n, GrpReduce< unsigned int > &, unsigned int *scratch=0, int target=-1)
virtual void reduce (char *, int n, GrpReduce< char > &, char *scratch=0, int target=-1)
virtual void reduce (unsigned char *, int n, GrpReduce< unsigned char > &, unsigned char *scratch=0, int target=-1)
virtual void reduce (signed char *, int n, GrpReduce< signed char > &, signed char *scratch=0, int target=-1)
virtual void reduce (short *, int n, GrpReduce< short > &, short *scratch=0, int target=-1)
virtual void reduce (float *, int n, GrpReduce< float > &, float *scratch=0, int target=-1)
virtual void reduce (long *, int n, GrpReduce< long > &, long *scratch=0, int target=-1)
void reduce (double &data, GrpReduce< double > &r)
void reduce (int &data, GrpReduce< int > &r)
Global Class Information Members
Each message group maintains an association of ClassDesc with a global index so SavableState information can be sent between nodes without needing to send the classname and look up the ClassDesc with each transfer.

These routines return information about that mapping.

int classdesc_to_index (const ClassDesc *)
const ClassDescindex_to_classdesc (int)
int nclass () const

Static Public Member Functions

static void set_default_messagegrp (const Ref< MessageGrp > &)
 The default message group contains the primary message group to be used by an application.
static MessageGrpget_default_messagegrp ()
 Returns the default message group.
static MessageGrpinitial_messagegrp (int &argc, char **&argv)
 Create a message group.

Protected Member Functions

void initialize (int me, int n)
 The classdesc_to_index_ and index_to_classdesc_ arrays cannot be initialized by the MessageGrp CTOR, because the MessageGrp specialization has not yet been initialized and communication is not available.
void set_sender (MessageInfo *info, int sender)
void set_type (MessageInfo *info, int type)
void set_nbyte (MessageInfo *info, int nbyte)
void set_id (MessageHandle *handle, void *id)
void * get_id (const MessageHandle *handle)

Protected Attributes

Ref< MachineTopology > topology_
int debug_

Classes

class  MessageHandle
class  MessageInfo


Detailed Description

The MessageGrp abstract class provides a mechanism for moving data and objects between nodes in a parallel machine.


Member Function Documentation

void sc::MessageGrp::initialize ( int  me,
int  n 
) [protected]

The classdesc_to_index_ and index_to_classdesc_ arrays cannot be initialized by the MessageGrp CTOR, because the MessageGrp specialization has not yet been initialized and communication is not available.

CTOR's of specializations of MessageGrp must call the initialize member in their body to complete the initialization process.

virtual Ref<MessageGrp> sc::MessageGrp::clone ( void   )  [pure virtual]

Returns a copy of this MessageGrp specialization that provides an independent communication context.

Implemented in sc::ProcMessageGrp, and sc::MPIMessageGrp.

static void sc::MessageGrp::set_default_messagegrp ( const Ref< MessageGrp > &   )  [static]

The default message group contains the primary message group to be used by an application.

static MessageGrp* sc::MessageGrp::initial_messagegrp ( int &  argc,
char **&  argv 
) [static]

Create a message group.

This routine looks for a -messagegrp argument, then the environmental variable MESSAGEGRP to decide which specialization of MessageGrp would be appropriate. The argument to -messagegrp should be either string for a ParsedKeyVal constructor or a classname. If this returns null, it is up to the programmer to create a MessageGrp.

virtual void sc::MessageGrp::wait ( const MessageHandle &  handle,
MessageInfo *  info = 0 
) [pure virtual]

Wait for an operation to complete.

Parameters:
handle the handle initialized by, for example, nb_recvt.
info if non-null, this will be filled in with information about the operation that completed.

Implemented in sc::ProcMessageGrp, and sc::MPIMessageGrp.


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

Generated at Sun Feb 22 10:13:04 2009 for MPQC 3.0.0-alpha using the documentation package Doxygen 1.5.6.
These pages are hosted on SourceForge.net