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