00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023 #include <typeinfo>
00024
00025 #include <mpi.h>
00026
00027
00028 #ifndef CLUSTER_HH
00029 #define CLUSTER_HH
00030
00031
00035 class clMPIProc
00036 {
00037 bool bInitialized;
00038 int iError;
00039 public:
00040 clMPIProc ();
00041 ~clMPIProc ();
00049 bool Initialize (int *, char ***);
00055 bool Finalize ();
00062 bool GetRank (int *);
00069 bool GetNodeCount (int *);
00075 int GetError () { return iError; }
00076 };
00077
00078
00082 class clMPIComm
00083 {
00084 int iTag;
00085 int iError;
00086 MPI_Status sStatus;
00087 public:
00088 clMPIComm ();
00089 clMPIComm (int);
00090 ~clMPIComm ();
00096 void SetTag (int);
00105 bool Send (int, char *, int);
00107 bool Send (int, unsigned char *, int);
00109 bool Send (int, short *, int);
00111 bool Send (int, unsigned short *, int);
00113 bool Send (int, int *, int);
00115 bool Send (int, unsigned int *, int);
00117 bool Send (int, long *, int);
00119 bool Send (int, unsigned long *, int);
00121 bool Send (int, float *, int);
00123 bool Send (int, double *, int);
00125 bool Send (int, long double *, int);
00127 bool Send (int, void *, int);
00136 bool Probe (int);
00138 bool ProbeAny (int);
00140 bool ProbeNB (int);
00142 bool ProbeAnyNB (int);
00151 bool Recv (int, char *, int);
00153 bool Recv (int, unsigned char *, int);
00155 bool Recv (int, short *, int);
00157 bool Recv (int, unsigned short *, int);
00159 bool Recv (int, int *, int);
00161 bool Recv (int, unsigned int *, int);
00163 bool Recv (int, long *, int);
00165 bool Recv (int, unsigned long *, int);
00167 bool Recv (int, float *, int);
00169 bool Recv (int, double *, int);
00171 bool Recv (int, long double *, int);
00173 bool Recv (int, void *, int);
00181 bool RecvAny (int, char *, int);
00183 bool RecvAny (int, unsigned char *, int);
00185 bool RecvAny (int, short *, int);
00187 bool RecvAny (int, unsigned short *, int);
00189 bool RecvAny (int, int *, int);
00191 bool RecvAny (int, unsigned int *, int);
00193 bool RecvAny (int, long *, int);
00195 bool RecvAny (int, unsigned long *, int);
00197 bool RecvAny (int, float *, int);
00199 bool RecvAny (int, double *, int);
00201 bool RecvAny (int, long double *, int);
00203 bool RecvAny (int, void *, int);
00214 bool GetCount (const std::type_info &, int *);
00220 int GetSenderRank () { return sStatus.MPI_SOURCE; }
00226 int GetSenderTag () { return sStatus.MPI_TAG; }
00232 int GetError () { return iError; }
00238 int GetError2 () { return sStatus.MPI_ERROR; }
00239 };
00240
00241 #endif
00242