src/Message/CommSHMEMPI.h

Go to the documentation of this file.
00001 // -*- C++ -*-
00002 /***************************************************************************
00003  *
00004  * The IPPL Framework
00005  * 
00006  *
00007  * Visit http://people.web.psi.ch/adelmann/ for more details
00008  *
00009  ***************************************************************************/
00010 
00011 #ifndef COMM_SHMEMPI_H
00012 #define COMM_SHMEMPI_H
00013 
00014 /***************************************************************************
00015  * CommSHMEMPI.h - MPI-specific communications object for use with the
00016  * Ippl framework.  This differs from CommMPI in that it will, for on-box
00017  * communication on symmetric multiprocessors, use SHMEM instead of MPI
00018  * for greater efficiency.  It is basically "MPI + SHMEM on-box".  John
00019  * Hall is the person to praise or blame for the name SHMEMPI.
00020  *
00021  * Allows user to establish id's for available nodes, establish connections,
00022  * and send/receive data.
00023  *
00024  ***************************************************************************/
00025 
00026 // include files
00027 #include "Message/Communicate.h"
00028 
00029 
00030 class CommSHMEMPI : public Communicate {
00031 
00032 public:
00033   // constructor and destructor
00034   // constructor arguments: command-line args, and number of processes
00035   // to start (if < 0, start the 'default' number ... for MPI, this value
00036   // will be ignored, since the number of nodes is determined by the args
00037   // to mpirun.
00038   CommSHMEMPI(int& argc, char**& argv, int procs = (-1));
00039   virtual ~CommSHMEMPI(void);
00040 
00041   // return the name of this item
00042   virtual const char *name() const { return "SHMEMPI"; }
00043 
00044   //
00045   //    virtual routines to deal with memory management
00046   //
00047 
00048   // clean up after a Message has been used (called by Message).
00049   virtual void cleanupMessage(void *);
00050 
00051 protected:
00052 
00053   //
00054   // implementation-specific routines (which begin with 'my')
00055   //    these should be provided in a derived class, and contain the
00056   //    comm-library-specific code
00057   //
00058 
00059   // send a message ... arguments are the Message itself, the
00060   // destination node, the 'user' tag, and the 'encoding' tag.
00061   // Messages should be sent via the underlying mechanism by using the
00062   // encoding tag (one of the COMM_ tags),
00063   // and should embed the information about what the user
00064   // tag is in the data sent between nodes.  Return success.
00065   virtual bool mysend(Message *, int node, int utag, int etag);
00066 
00067   // receive a message from the given node and user tag.  Return a NEW
00068   // Message object if a message arrives, or NULL if no message available.
00069   // node will be set to the node from which the message was sent.
00070   // tag will be set to the 'user tag' for that message.
00071   // etag is the 'encoding' tag, and must be one of the COMM_ tags. 
00072   // Only message sent via the underlying mechanism with the
00073   // given etag are checked.  When one is found, the user tag and sending
00074   // node are extracted from the sent data.
00075   // If node = COMM_ANY_NODE, checks for messages from any node.
00076   // If tag = COMM_ANY_TAG, checks for messages with any user tag.
00077   virtual Message *myreceive(int& node, int& tag, int etag);
00078 
00079   // Synchronize all processors (everybody waits for everybody
00080   // else to get here before returning to calling function).
00081   virtual void mybarrier(void);
00082 
00083 private:
00084   // take data from the given Message, and pack it into the current send buf
00085   void *pack_message(Message *msg, int tag, int &buffsize);
00086 };
00087 
00088 
00089 #endif // COMM_SHMEMPI_H
00090 
00091 /***************************************************************************
00092  * $RCSfile: CommSHMEMPI.h,v $   $Author: adelmann $
00093  * $Revision: 1.1.1.1 $   $Date: 2003/01/23 07:40:28 $
00094  * IPPL_VERSION_ID: $Id: CommSHMEMPI.h,v 1.1.1.1 2003/01/23 07:40:28 adelmann Exp $ 
00095  ***************************************************************************/

Generated on Mon Jan 16 13:23:51 2006 for IPPL by  doxygen 1.4.6