Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

SPMD.H

Go to the documentation of this file.
00001 /* _______              __
00002   / ___/ /  ___  __ _  / /  ___
00003  / /__/ _ \/ _ \/  ' \/ _ \/ _ \
00004  \___/_//_/\___/_/_/_/_.__/\___/ 
00005 */
00006 //
00007 // This software is copyright (C) by the Lawrence Berkeley
00008 // National Laboratory.  Permission is granted to reproduce
00009 // this software for non-commercial purposes provided that
00010 // this notice is left intact.
00011 // 
00012 // It is acknowledged that the U.S. Government has rights to
00013 // this software under Contract DE-AC03-765F00098 between
00014 // the U.S.  Department of Energy and the University of
00015 // California.
00016 //
00017 // This software is provided as a professional and academic
00018 // contribution for joint exchange. Thus it is experimental,
00019 // is provided ``as is'', with no warranties of any kind
00020 // whatsoever, no support, no promise of updates, or printed
00021 // documentation. By using this software, you acknowledge
00022 // that the Lawrence Berkeley National Laboratory and
00023 // Regents of the University of California shall have no
00024 // liability with respect to the infringement of other
00025 // copyrights by any part of this software.
00026 //
00027 
00028 //
00029 // These are the inevitable functions that people
00030 // can't avoid using when writing a SPMD program.
00031 // It is a minimal set from which more elaborate
00032 // functionality can be generated.  As always, a
00033 // user is free to utilize the entire MPI programming
00034 // on their own platform.  The functions are 
00035 // assured to work on all machines supported.
00036 //
00037 
00038 #ifndef SPMD_H
00039 #define SPMD_H
00040 
00041 #include "REAL.H"
00042 #include "Vector.H"
00043 #include "Box.H"
00044 #include "MayDay.H"
00045 class IntVectSet;
00046 
00047 
00049 
00053 int procID();
00054 
00056 
00059 unsigned int numProc();
00060 
00061 
00062 template <class T>
00063 int linearSize(const T& inputT); 
00064 
00065 template <class T>
00066 void linearIn(T& a_outputT, const void* const inBuf); 
00067 
00068 template <class T>
00069 void linearOut(void* const a_outBuf, const T& inputT); 
00070 
00071 #ifdef MPI
00072 // is this being used anywhere?  xlC was complaining about it... (ndk)
00073 //  ahh.. it's used when MPI=TRUE
00074 
00076 
00090 template <class T>
00091 void gather(Vector<T>& a_outVec, const T& a_input, int a_dest);
00092 
00093 // this has to be here so that linearSize<IntVectSet>, linearIn<IntVectSet>, 
00094 //  and linearOut<IntVectSet> are defined.
00095 template < >
00096 void gather(Vector<IntVectSet>& a_outVec, 
00097             const IntVectSet& a_input, 
00098             int a_dest);
00099 #endif
00100 
00102 
00111 template <class T>
00112 void broadcast(T& a_inAndOut,  int a_src);
00113 
00114 //integer specialization of linearSize
00115 template < >
00116 int linearSize(const int& a_input); 
00117 
00118 //integer specialization of linearIn
00119 template < >
00120 void linearIn(int& a_outputT, const void* const inBuf); 
00121 
00122 //integer specialization of linearOut
00123 template < >
00124 void linearOut(void* const a_outBuf, const int& a_inputT); 
00125 
00126 //Real specialization of linearSize
00127 template < >
00128 int linearSize(const Real& a_input); 
00129 
00130 //Real specialization of linearIn
00131 template < >
00132 void linearIn(Real& a_outputT, const void* const a_inBuf); 
00133 
00134 //Real specialization of linearOut
00135 template < >
00136 void linearOut(void* const a_outBuf, const Real& a_inputT); 
00137 
00138 //Box specialization of linearSize
00139 template < >
00140 int linearSize(const Box& a_input); 
00141 
00142 //Box specialization of linearIn
00143 template < >
00144 void linearIn(Box& a_outputT, const void* const a_inBuf); 
00145 
00146 //Box specialization of linearOut
00147 template < >
00148 void linearOut(void* const a_outBuf, const Box& a_inputT); 
00149 
00150 //Vector<int>  specialization
00151 template < > 
00152 int linearSize(const Vector<int>& a_input); 
00153 template < > 
00154 void linearIn(Vector<int>& a_outputT, const void* const inBuf); 
00155 template < > 
00156 void linearOut(void* const a_outBuf, const Vector<int>& a_inputT); 
00157 
00158 //Vector<Real>  specialization
00159 template < > 
00160 int linearSize(const Vector<Real>& a_input); 
00161 template < > 
00162 void linearIn(Vector<Real>& a_outputT, const void* const inBuf); 
00163 template < > 
00164 void linearOut(void* const a_outBuf, const Vector<Real>& a_inputT); 
00165 
00166 //Vector<Box>  specialization
00167 template < > 
00168 int linearSize(const Vector<Box>& a_input); 
00169 template < > 
00170 void linearIn(Vector<Box>& a_outputT, const void* const inBuf); 
00171 template < > 
00172 void linearOut(void* const a_outBuf, const Vector<Box>& a_inputT); 
00173 
00174 //Vector<Vector<Box> > specialization
00175 template < > 
00176 int linearSize(const Vector<Vector<Box> >& a_input); 
00177 template < > 
00178 void linearIn(Vector<Vector<Box> >& a_outputT, const void* const inBuf); 
00179 template < > 
00180 void linearOut(void* const a_outBuf, const Vector<Vector<Box> >& a_inputT); 
00181 
00182 
00183 //Vector<T> specialization of linearSize
00184 template <class T>
00185 int linearListSize(const Vector<T>& a_input); 
00186 
00187 //Vector<T> specialization of linearIn
00188 template <class T>
00189 void linearListIn(Vector<T>& a_outputT, const void* const a_inBuf); 
00190 
00191 //Vector<T> specialization of linearOut
00192 template <class T>
00193 void linearListOut(void* const a_outBuf, const Vector<T>& a_inputT); 
00194 
00195 class SerialTask
00196 {
00197 public:
00198     enum task { compute=0 };
00199 };
00200 
00201 // return id of unique processor for special serial tasks
00202 int
00203 uniqueProc(const SerialTask::task& a_task);
00204 
00205 #ifdef MPI
00206 #include <mpi.h>
00207 struct Chombo_MPI{ static MPI_Comm comm;};
00208 void setChomboMPIErrorHandler();
00209 
00210 #else
00211 // this can be changed for debugging parallel code in serial
00212 extern int num_procs ;
00213 #endif
00214 
00215 #include "SPMDI.H"
00216 
00217 #endif // SPMD.H
00218 

Generated on Thu Aug 29 11:05:46 2002 for Chombo&INS by doxygen1.2.16