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 "Vector.H"
00026 #include "Box.H"
00027 #include "MayDay.H"
00028 #include "RealVect.H"
00029
00030 #ifdef CH_MPI
00031 #include <mpi.h>
00032 #endif
00033
00034 #include "NamespaceHeader.H"
00035
00036 #ifdef CH_MPI
00037 struct Chombo_MPI{ static MPI_Comm comm;};
00038
00039 #else
00040
00041 extern int num_procs ;
00042 #endif
00043
00044 class IntVectSet;
00045
00046 extern long long CH_MAX_MPI_MESSAGE_SIZE;
00047
00048 extern long long CH_MaxMPISendSize;
00049 extern long long CH_MaxMPIRecvSize;
00050
00051
00052 int reportMPIStats();
00053
00055
00059 int procID();
00060
00062
00065 unsigned int numProc();
00066
00068
00070 void barrier(void);
00071
00072 template <class T>
00073 int linearSize(const T& inputT);
00074
00075 template <class T>
00076 void linearIn(T& a_outputT, const void* const inBuf);
00077
00078 template <class T>
00079 void linearOut(void* const a_outBuf, const T& inputT);
00080
00081 #ifdef CH_MPI
00082
00083
00097 template <class T>
00098 void gather(Vector<T>& a_outVec, const T& a_input, int a_dest);
00099
00100
00101
00102
00103
00104
00105
00106 #endif
00107
00109
00118 template <class T>
00119 void broadcast(T& a_inAndOut, int a_src);
00120
00121
00122 template < >
00123 int linearSize(const int& a_input);
00124
00125
00126 template < >
00127 void linearIn(int& a_outputT, const void* const inBuf);
00128
00129
00130 template < >
00131 void linearOut(void* const a_outBuf, const int& a_inputT);
00132
00133
00134 template < >
00135 int linearSize(const long& a_input);
00136
00137
00138 template < >
00139 void linearIn(long& a_outputT, const void* const inBuf);
00140
00141
00142 template < >
00143 void linearOut(void* const a_outBuf, const long& a_inputT);
00144
00145
00146 template < >
00147 int linearSize(const unsigned long& a_input);
00148
00149
00150 template < >
00151 void linearIn(unsigned long& a_outputT, const void* const inBuf);
00152
00153
00154 template < >
00155 void linearOut(void* const a_outBuf, const unsigned long& a_inputT);
00156
00157
00158 template < >
00159 int linearSize(const float& a_input);
00160
00161 template < >
00162 int linearSize(const double& a_input);
00163
00164
00165 template < >
00166 void linearIn(float& a_outputT, const void* const a_inBuf);
00167
00168 template < >
00169 void linearIn(double& a_outputT, const void* const a_inBuf);
00170
00171
00172 template < >
00173 void linearOut(void* const a_outBuf, const float& a_inputT);
00174
00175 template < >
00176 void linearOut(void* const a_outBuf, const double& a_inputT);
00177
00178
00179 template < >
00180 int linearSize(const Box& a_input);
00181
00182
00183 template < >
00184 void linearIn(Box& a_outputT, const void* const a_inBuf);
00185
00186
00187 template < >
00188 void linearOut(void* const a_outBuf, const Box& a_inputT);
00189
00190
00191 template < >
00192 int linearSize(const Vector<int>& a_input);
00193 template < >
00194 void linearIn(Vector<int>& a_outputT, const void* const inBuf);
00195 template < >
00196 void linearOut(void* const a_outBuf, const Vector<int>& a_inputT);
00197
00198
00199 template < >
00200 int linearSize(const Vector<long>& a_input);
00201 template < >
00202 void linearIn(Vector<long>& a_outputT, const void* const inBuf);
00203 template < >
00204 void linearOut(void* const a_outBuf, const Vector<long>& a_inputT);
00205
00206
00207 template < >
00208 int linearSize(const Vector<float>& a_input);
00209 template < >
00210 void linearIn(Vector<float>& a_outputT, const void* const inBuf);
00211 template < >
00212 void linearOut(void* const a_outBuf, const Vector<float>& a_inputT);
00213
00214 template < >
00215 int linearSize(const Vector<double>& a_input);
00216 template < >
00217 void linearIn(Vector<double>& a_outputT, const void* const inBuf);
00218 template < >
00219 void linearOut(void* const a_outBuf, const Vector<double>& a_inputT);
00220
00221
00222 template < >
00223 int linearSize(const Vector<Box>& a_input);
00224 template < >
00225 void linearIn(Vector<Box>& a_outputT, const void* const inBuf);
00226 template < >
00227 void linearOut(void* const a_outBuf, const Vector<Box>& a_inputT);
00228
00229
00230 template < >
00231 int linearSize(const Vector<Vector<Box> >& a_input);
00232 template < >
00233 void linearIn(Vector<Vector<Box> >& a_outputT, const void* const inBuf);
00234 template < >
00235 void linearOut(void* const a_outBuf, const Vector<Vector<Box> >& a_inputT);
00236
00237
00238 template < >
00239 int linearSize(const RealVect& vindex);
00240
00241
00242 template < >
00243 void linearIn(RealVect& a_outputT, const void* const inBuf);
00244
00245
00246 template < >
00247 void linearOut(void* const a_outBuf, const RealVect& a_inputT);
00248
00249
00250 template < >
00251 int linearSize(const Vector<Vector<int> >& a_input);
00252 template < >
00253 void linearIn(Vector<Vector<int> >& a_outputT, const void* const inBuf);
00254 template < >
00255 void linearOut(void* const a_outBuf, const Vector<Vector<int> >& a_inputT);
00256
00257
00258 template <class T>
00259 int linearListSize(const Vector<T>& a_input);
00260
00261
00262 template <class T>
00263 void linearListIn(Vector<T>& a_outputT, const void* const a_inBuf);
00264
00265
00266 template <class T>
00267 void linearListOut(void* const a_outBuf, const Vector<T>& a_inputT);
00268
00269 class SerialTask
00270 {
00271 public:
00272 enum task { compute=0 };
00273 };
00274
00275 int GetPID(int rank);
00276 int GetRank(int pid);
00277
00278
00279 int
00280 uniqueProc(const SerialTask::task& a_task);
00281
00282 #include "NamespaceFooter.H"
00283
00284 #include "SPMDI.H"
00285
00286 #endif