Changeset d13e27
- Timestamp:
- Mar 29, 2013, 5:03:13 PM (13 years ago)
- Children:
- f57182
- Parents:
- 5ba22b
- Files:
-
- 18 edited
-
configure.ac (modified) (6 diffs)
-
src/base/command_list.cpp (modified) (2 diffs)
-
src/base/defs.hpp (modified) (1 diff)
-
src/base/factory.cpp (modified) (3 diffs)
-
src/base/helper.hpp (modified) (2 diffs)
-
src/base/timer.cpp (modified) (4 diffs)
-
src/comm/comm.hpp (modified) (1 diff)
-
src/comm/comm_mpi.cpp (modified) (2 diffs)
-
src/comm/comm_mpi.hpp (modified) (1 diff)
-
src/comm/comm_serial.cpp (modified) (4 diffs)
-
src/comm/comm_serial.hpp (modified) (1 diff)
-
src/commands/com_check_relative_residual.cpp (modified) (1 diff)
-
src/commands/com_initialize_residual_norm.cpp (modified) (1 diff)
-
src/commands/com_print_residual_norm.cpp (modified) (2 diffs)
-
src/grid/grid.cpp (modified) (2 diffs)
-
src/mg.cpp (modified) (3 diffs)
-
src/units/particle/interface_fcs.cpp (modified) (1 diff)
-
src/units/particle/interface_particles.cpp (modified) (8 diffs)
Legend:
- Unmodified
- Added
- Removed
-
configure.ac
r5ba22b rd13e27 19 19 AC_LANG([C++]) 20 20 21 # switch for one-sided communications 21 # Release version switch 22 AC_MSG_CHECKING(whether to enable release version) 23 AC_ARG_ENABLE([release], 24 AS_HELP_STRING([--enable-release], [Compile with release settings]), 25 enable_release=$enableval, 26 enable_release="no") 27 AC_MSG_RESULT($enable_release) 28 AS_IF([test "$enable_release" = "yes"], [ 29 AC_DEFINE([RELEASE], [1], [Release]) 30 AC_DEFINE([NDEBUG], [1], [Skip asserts]) 31 ]) 32 33 # One-sided communications 22 34 AC_MSG_CHECKING(whether to enable one-sided MPI2 communications) 23 35 AC_ARG_ENABLE([one_sided], … … 30 42 ]) 31 43 32 # several debug output switches 33 AS_IF([test "x$enable_fcs_info" != "x"], [ 34 AC_DEFINE([DEBUG_INFO], [1], [Debugging info output]) 35 ]) 36 44 # Interpolating B-Spline degree 45 AC_ARG_VAR(BSPLINE_DEG, [Degree of interpolating B-Splines. Must be in [3-6].]) 46 if test -z "$BSPLINE_DEG" 47 then 48 BSPLINE_DEG=3 49 fi 50 AC_MSG_CHECKING(interpolation b-spline degree) 51 AC_DEFINE_UNQUOTED([BSPLINE_DEGREE], ${BSPLINE_DEG}, [Interpolating B-Spline degree]) 52 AC_MSG_RESULT(${BSPLINE_DEG}) 53 54 # Debugging switches 37 55 AC_MSG_CHECKING(whether to enable debugging) 38 56 AC_ARG_ENABLE([debug], … … 44 62 AS_IF([test "$enable_debug" = "yes"], [ 45 63 CXXFLAGS=${CXXFLAGS-"-g -O0 -Wall"} 46 AC_DEFINE([DEBUG], [1], [Debugging output])64 AC_DEFINE([DEBUG], [1], [Debugging]) 47 65 ]) 48 66 … … 57 75 ]) 58 76 59 AC_MSG_CHECKING(whether to enable debug output)60 AC_ARG_ENABLE([debug-output],61 AS_HELP_STRING([--enable-debug-output], [Enable debugging output]),62 enable_debug_output=$enableval,63 enable_debug_output="no")64 AS_IF([test "x$enable_fcs_debug" != "x"],[enable_debug_output="yes"])65 AC_MSG_RESULT($enable_debug_output)66 AS_IF([test "$enable_debug_output" = "yes"], [67 AC_DEFINE([DEBUG_OUTPUT], [1], [Debugging output])68 ])69 70 77 AC_MSG_CHECKING(whether to enable MPE profiling) 71 78 AC_ARG_ENABLE([mpe], … … 74 81 enable_mpe="no") 75 82 AC_MSG_RESULT($enable_mpe) 76 77 AC_MSG_CHECKING(whether to enable runtime measurement)78 AC_ARG_ENABLE([timer],79 AS_HELP_STRING([--enable-timer], [Enable runtime measurement]),80 enable_timer=$enableval,81 enable_timer="no")82 AS_IF([test "x$enable_fcs_timing" != "x"],[enable_timer="yes"])83 AC_MSG_RESULT($enable_timer)84 AS_IF([test "$enable_timer" = "yes"], [85 AC_DEFINE([DEBUG_MEASURE_TIME], [1], [Runtime measurement])86 ])87 88 AC_MSG_CHECKING(whether to enable runtime measurement output)89 AC_ARG_ENABLE([timer-output],90 AS_HELP_STRING([--enable-timer-output], [Enable runtime measurement output]),91 enable_timer_output=$enableval,92 enable_timer_output="no")93 AS_IF([test "x$enable_fcs_timing" != "x"],[enable_timer_output="yes"])94 AC_MSG_RESULT($enable_timer_output)95 AS_IF([test "$enable_timer_output" = "yes"], [96 AC_DEFINE([DEBUG_MEASURE_TIME_OUTPUT], [1], [Output of runtime measurement])97 ])98 83 99 84 AC_MSG_CHECKING(whether to enable MPI_Barrier debugging) … … 107 92 ]) 108 93 109 AC_MSG_CHECKING(whether to enable release version) 110 AC_ARG_ENABLE([release], 111 AS_HELP_STRING([--enable-release], [Compile with release settings]), 112 enable_release=$enableval, 113 enable_release="no") 114 AC_MSG_RESULT($enable_release) 115 AS_IF([test "$enable_release" = "yes"], [ 116 AC_DEFINE([RELEASE], [1], [Release]) 117 AC_DEFINE([NDEBUG], [1], [Skip asserts]) 118 ]) 119 120 AC_ARG_VAR(BSPLINE_DEG, [Degree of interpolating B-Splines. Must be [3].]) 121 122 if test -z "$BSPLINE_DEG" 123 then 124 BSPLINE_DEG=3 125 fi 126 127 AC_MSG_CHECKING(interpolation b-spline degree) 128 AC_DEFINE_UNQUOTED([BSPLINE_DEGREE], ${BSPLINE_DEG}, [Interpolating B-Spline degree]) 129 AC_MSG_RESULT(${BSPLINE_DEG}) 94 # Several output switches 95 AC_MSG_CHECKING(whether to enable info output) 96 AC_ARG_ENABLE([output-info], 97 AS_HELP_STRING([--enable-output-info], [Enable info output]), 98 enable_output_info=$enableval, 99 enable_output_info="no") 100 AS_IF([test "x$enable_fcs_info" != "x"],[enable_output_info="yes"]) 101 AC_MSG_RESULT($enable_output_info) 102 AS_IF([test "$enable_output_info" = "yes"], [ 103 AC_DEFINE([OUTPUT_INFO], [1], [Output level info]) 104 ]) 105 106 AC_MSG_CHECKING(whether to enable debug output) 107 AC_ARG_ENABLE([output-debug], 108 AS_HELP_STRING([--enable-output-debug], [Enable debug output]), 109 enable_output_debug=$enableval, 110 enable_output_debug="no") 111 AS_IF([test "x$enable_fcs_debug" != "x"],[enable_output_debug="yes"]) 112 AC_MSG_RESULT($enable_output_debug) 113 AS_IF([test "$enable_output_debug" = "yes"], [ 114 AC_DEFINE([OUTPUT_DEBUG], [1], [Output level debug]) 115 ]) 116 117 AC_MSG_CHECKING(whether to enable timing output) 118 AC_ARG_ENABLE([output-timing], 119 AS_HELP_STRING([--enable-output-timing], [Enable timing output]), 120 enable_output_timing=$enableval, 121 enable_output_timing="no") 122 AS_IF([test "x$enable_fcs_timing" != "x"],[enable_output_timing="yes"]) 123 AC_MSG_RESULT($enable_output_timing) 124 AS_IF([test "$enable_output_timing" = "yes"], [ 125 AC_DEFINE([OUTPUT_TIMING], [1], [Output level timing]) 126 ]) 127 130 128 131 129 # Checks for programs. -
src/base/command_list.cpp
r5ba22b rd13e27 63 63 #ifdef DEBUG_BARRIER 64 64 Comm& comm = *MG::GetComm(); 65 #ifdef HAVE_MPI66 65 comm.Barrier(); 67 #endif 68 comm.PrintStringOnce("Command \"%s\" start", iter->first.c_str()); 66 comm.PrintOnce(Debug, "Command \"%s\" start", iter->first.c_str()); 69 67 #endif 70 68 … … 74 72 75 73 #ifdef DEBUG_BARRIER 76 #ifdef HAVE_MPI77 74 comm.Barrier(); 78 #endif 79 comm.PrintStringOnce("Command \"%s\" done", iter->first.c_str()); 75 comm.PrintOnce(Debug, "Command \"%s\" done", iter->first.c_str()); 80 76 #endif 81 77 -
src/base/defs.hpp
r5ba22b rd13e27 34 34 namespace VMG 35 35 { 36 37 /** 38 * Controls console output 39 * 40 */ 41 enum OutputLevel { 42 Output, 43 Info, 44 Debug, 45 Timing 46 }; 36 47 37 48 /** -
src/base/factory.cpp
r5ba22b rd13e27 33 33 34 34 #include "base/command.hpp" 35 #include "base/defs.hpp" 35 36 #include "base/discretization.hpp" 36 37 #include "base/factory.hpp" … … 69 70 return iter->second; 70 71 71 MG::GetComm()->Print StringOnce("Error: Object %s is not registered", id.c_str());72 MG::GetComm()->PrintOnce(Debug, "Error: Object %s is not registered", id.c_str()); 72 73 assert(0); 73 74 … … 87 88 void Factory::PrintAvailableObjects() 88 89 { 89 MG::GetComm()->Print String("Registered objects:");90 MG::GetComm()->Print(Debug, "Registered objects:"); 90 91 for (std::map<std::string, Object*>::iterator iter=object_map.begin(); iter!=object_map.end(); ++iter) 91 MG::GetComm()->Print String("%s", iter->second->Name().c_str());92 MG::GetComm()->Print(Debug, "%s", iter->second->Name().c_str()); 92 93 } 93 94 -
src/base/helper.hpp
r5ba22b rd13e27 72 72 str >> val; 73 73 74 if (str.fail() || str.bad() || !str.eof()) { 75 #ifdef DEBUG_VERBOSE 76 std::printf("VMG::Helper::ToValWithDefault: Using default value.\n"); 77 #endif 78 val = def; 79 } 74 if (str.fail() || str.bad() || !str.eof()) val = def; 80 75 81 76 return val; … … 175 170 bool rval = (val1 == val2); 176 171 177 #ifdef DEBUG _OUTPUT172 #ifdef DEBUG 178 173 if (!rval) 179 printf("WARNING: Values are not equal (%s)\n", name); 180 #endif /* DEBUG_OUTPUT */ 181 174 printf("Equality test failed (%s)\n", name); 182 175 assert(rval); 176 #endif /* DEBUG */ 183 177 184 178 return rval; -
src/base/timer.cpp
r5ba22b rd13e27 52 52 std::map<std::string, TimerData> Timer::td; 53 53 54 void Timer::Start(std::string event)55 {56 #ifdef HAVE_MPI57 #ifdef DEBUG_MEASURE_TIME58 std::map<std::string, TimerData>::iterator iter = td.find(event);59 if (iter == td.end())60 iter = td.insert(std::make_pair(event, TimerData())).first;61 62 iter->second.time_start = MPI_Wtime();63 #endif64 #endif65 }66 67 void Timer::Stop(std::string event)68 {69 #ifdef HAVE_MPI70 #ifdef DEBUG_MEASURE_TIME71 double time_end = MPI_Wtime();72 73 std::map<std::string, TimerData>::iterator iter = td.find(event);74 75 if (time_end - iter->second.time_start < std::numeric_limits<double>::min())76 ++(iter->second.warning);77 78 ++(iter->second.total);79 80 iter->second.duration += time_end - iter->second.time_start;81 #endif82 #endif83 }84 85 void Timer::Clear()86 {87 td.clear();88 }89 90 pugi::xml_node Timer::ToXMLNode()91 {92 std::map<std::string, TimerData>::iterator iter;93 94 pugi::xml_node node_process;95 node_process.append_attribute("Rank").set_value(MG::GetComm()->GlobalRank());96 97 pugi::xml_node node_timings = node_process.append_child("Timings");98 99 for (iter=Timer::td.begin(); iter!=Timer::td.end(); ++iter) {100 101 pugi::xml_node node_entry = node_timings.append_child("Sample");102 node_entry.append_attribute("Name").set_value(Helper::ToString(iter->first).c_str());103 104 node_entry.append_child("Duration")105 .append_child(pugi::node_pcdata)106 .set_value(Helper::ToString(iter->second.duration).c_str());107 108 node_entry.append_child("Warnings")109 .append_child(pugi::node_pcdata)110 .set_value(Helper::ToString(iter->second.warning).c_str());111 112 node_entry.append_child("Total")113 .append_child(pugi::node_pcdata)114 .set_value(Helper::ToString(iter->second.total).c_str());115 116 }117 118 return node_process;119 }120 121 std::string Timer::ToString()122 {123 pugi::xml_node node = Timer::ToXMLNode();124 std::stringstream str;125 node.print(str);126 return str.str();127 }128 129 void Timer::Print()130 {131 #ifdef DEBUG_MEASURE_TIME132 std::map<std::string, TimerData>::const_iterator iter;133 Comm& comm = *MG::GetComm();134 135 if (comm.GlobalRank() == 0) {136 comm.PrintStringOnce("Running times:");137 for (iter=Timer::td.begin(); iter!=Timer::td.end(); ++iter)138 comm.PrintStringOnce(" %s: %e s (%d)", iter->first.c_str(), iter->second.duration, iter->second.total);139 }140 #endif141 }142 143 54 template <class T> 144 55 static T min(T* data, int num_data, int& at_rank) … … 179 90 } 180 91 92 void Timer::Start(std::string event) 93 { 94 #ifdef HAVE_MPI 95 #ifdef OUTPUT_TIMING 96 std::map<std::string, TimerData>::iterator iter = td.find(event); 97 if (iter == td.end()) 98 iter = td.insert(std::make_pair(event, TimerData())).first; 99 100 iter->second.time_start = MPI_Wtime(); 101 #endif 102 #endif 103 } 104 105 void Timer::Stop(std::string event) 106 { 107 #ifdef HAVE_MPI 108 #ifdef OUTPUT_TIMING 109 double time_end = MPI_Wtime(); 110 111 std::map<std::string, TimerData>::iterator iter = td.find(event); 112 113 if (time_end - iter->second.time_start < std::numeric_limits<double>::min()) 114 ++(iter->second.warning); 115 116 ++(iter->second.total); 117 118 iter->second.duration += time_end - iter->second.time_start; 119 #endif 120 #endif 121 } 122 123 void Timer::Clear() 124 { 125 td.clear(); 126 } 127 128 pugi::xml_node Timer::ToXMLNode() 129 { 130 std::map<std::string, TimerData>::iterator iter; 131 132 pugi::xml_node node_process; 133 node_process.append_attribute("Rank").set_value(MG::GetComm()->GlobalRank()); 134 135 pugi::xml_node node_timings = node_process.append_child("Timings"); 136 137 for (iter=Timer::td.begin(); iter!=Timer::td.end(); ++iter) { 138 139 pugi::xml_node node_entry = node_timings.append_child("Sample"); 140 node_entry.append_attribute("Name").set_value(Helper::ToString(iter->first).c_str()); 141 142 node_entry.append_child("Duration") 143 .append_child(pugi::node_pcdata) 144 .set_value(Helper::ToString(iter->second.duration).c_str()); 145 146 node_entry.append_child("Warnings") 147 .append_child(pugi::node_pcdata) 148 .set_value(Helper::ToString(iter->second.warning).c_str()); 149 150 node_entry.append_child("Total") 151 .append_child(pugi::node_pcdata) 152 .set_value(Helper::ToString(iter->second.total).c_str()); 153 154 } 155 156 return node_process; 157 } 158 159 std::string Timer::ToString() 160 { 161 pugi::xml_node node = Timer::ToXMLNode(); 162 std::stringstream str; 163 node.print(str); 164 return str.str(); 165 } 166 167 void Timer::Print() 168 { 169 #ifdef OUTPUT_TIMING 170 Comm& comm = *MG::GetComm(); 171 if (comm.GlobalRank() == 0) { 172 std::map<std::string, TimerData>::const_iterator iter; 173 comm.PrintOnce(Timing, "Running times:"); 174 for (iter=Timer::td.begin(); iter!=Timer::td.end(); ++iter) 175 comm.PrintOnce(Timing, " %s: %e s (%d)", iter->first.c_str(), iter->second.duration, iter->second.total); 176 } 177 #endif 178 } 181 179 void Timer::PrintGlobal() 182 180 { 183 #ifdef DEBUG_MEASURE_TIME181 #ifdef OUTPUT_TIMING 184 182 std::map<std::string, TimerData>::const_iterator iter; 185 183 Comm& comm = *MG::GetComm(); … … 192 190 int calls[size]; 193 191 194 comm.Print StringOnce("Running times (global):");192 comm.PrintOnce(Timing, "Running times (global):"); 195 193 196 194 int timer_size = Timer::td.size(); … … 216 214 avg_calls = avg(calls, size); 217 215 218 comm.Print StringOnce(" %s: %e s (%d)", iter->first.c_str(), iter->second.duration, iter->second.total);219 comm.Print StringOnce(" Min: %e s @ %d", min_duration, rank_min_duration);220 comm.Print StringOnce(" Max: %e s @ %d", max_duration, rank_max_duration);221 comm.Print StringOnce(" Avg: %e s", avg_duration);222 comm.Print StringOnce(" Min calls: %d @ %d", min_calls, rank_min_calls);223 comm.Print StringOnce(" Max calls: %d @ %d", max_calls, rank_max_calls);224 comm.Print StringOnce(" Avg calls: %f", avg_calls);216 comm.PrintOnce(Timing, " %s: %e s (%d)", iter->first.c_str(), iter->second.duration, iter->second.total); 217 comm.PrintOnce(Timing, " Min: %e s @ %d", min_duration, rank_min_duration); 218 comm.PrintOnce(Timing, " Max: %e s @ %d", max_duration, rank_max_duration); 219 comm.PrintOnce(Timing, " Avg: %e s", avg_duration); 220 comm.PrintOnce(Timing, " Min calls: %d @ %d", min_calls, rank_min_calls); 221 comm.PrintOnce(Timing, " Max calls: %d @ %d", max_calls, rank_max_calls); 222 comm.PrintOnce(Timing, " Avg calls: %f", avg_calls); 225 223 } 226 224 }else { -
src/comm/comm.hpp
r5ba22b rd13e27 102 102 virtual void LevelSumArray(const Grid& grid, vmg_int* array, const vmg_int& size) {} 103 103 104 virtual void PrintString(const char* format, ...) = 0; 105 virtual void PrintStringOnce(const char* format, ...) = 0; 104 virtual void Print(const OutputLevel level, const char* format, ...) = 0; 105 virtual void PrintOnce(const OutputLevel level, const char* format, ...) = 0; 106 106 107 virtual void PrintXML(const std::string& filename, const std::string& xml_data) = 0; 107 108 virtual void PrintXMLAll(const std::string& filename, const std::string& xml_data) = 0; -
src/comm/comm_mpi.cpp
r5ba22b rd13e27 344 344 } 345 345 346 void CommMPI::PrintString(const char* format, ...) 347 { 348 va_list args; 349 va_start(args, format); 350 vsprintf(print_buffer, format, args); 351 printf("VMG: Rank %d: %s\n", GlobalRank(), print_buffer); 352 va_end(args); 353 } 354 355 void CommMPI::PrintStringOnce(const char* format, ...) 356 { 357 if (GlobalRank() == 0) { 346 void CommMPI::Print(const OutputLevel level, const char* format, ...) 347 { 348 bool print = (level == Output); 349 350 #ifdef OUTPUT_INFO 351 print |= (level == Info); 352 #endif 353 #ifdef OUTPUT_DEBUG 354 print |= (level == Debug); 355 #endif 356 #ifdef OUTPUT_TIMING 357 print |= (level == Timing); 358 #endif 359 360 if (print) { 361 va_list args; 362 va_start(args, format); 363 vsprintf(print_buffer, format, args); 364 printf("VMG: Rank %d: %s\n", GlobalRank(), print_buffer); 365 va_end(args); 366 } 367 } 368 369 void CommMPI::PrintOnce(const OutputLevel level, const char* format, ...) 370 { 371 bool print = (level == Output); 372 373 #ifdef OUTPUT_INFO 374 print |= (level == Info); 375 #endif 376 #ifdef OUTPUT_DEBUG 377 print |= (level == Debug); 378 #endif 379 #ifdef OUTPUT_TIMING 380 print |= (level == Timing); 381 #endif 382 383 if (GlobalRank() == 0 && print) { 358 384 va_list args; 359 385 va_start(args, format); … … 900 926 } 901 927 902 #ifdef DEBUG_OUTPUT928 #ifdef OUTPUT_DEBUG 903 929 if (rank == 0) 904 std::printf(" Dims: %d %d %d\n", dims[0], dims[1], dims[2]);930 std::printf("Process grid: %d %d %d\n", dims[0], dims[1], dims[2]); 905 931 #endif 906 932 -
src/comm/comm_mpi.hpp
r5ba22b rd13e27 117 117 void LevelSumArray(const Grid& grid, vmg_int* array, const vmg_int& size); 118 118 119 void PrintString(const char* format, ...); 120 void PrintStringOnce(const char* format, ...); 119 void Print(const OutputLevel level, const char* format, ...); 120 void PrintOnce(const OutputLevel level, const char* format, ...); 121 121 122 void PrintXML(const std::string& filename, const std::string& xml_data); 122 123 void PrintXMLAll(const std::string& filename, const std::string& xml_data); -
src/comm/comm_serial.cpp
r5ba22b rd13e27 126 126 127 127 } 128 129 #ifdef DEBUG_MATRIX_CHECKS130 grid.IsConsistent();131 #endif132 128 } 133 129 … … 168 164 169 165 } 170 171 #ifdef DEBUG_MATRIX_CHECKS172 grid.IsConsistent();173 #endif174 166 } 175 167 … … 192 184 } 193 185 194 void CommSerial::PrintString(const char* format, ...) 195 { 196 va_list args; 197 va_start(args, format); 198 vsprintf(print_buffer, format, args); 199 printf("VMG: %s\n", print_buffer); 200 va_end(args); 201 } 202 203 void CommSerial::PrintStringOnce(const char* format, ...) 204 { 205 va_list args; 206 va_start(args, format); 207 vsprintf(print_buffer, format, args); 208 printf("VMG: %s\n", print_buffer); 209 va_end(args); 186 void CommSerial::Print(const OutputLevel level, const char* format, ...) 187 { 188 bool print = (level == Output); 189 190 #ifdef OUTPUT_INFO 191 print |= (level == Info); 192 #endif 193 #ifdef OUTPUT_DEBUG 194 print |= (level == Debug); 195 #endif 196 #ifdef OUTPUT_TIMING 197 print |= (level == Timing); 198 #endif 199 200 if (print) { 201 va_list args; 202 va_start(args, format); 203 vsprintf(print_buffer, format, args); 204 printf("VMG: %s\n", print_buffer); 205 va_end(args); 206 } 207 } 208 209 void CommSerial::PrintOnce(const OutputLevel level, const char* format, ...) 210 { 211 bool print = (level == Output); 212 213 #ifdef OUTPUT_INFO 214 print |= (level == Info); 215 #endif 216 #ifdef OUTPUT_DEBUG 217 print |= (level == Debug); 218 #endif 219 #ifdef OUTPUT_TIMING 220 print |= (level == Timing); 221 #endif 222 223 if (print) { 224 va_list args; 225 va_start(args, format); 226 vsprintf(print_buffer, format, args); 227 printf("VMG: %s\n", print_buffer); 228 va_end(args); 229 } 210 230 } 211 231 … … 497 517 498 518 if (!out.good()) { 499 #ifdef DEBUG_OUTPUT 500 printf("Multigrid: File %s not accessible.\n", path_str); 501 #endif /* DEBUG_OUTPUT */ 519 Print(Info, "File %s not accessible.", path_str); 502 520 return; 503 521 } -
src/comm/comm_serial.hpp
r5ba22b rd13e27 64 64 void CommFromGhostsAsyncFinish(Grid& grid); 65 65 66 void Print String(const char* format, ...);67 void Print StringOnce(const char* format, ...);66 void Print(const OutputLevel level, const char* format, ...); 67 void PrintOnce(const OutputLevel level, const char* format, ...); 68 68 void PrintXML(const std::string& filename, const std::string& xml_data); 69 69 void PrintXMLAll(const std::string& filename, const std::string& xml_data); -
src/commands/com_check_relative_residual.cpp
r5ba22b rd13e27 56 56 const vmg_float rel_res = std::fabs(res / init_res); 57 57 58 #ifdef DEBUG_OUTPUT 59 MG::GetComm()->PrintStringOnce("Relative residual: %e", rel_res); 60 #endif /* DEBUG_OUTPUT */ 58 MG::GetComm()->PrintOnce(Info, "Relative residual: %e", rel_res); 61 59 62 60 MPE_EVENT_END() -
src/commands/com_initialize_residual_norm.cpp
r5ba22b rd13e27 49 49 new ObjectStorage<vmg_float>(arguments[0], residual); 50 50 51 #ifdef DEBUG_OUTPUT 52 MG::GetComm()->PrintStringOnce("Initial residual: %e", residual); 53 #endif /* DEBUG_OUTPUT */ 51 MG::GetComm()->PrintOnce(Info, "Initial residual: %e", residual); 54 52 55 53 MPE_EVENT_END() -
src/commands/com_print_residual_norm.cpp
r5ba22b rd13e27 47 47 Request Run(Command::argument_vector arguments) 48 48 { 49 50 #ifdef OUTPUT_DEBUG 49 51 MPE_EVENT_BEGIN() 50 52 … … 55 57 if ((*sol)(sol->MaxLevel()).IsActive()) { 56 58 vmg_float residual = comm->ComputeResidualNorm(*sol, *rhs); 57 comm->Print StringOnce("Residual: %e", residual);59 comm->PrintOnce(Debug, "Residual: %e", residual); 58 60 } 59 61 60 62 MPE_EVENT_END() 63 #endif 61 64 62 65 return Continue; -
src/grid/grid.cpp
r5ba22b rd13e27 131 131 avg /= Global().GlobalSize().Product(); 132 132 133 #ifdef DEBUG_OUTPUT 134 MG::GetComm()->PrintStringOnce("Global constraint enforcement: %e", avg); 135 #endif 133 MG::GetComm()->PrintOnce(Info, "Global constraint enforcement: %e", avg); 136 134 137 135 if (std::abs(avg) > std::numeric_limits<vmg_float>::epsilon()) … … 152 150 if (std::abs(val) > std::numeric_limits<vmg_float>::epsilon()) { 153 151 154 #ifdef DEBUG_OUTPUT 155 MG::GetComm()->PrintStringOnce("WARNING: Right hand side does not satisfy the compatibility condition."); 156 #endif 152 MG::GetComm()->PrintOnce(Info, "Right hand side does not satisfy the compatibility condition. Trying to enforce."); 157 153 158 154 for (iter = Iterators().Local().Begin(); iter != Iterators().Local().End(); ++iter) 159 155 (*this)(*iter) -= val; 160 156 161 #ifdef DEBUG_OUTPUT157 #ifdef OUPUT_DEBUG 162 158 val = 0.0; 163 159 for (iter = Iterators().Local().Begin(); iter != Iterators().Local().End(); ++iter) 164 160 val += GetVal(*iter); 165 161 val = MG::GetComm()->GlobalSumRoot(val); 166 MG::GetComm()->PrintStringOnce("Sum of grid charges after forcing the discrete compatibility condition: %e", val); 167 #endif 168 } 169 162 MG::GetComm()->PrintOnce(Debug, "Sum of grid charges after forcing the discrete compatibility condition: %e", val); 163 #endif 164 } 170 165 } 171 166 -
src/mg.cpp
r5ba22b rd13e27 33 33 #endif 34 34 35 #ifdef DEBUG_MEASURE_TIME35 #ifdef OUTPUT_TIMING 36 36 #ifdef HAVE_MPI 37 37 #include <mpi.h> … … 161 161 void MG::Solve() 162 162 { 163 #ifdef DEBUG_MEASURE_TIME 164 #ifdef HAVE_MPI 163 #ifdef OUTPUT_TIMING 165 164 GetComm()->Barrier(); 166 #endif167 165 Timer::Start("CompleteRunningTime"); 168 166 #endif … … 178 176 cl_finalize->ExecuteList(); 179 177 180 #ifdef DEBUG_MEASURE_TIME 181 #ifdef HAVE_MPI 178 #ifdef OUTPUT_TIMING 182 179 GetComm()->Barrier(); 183 #endif184 180 Timer::Stop("CompleteRunningTime"); 185 #ifdef DEBUG_MEASURE_TIME_OUTPUT186 181 #ifdef HAVE_MPI 187 182 Timer::PrintGlobal(); 188 183 #else 189 184 Timer::Print(); 190 #endif191 185 #endif 192 186 #endif -
src/units/particle/interface_fcs.cpp
r5ba22b rd13e27 227 227 MG::Solve(); 228 228 229 #ifdef DEBUG_MEASURE_TIME230 229 Timer::Print(); 231 #endif232 230 } 233 231 -
src/units/particle/interface_particles.cpp
r5ba22b rd13e27 86 86 std::list<Particle::Particle>::iterator iter; 87 87 88 #ifdef DEBUG_OUTPUT88 #ifdef OUTPUT_DEBUG 89 89 vmg_float particle_charges = 0.0; 90 90 for (iter=particles.begin(); iter!=particles.end(); ++iter) 91 91 particle_charges += iter->Charge(); 92 92 particle_charges = MG::GetComm()->GlobalSumRoot(particle_charges); 93 comm.Print StringOnce("Particle list charge sum: %e", particle_charges);94 comm.Print String("Local number of particles: %d", particles.size());93 comm.PrintOnce(Debug, "Particle list charge sum: %e", particle_charges); 94 comm.Print(Debug, "Local number of particles: %d", particles.size()); 95 95 #endif 96 96 … … 112 112 particle_grid.Local().Begin().Z() + k); 113 113 114 #ifdef DEBUG_OUTPUT114 #ifdef OUTPUT_DEBUG 115 115 Grid::iterator grid_iter; 116 116 vmg_float charge_sum = 0.0; … … 118 118 charge_sum += grid.GetVal(*grid_iter); 119 119 charge_sum = MG::GetComm()->GlobalSum(charge_sum); 120 comm.Print StringOnce("Grid charge sum: %e", charge_sum);120 comm.PrintOnce(Debug, "Grid charge sum: %e", charge_sum); 121 121 #endif 122 122 } … … 126 126 Index i; 127 127 128 #ifdef DEBUG_OUTPUT128 #ifdef OUTPUT_DEBUG 129 129 vmg_float e = 0.0; 130 130 vmg_float e_long = 0.0; … … 185 185 (*p1)->Pot() -= (*p1)->Charge() * spl.GetAntiDerivativeAtZero(); 186 186 187 #ifdef DEBUG_OUTPUT187 #ifdef OUTPUT_DEBUG 188 188 e_long += 0.5 * (*p1)->Charge() * ip.EvaluatePotentialLR(**p1); 189 189 e_self += 0.5 * (*p1)->Charge() * (*p1)->Charge() * spl.GetAntiDerivativeAtZero(); … … 206 206 (*p1)->Field() += (*p2)->Charge() * dir * spl.EvaluateField(length); 207 207 208 #ifdef DEBUG_OUTPUT208 #ifdef OUTPUT_DEBUG 209 209 e_short_peak += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length; 210 210 e_short_spline += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length * spl.EvaluatePotential(length); … … 229 229 comm.CommParticlesBack(particles); 230 230 231 #ifdef DEBUG_OUTPUT231 #ifdef OUTPUT_DEBUG 232 232 vmg_float* q = factory.GetObjectStorageArray<vmg_float>("PARTICLE_CHARGE_ARRAY"); 233 233 const vmg_int& num_particles_local = factory.GetObjectStorageVal<vmg_int>("PARTICLE_NUM_LOCAL"); … … 245 245 e = comm.GlobalSumRoot(e); 246 246 247 comm.PrintStringOnce("E_long: %e", e_long); 248 comm.PrintStringOnce("E_short_peak: %e", e_short_peak); 249 comm.PrintStringOnce("E_short_spline: %e", e_short_spline); 250 comm.PrintStringOnce("E_self: %e", e_self); 251 comm.PrintStringOnce("E_total: %e", e); 252 comm.PrintStringOnce("E_total*: %e", e_long + e_short_peak + e_short_spline - e_self); 253 254 #endif /* DEBUG_OUTPUT */ 255 247 comm.PrintOnce(Debug, "E_long: %e", e_long); 248 comm.PrintOnce(Debug, "E_short_peak: %e", e_short_peak); 249 comm.PrintOnce(Debug, "E_short_spline: %e", e_short_spline); 250 comm.PrintOnce(Debug, "E_self: %e", e_self); 251 comm.PrintOnce(Debug, "E_total: %e", e); 252 comm.PrintOnce(Debug, "E_total*: %e", e_long + e_short_peak + e_short_spline - e_self); 253 #endif 256 254 }
Note:
See TracChangeset
for help on using the changeset viewer.
