Blockstructured Adaptive Mesh Refinement in object-oriented C++
00001 #ifndef AMROC_TIMING_H 00002 #define AMROC_TIMING_H 00003 00011 #ifdef DAGH_NO_MPI 00012 #undef TIMING_AMR 00013 #endif 00014 00015 #ifdef TIMING_AMR 00016 #define START_WATCH_WHOLE Timing::SetWhole(MPI_Wtime()); 00017 #define START_WATCH Timing::SetCurrent(MPI_Wtime()); 00018 #define START_INTERMEDIATE_WATCH Timing::SetIntermediate(MPI_Wtime()); 00019 #define END_INTERMEDIATE_WATCH Timing::EndIntermediate(MPI_Wtime()); 00020 #define END_WATCH_INITIALIZATION Timing::Add2Initialization(MPI_Wtime()); 00021 #define END_WATCH_FLAGGING Timing::Add2Flagging(MPI_Wtime()); 00022 #define END_WATCH_RECOMPOSING_WHOLE Timing::Add2RecompositionWhole(MPI_Wtime()); 00023 #define END_WATCH_RECOMPOSING_INTERPOLATION Timing::Add2RecompositionInterpolation(MPI_Wtime()); 00024 #define END_WATCH_BOUNDARIES_WHOLE Timing::Add2BoundariesWhole(MPI_Wtime()); 00025 #define END_WATCH_BOUNDARIES_SYNC Timing::Add2BoundariesSync(MPI_Wtime()); 00026 #define END_WATCH_BOUNDARIES_INTERPOLATION Timing::Add2BoundariesInterpolation(MPI_Wtime()); 00027 #define END_WATCH_BOUNDARIES_EXTERNAL Timing::Add2BoundariesExternal(MPI_Wtime()); 00028 #define END_WATCH_INTEGRATION(which) Timing::Add2Integration(MPI_Wtime(),which); 00029 #define END_WATCH_SOURCE_INTEGRATION Timing::Add2SourceIntegration(MPI_Wtime()); 00030 #define END_WATCH_FIXUP_WHOLE Timing::Add2FixupWhole(MPI_Wtime()); 00031 #define END_WATCH_FIXUP_SYNC Timing::Add2FixupSync(MPI_Wtime()); 00032 #define END_WATCH_CLUSTERING Timing::Add2Clustering(MPI_Wtime()); 00033 #define END_WATCH_OUPUT Timing::Add2Output(MPI_Wtime()); 00034 #define END_WATCH_EXAMINE Timing::Add2Examine(MPI_Wtime()); 00035 #define END_WATCH_WHOLE Timing::GetWhole(MPI_Wtime()); 00036 #else 00037 #define START_WATCH_WHOLE 00038 #define START_WATCH 00039 #define START_INTERMEDIATE_WATCH 00040 #define END_INTERMEDIATE_WATCH 00041 #define END_WATCH_INITIALIZATION 00042 #define END_WATCH_FLAGGING 00043 #define END_WATCH_RECOMPOSING_WHOLE 00044 #define END_WATCH_RECOMPOSING_INTERPOLATION 00045 #define END_WATCH_BOUNDARIES_WHOLE 00046 #define END_WATCH_BOUNDARIES_SYNC 00047 #define END_WATCH_BOUNDARIES_INTERPOLATION 00048 #define END_WATCH_BOUNDARIES_EXTERNAL 00049 #define END_WATCH_INTEGRATION(which) 00050 #define END_WATCH_SOURCE_INTEGRATION 00051 #define END_WATCH_FIXUP_WHOLE 00052 #define END_WATCH_FIXUP_SYNC 00053 #define END_WATCH_CLUSTERING 00054 #define END_WATCH_OUPUT 00055 #define END_WATCH_EXAMINE 00056 #define END_WATCH_WHOLE 00057 #endif 00058 00059 00060 #include "DAGHParams.h" 00061 00069 class Timing { 00070 00071 private: 00072 static double initialization; 00073 static double main_integration; 00074 static double shadow_integration; 00075 static double estimate_integration; 00076 static double source_integration; 00077 static double fixup_whole; 00078 static double fixup_sync; 00079 static double recomposing_whole; 00080 static double recomposing_interpolation; 00081 static double boundaries_whole; 00082 static double boundaries_sync; 00083 static double boundaries_interpolation; 00084 static double boundaries_external; 00085 static double flagging; 00086 static double clustering; 00087 static double output; 00088 static double examine; 00089 static double whole; 00090 static double current; 00091 static double intermediate; 00092 00093 public: 00094 Timing() {} 00095 00096 static void SetCurrent(const double v) 00097 { current = v; } 00098 static void SetWhole(const double v) 00099 { whole = v; } 00100 static void SetIntermediate(const double v) 00101 { intermediate = v-current; } 00102 static void EndIntermediate(const double v) 00103 { current = v-intermediate; } 00104 00105 static void Add2Initialization(const double v) 00106 { initialization += v-current; current = v; } 00107 static void Add2Flagging(const double v) 00108 { flagging += v-current; current = v; } 00109 static void Add2RecompositionWhole(const double v) 00110 { recomposing_whole += v-current; current = v; } 00111 static void Add2RecompositionInterpolation(const double v) 00112 { recomposing_interpolation += v-current; current = v; } 00113 static void Add2BoundariesWhole(const double v) 00114 { boundaries_whole += v-current; current = v; } 00115 static void Add2BoundariesSync(const double v) 00116 { boundaries_sync += v-current; current = v; } 00117 static void Add2BoundariesInterpolation(const double v) 00118 { boundaries_interpolation += v-current; current = v; } 00119 static void Add2BoundariesExternal(const double v) 00120 { boundaries_external += v-current; current = v; } 00121 static void Add2Integration(const double v, const int which) { 00122 if (which<=0 || which>2) main_integration += v-current; 00123 else if (which==1) estimate_integration += v-current; 00124 else shadow_integration += v-current; 00125 current = v; 00126 } 00127 static void Add2SourceIntegration(const double v) 00128 { source_integration += v-current; current = v; } 00129 static void Add2FixupWhole(const double v) 00130 { fixup_whole += v-current; current = v; } 00131 static void Add2FixupSync(const double v) 00132 { fixup_sync += v-current; current = v; } 00133 static void Add2Clustering(const double v) 00134 { clustering += v-current; current = v; } 00135 static void Add2Output(const double v) 00136 { output += v-current; current = v; } 00137 static void Add2Examine(const double v) 00138 { examine += v-current; current = v; } 00139 static void GetWhole(const double v) 00140 { whole = v-whole; } 00141 00142 static void print(ostream& os) { 00143 #ifdef TIMING_AMR 00144 double counted = initialization + 00145 main_integration+shadow_integration+estimate_integration+source_integration+ 00146 fixup_whole+fixup_sync+ 00147 boundaries_whole+boundaries_sync+boundaries_interpolation+boundaries_external+ 00148 flagging+clustering+recomposing_whole+recomposing_interpolation+ 00149 output+examine; 00150 00151 os << " Initialization : " << initialization 00152 << " s (" << 100.0*initialization/whole << "%)" << endl; 00153 os << " Integration - Main : " << main_integration 00154 << " s (" << 100.0*main_integration/whole << "%)" << endl; 00155 os << " Estimation : " << estimate_integration 00156 << " s (" << 100.0*estimate_integration/whole << "%)" << endl; 00157 os << " Coarsen : " << shadow_integration 00158 << " s (" << 100.0*shadow_integration/whole << "%)" << endl; 00159 os << " Source : " << source_integration 00160 << " s (" << 100.0*source_integration/whole << "%)" << endl; 00161 os << " Fixup - Overhead : " << fixup_whole 00162 << " s (" << 100.0*fixup_whole/whole << "%)" << endl; 00163 os << " Syncing : " << fixup_sync 00164 << " s (" << 100.0*fixup_sync/whole << "%)" << endl; 00165 os << " Boundary Val. - Overhead : " << boundaries_whole 00166 << " s (" << 100.0*boundaries_whole/whole << "%)" << endl; 00167 os << " Syncing : " << boundaries_sync 00168 << " s (" << 100.0*boundaries_sync/whole << "%)" << endl; 00169 os << " Interpolation : " << boundaries_interpolation 00170 << " s (" << 100.0*boundaries_interpolation/whole << "%)" << endl; 00171 os << " Physical : " << boundaries_external 00172 << " s (" << 100.0*boundaries_external/whole << "%)" << endl; 00173 os << " Regridding - Flagging : " << flagging 00174 << " s (" << 100.0*flagging/whole << "%)" << endl; 00175 os << " Clustering : " << clustering 00176 << " s (" << 100.0*clustering/whole << "%)" << endl; 00177 os << " Recomposition - Overhead : " << recomposing_whole 00178 << " s (" << 100.0*recomposing_whole/whole << "%)" << endl; 00179 os << " Interpolation : " << recomposing_interpolation 00180 << " s (" << 100.0*recomposing_interpolation/whole << "%)" << endl; 00181 os << " Output : " << output 00182 << " s (" << 100.0*output/whole << "%)" << endl; 00183 os << " Examined in detail : " << examine 00184 << " s (" << 100.0*examine/whole << "%)" << endl; 00185 os << " Misc : " << whole-counted 00186 << " s (" << 100.0*(whole-counted)/whole << "%)" << endl; 00187 os << " Whole time : " << whole 00188 << " s" << endl; 00189 #endif 00190 } 00191 00192 }; 00193 00194 00195 #endif
Quickstart Users Guide Programmers Reference Installation Examples Download
AMROC Main Home Contactlast update: 06/01/04