00001 #ifdef CH_LANG_CC
00002
00003
00004
00005
00006
00007
00008
00009 #endif
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021 #ifndef _SPMD_H_
00022 #define _SPMD_H_
00023
00024 #include "REAL.H"
00025 #include <string>
00026 #include "Vector.H"
00027 #include "MayDay.H"
00028 #include "Misc.H"
00029
00030 #ifdef CH_MPI
00031 #include "mpi.h"
00032 #endif
00033
00034 #include "BaseNamespaceHeader.H"
00035
00036 #ifdef CH_MPI
00037 struct Chombo_MPI
00038 {
00039 static MPI_Comm comm;
00040 };
00041
00042 #else
00043
00044 extern int num_procs ;
00045 #endif
00046
00047 extern unsigned long long CH_MAX_MPI_MESSAGE_SIZE;
00048
00049 extern unsigned long long CH_MaxMPISendSize;
00050 extern unsigned long long CH_MaxMPIRecvSize;
00051
00052 int reportMPIStats();
00053
00054
00055
00056
00057
00058
00059 int procID();
00060
00061 inline int CHprocID()
00062 {
00063 return procID();
00064 }
00065
00066
00067
00068
00069
00070 unsigned int numProc();
00071
00072
00073
00074
00075 void barrier(void);
00076
00077 template <class T>
00078 int linearSize(const T& inputT);
00079
00080 template <class T>
00081 void linearIn(T& a_outputT, const void* const inBuf);
00082
00083 template <class T>
00084 void linearOut(void* const a_outBuf, const T& inputT);
00085
00086 #ifdef CH_MPI
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102 template <class T>
00103 void gather(Vector<T>& a_outVec, const T& a_input, int a_dest);
00104
00105 #endif
00106
00107
00108
00109
00110
00111
00112
00113
00114
00115
00116
00117 template <class T>
00118 void broadcast(T& a_inAndOut, int a_src);
00119
00120
00121 template < >
00122 int linearSize(const long long& a_input);
00123
00124
00125 template < >
00126 void linearIn(long long& a_outputT, const void* const inBuf);
00127
00128
00129 template < >
00130 void linearOut(void* const a_outBuf, const long long& a_inputT);
00131
00132
00133 template < >
00134 int linearSize(const int& a_input);
00135
00136
00137 template < >
00138 int linearSize(const unsigned long long& a_input);
00139
00140
00141 template < >
00142 void linearIn(int& a_outputT, const void* const inBuf);
00143
00144
00145 template < >
00146 void linearIn(unsigned long long& a_outputT, const void* const inBuf);
00147
00148
00149 template < >
00150 void linearOut(void* const a_outBuf, const int& a_inputT);
00151
00152
00153 template < >
00154 void linearOut(void* const a_outBuf, const unsigned long long& a_inputT);
00155
00156
00157 template < >
00158 int linearSize(const long& a_input);
00159
00160
00161 template < >
00162 void linearIn(long& a_outputT, const void* const inBuf);
00163
00164
00165 template < >
00166 void linearOut(void* const a_outBuf, const long& a_inputT);
00167
00168
00169 template < >
00170 int linearSize(const unsigned long& a_input);
00171
00172
00173 template < >
00174 void linearIn(unsigned long& a_outputT, const void* const inBuf);
00175
00176
00177 template < >
00178 void linearOut(void* const a_outBuf, const unsigned long& a_inputT);
00179
00180
00181 template < >
00182 int linearSize(const float& a_input);
00183
00184 template < >
00185 int linearSize(const double& a_input);
00186
00187
00188 template < >
00189 void linearIn(float& a_outputT, const void* const a_inBuf);
00190
00191 template < >
00192 void linearIn(double& a_outputT, const void* const a_inBuf);
00193
00194
00195 template < >
00196 void linearOut(void* const a_outBuf, const float& a_inputT);
00197
00198 template < >
00199 void linearOut(void* const a_outBuf, const double& a_inputT);
00200
00201
00202 template <>
00203 int linearSize(const std::string& a_input);
00204 template <>
00205 void linearIn(std::string& a_outputT, const void* const a_inBuf);
00206 template <>
00207 void linearOut(void* const a_outBuf, const std::string& a_inputT);
00208
00209
00210 template < >
00211 int linearSize(const Vector<int>& a_input);
00212 template < >
00213 void linearIn(Vector<int>& a_outputT, const void* const inBuf);
00214 template < >
00215 void linearOut(void* const a_outBuf, const Vector<int>& a_inputT);
00216
00217
00218 template < >
00219 int linearSize(const Vector<unsigned long long>& a_input);
00220 template < >
00221 void linearIn(Vector<unsigned long long>& a_outputT, const void* const inBuf);
00222 template < >
00223 void linearOut(void* const a_outBuf, const Vector<unsigned long long>& a_inputT);
00224
00225
00226 template < >
00227 int linearSize(const Vector<long>& a_input);
00228 template < >
00229 void linearIn(Vector<long>& a_outputT, const void* const inBuf);
00230 template < >
00231 void linearOut(void* const a_outBuf, const Vector<long>& a_inputT);
00232
00233
00234 template < >
00235 int linearSize(const Vector<float>& a_input);
00236 template < >
00237 void linearIn(Vector<float>& a_outputT, const void* const inBuf);
00238 template < >
00239 void linearOut(void* const a_outBuf, const Vector<float>& a_inputT);
00240
00241 template < >
00242 int linearSize(const Vector<double>& a_input);
00243 template < >
00244 void linearIn(Vector<double>& a_outputT, const void* const inBuf);
00245 template < >
00246 void linearOut(void* const a_outBuf, const Vector<double>& a_inputT);
00247
00248
00249 template < >
00250 int linearSize(const Vector<std::string>& a_input);
00251 template < >
00252 void linearIn(Vector<std::string>& a_outputT, const void* const inBuf);
00253 template < >
00254 void linearOut(void* const a_outBuf, const Vector<std::string>& a_inputT);
00255
00256
00257 template < >
00258 int linearSize(const Vector<Vector<int> >& a_input);
00259 template < >
00260 void linearIn(Vector<Vector<int> >& a_outputT, const void* const inBuf);
00261 template < >
00262 void linearOut(void* const a_outBuf, const Vector<Vector<int> >& a_inputT);
00263
00264
00265 template <class T>
00266 int linearListSize(const Vector<T>& a_input);
00267
00268
00269 template <class T>
00270 void linearListIn(Vector<T>& a_outputT, const void* const a_inBuf);
00271
00272
00273 template <class T>
00274 void linearListOut(void* const a_outBuf, const Vector<T>& a_inputT);
00275
00276 class SerialTask
00277 {
00278 public:
00279 enum task
00280 {
00281 compute=0
00282 };
00283 };
00284
00285 int GetPID(int rank);
00286 int GetRank(int pid);
00287
00288
00289 int
00290 uniqueProc(const SerialTask::task& a_task);
00291
00292 #include "BaseNamespaceFooter.H"
00293
00294 #include "SPMDI.H"
00295
00296 #endif