IC_EndPoint.h

Go to the documentation of this file.
00001 
00008 /* Henrique Andrade - March 2003
00009    University of Maryland, College Park
00010 
00011    Class Description:
00012   
00013    This is an abstract class for a MetaChaos endpoint. It implements the
00014    abstract methods described in the EndPoint class.*/
00015 
00016 #ifndef IC_ENDPOINT_H
00017 #define IC_ENDPOINT_H
00018 
00019 #include "EndPoint.h"
00020 #include <stdio.h>
00021 
00022 #ifdef PPLUSPLUS
00023 #include <A++.h>
00024 #endif
00025 
00026 #ifdef FORTRAN90
00027 #include "carray_descriptor.h"
00028 #endif
00029 
00033 class IC_EndPoint : public EndPoint {
00034   public:
00035 
00036   /* the declarations below must be in sync with
00037      ../FortranInterface/intercomm_interface.h*/
00038 
00040     enum {
00041       IC_TAG          = 1,
00042       IC_ROW_MAJOR    = 0,
00043       IC_COLUMN_MAJOR = 1,
00044       IC_OK                         =   0,
00045       IC_GENERIC_ERROR              =  -1,
00046       IC_INVALID_NDIM               =  -2,
00047       IC_CANT_ALLOC_REGION          =  -3,
00048       IC_CANT_GET_DA_DESCRIPTOR     =  -4,
00049       IC_CANT_COMPUTE_COMM_SCHEDULE =  -5,
00050       IC_COMM_FAILURE               =  -6,
00051       IC_INVALID_ENDPOINT_NAME      =  -7,
00052       IC_INITIALIZATION_FAILURE     =  -8,
00053       IC_CANT_CONNECT_TO_REMOTE     =  -9,
00054       IC_PVM_ERROR                  = -10,
00055       IC_MPI_ERROR                  = -11,
00056       IC_POINTER_TABLE_ERROR        = -12,
00057     };
00058     static const char * const IC_errors[];
00059 
00069     /* to create a communication endpoint, one needs to name it (the format is
00070        "thisprogram'sname::otherprogram'sname"), define how many processors
00071        this program uses, as well as the other program, and define the array
00072        order used for this program as well as the other program*/
00073     IC_EndPoint(const char* endpointName, 
00074                 const unsigned mynproc, const unsigned onproc, 
00075                 const unsigned myao, const unsigned oao, 
00076                 int& status);
00077 
00078     unsigned get_myprog_arrayorder(void);
00079     unsigned get_otherprog_arrayorder(void);   
00080     IC_Program* get_myprog(void);
00081     IC_Program* get_otherprog(void);   
00082 
00083     static void printErrorMessage(const char* msg, const int ic_err);
00084 
00091     virtual ~IC_EndPoint();
00092         
00093 #ifdef PPLUSPLUS
00094   public:  
00095     /*Methods for High-Level API*/
00096     /* - compute schedule for each import/export*/
00097     virtual void exportArray(const intArray&, int, int&);
00098     virtual void importArray(const intArray&, int, int&);
00099     virtual void bcastLocalArray(const intArray&, int, int, int&);
00100     virtual void recvLocalArray(const intArray&, int, int, int&);
00101     virtual void exportArray(const floatArray&, int, int&);
00102     virtual void importArray(const floatArray&, int, int&);
00103     virtual void bcastLocalArray(const floatArray&, int, int, int&);
00104     virtual void recvLocalArray(const floatArray&, int, int, int&);
00105     virtual void exportArray(const doubleArray&, int, int&);
00106     virtual void importArray(const doubleArray&, int, int&);
00107     virtual void bcastLocalArray(const doubleArray&, int, int, int&);
00108     virtual void recvLocalArray(const doubleArray&, int, int, int&);
00109 #endif
00110 
00111         
00112 #ifdef FORTRAN90
00113   public:
00114     /* Methods for High-Level API*/
00115     virtual void exportArray(const F90_charArray&, int, int&);
00116     virtual void importArray(const F90_charArray&, int, int&);
00117     virtual void bcastLocalArray(const F90_charArray&, int, int, int&);
00118     virtual void recvLocalArray(const F90_charArray&, int, int, int&);
00119     virtual void exportArray(const F90_shortArray&, int, int&);
00120     virtual void importArray(const F90_shortArray&, int, int&);
00121     virtual void bcastLocalArray(const F90_shortArray&, int, int, int&);
00122     virtual void recvLocalArray(const F90_shortArray&, int, int, int&);
00123     virtual void exportArray(const F90_intArray&, int, int&);
00124     virtual void importArray(const F90_intArray&, int, int&);
00125     virtual void bcastLocalArray(const F90_intArray&, int, int, int&);
00126     virtual void recvLocalArray(const F90_intArray&, int, int, int&);
00127     virtual void exportArray(const F90_floatArray&, int, int&);
00128     virtual void importArray(const F90_floatArray&, int, int&);
00129     virtual void bcastLocalArray(const F90_floatArray&, int, int, int&);
00130     virtual void recvLocalArray(const F90_floatArray&, int, int, int&);
00131     virtual void exportArray(const F90_doubleArray&, int, int&);
00132     virtual void importArray(const F90_doubleArray&, int, int&);
00133     virtual void bcastLocalArray(const F90_doubleArray&, int, int, int&);
00134     virtual void recvLocalArray(const F90_doubleArray&, int, int, int&);
00135     
00136     static IC_Desc* buildDescriptor(const F90_charArray& a);
00137     static IC_Desc* buildDescriptor(const F90_shortArray& a);
00138     static IC_Desc* buildDescriptor(const F90_intArray& a);
00139     static IC_Desc* buildDescriptor(const F90_floatArray& a);
00140     static IC_Desc* buildDescriptor(const F90_doubleArray& a);
00141 #endif
00142 
00143   protected:
00144   
00145     /* information needed by InterComm to carry out the communication
00146        pointers to the data structures describing the local and remote
00147        communication endpoints*/
00148     IC_Program *otherProgram;
00149     unsigned thisProgramAO, otherProgramAO;
00150     /* static stuff*/
00151     static IC_Program *thisProgram;
00152     static unsigned nendpoints;
00153 
00154 };
00155 
00156 #endif
00157 
00158 

Generated on Mon Jun 4 14:42:40 2007 for InterComm by  doxygen 1.4.6