Changeset d13e27


Ignore:
Timestamp:
Mar 29, 2013, 5:03:13 PM (13 years ago)
Author:
Julian Iseringhausen <isering@…>
Children:
f57182
Parents:
5ba22b
Message:

vmg: Work on output verbosity.

git-svn-id: https://svn.version.fz-juelich.de/scafacos/trunk@2845 5161e1c8-67bf-11de-9fd5-51895aff932f

Files:
18 edited

Legend:

Unmodified
Added
Removed
  • configure.ac

    r5ba22b rd13e27  
    1919AC_LANG([C++])
    2020
    21 # switch for one-sided communications
     21# Release version switch
     22AC_MSG_CHECKING(whether to enable release version)
     23AC_ARG_ENABLE([release],
     24        AS_HELP_STRING([--enable-release], [Compile with release settings]),
     25        enable_release=$enableval,
     26        enable_release="no")
     27AC_MSG_RESULT($enable_release)
     28AS_IF([test "$enable_release" = "yes"], [
     29            AC_DEFINE([RELEASE], [1], [Release])
     30            AC_DEFINE([NDEBUG], [1], [Skip asserts])
     31])
     32
     33# One-sided communications
    2234AC_MSG_CHECKING(whether to enable one-sided MPI2 communications)
    2335AC_ARG_ENABLE([one_sided],
     
    3042])
    3143
    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
     45AC_ARG_VAR(BSPLINE_DEG, [Degree of interpolating B-Splines. Must be in [3-6].])
     46if test -z "$BSPLINE_DEG"
     47then
     48        BSPLINE_DEG=3
     49fi
     50AC_MSG_CHECKING(interpolation b-spline degree)
     51AC_DEFINE_UNQUOTED([BSPLINE_DEGREE], ${BSPLINE_DEG}, [Interpolating B-Spline degree])
     52AC_MSG_RESULT(${BSPLINE_DEG})
     53
     54# Debugging switches
    3755AC_MSG_CHECKING(whether to enable debugging)
    3856AC_ARG_ENABLE([debug],
     
    4462AS_IF([test "$enable_debug" = "yes"], [
    4563            CXXFLAGS=${CXXFLAGS-"-g -O0 -Wall"}
    46             AC_DEFINE([DEBUG], [1], [Debugging output])
     64            AC_DEFINE([DEBUG], [1], [Debugging])
    4765])
    4866
     
    5775])
    5876
    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 
    7077AC_MSG_CHECKING(whether to enable MPE profiling)
    7178AC_ARG_ENABLE([mpe],
     
    7481        enable_mpe="no")
    7582AC_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 ])
    9883
    9984AC_MSG_CHECKING(whether to enable MPI_Barrier debugging)
     
    10792])
    10893
    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
     95AC_MSG_CHECKING(whether to enable info output)
     96AC_ARG_ENABLE([output-info],
     97        AS_HELP_STRING([--enable-output-info], [Enable info output]),
     98        enable_output_info=$enableval,
     99        enable_output_info="no")
     100AS_IF([test "x$enable_fcs_info" != "x"],[enable_output_info="yes"])
     101AC_MSG_RESULT($enable_output_info)
     102AS_IF([test "$enable_output_info" = "yes"], [
     103            AC_DEFINE([OUTPUT_INFO], [1], [Output level info])
     104])
     105
     106AC_MSG_CHECKING(whether to enable debug output)
     107AC_ARG_ENABLE([output-debug],
     108        AS_HELP_STRING([--enable-output-debug], [Enable debug output]),
     109        enable_output_debug=$enableval,
     110        enable_output_debug="no")
     111AS_IF([test "x$enable_fcs_debug" != "x"],[enable_output_debug="yes"])
     112AC_MSG_RESULT($enable_output_debug)
     113AS_IF([test "$enable_output_debug" = "yes"], [
     114            AC_DEFINE([OUTPUT_DEBUG], [1], [Output level debug])
     115])
     116
     117AC_MSG_CHECKING(whether to enable timing output)
     118AC_ARG_ENABLE([output-timing],
     119        AS_HELP_STRING([--enable-output-timing], [Enable timing output]),
     120        enable_output_timing=$enableval,
     121        enable_output_timing="no")
     122AS_IF([test "x$enable_fcs_timing" != "x"],[enable_output_timing="yes"])
     123AC_MSG_RESULT($enable_output_timing)
     124AS_IF([test "$enable_output_timing" = "yes"], [
     125            AC_DEFINE([OUTPUT_TIMING], [1], [Output level timing])
     126])
     127
    130128
    131129# Checks for programs.
  • src/base/command_list.cpp

    r5ba22b rd13e27  
    6363#ifdef DEBUG_BARRIER
    6464    Comm& comm = *MG::GetComm();
    65 #ifdef HAVE_MPI
    6665    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());
    6967#endif
    7068
     
    7472
    7573#ifdef DEBUG_BARRIER
    76 #ifdef HAVE_MPI
    7774    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());
    8076#endif
    8177
  • src/base/defs.hpp

    r5ba22b rd13e27  
    3434namespace VMG
    3535{
     36
     37/**
     38 * Controls console output
     39 *
     40 */
     41enum OutputLevel {
     42  Output,
     43  Info,
     44  Debug,
     45  Timing
     46};
    3647
    3748/**
  • src/base/factory.cpp

    r5ba22b rd13e27  
    3333
    3434#include "base/command.hpp"
     35#include "base/defs.hpp"
    3536#include "base/discretization.hpp"
    3637#include "base/factory.hpp"
     
    6970    return iter->second;
    7071
    71   MG::GetComm()->PrintStringOnce("Error: Object %s is not registered", id.c_str());
     72  MG::GetComm()->PrintOnce(Debug, "Error: Object %s is not registered", id.c_str());
    7273  assert(0);
    7374
     
    8788void Factory::PrintAvailableObjects()
    8889{
    89   MG::GetComm()->PrintString("Registered objects:");
     90  MG::GetComm()->Print(Debug, "Registered objects:");
    9091  for (std::map<std::string, Object*>::iterator iter=object_map.begin(); iter!=object_map.end(); ++iter)
    91     MG::GetComm()->PrintString("%s", iter->second->Name().c_str());
     92    MG::GetComm()->Print(Debug, "%s", iter->second->Name().c_str());
    9293}
    9394
  • src/base/helper.hpp

    r5ba22b rd13e27  
    7272    str >> val;
    7373
    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;
    8075
    8176    return val;
     
    175170    bool rval = (val1 == val2);
    176171
    177 #ifdef DEBUG_OUTPUT
     172#ifdef DEBUG
    178173    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);
    182175    assert(rval);
     176#endif /* DEBUG */
    183177
    184178    return rval;
  • src/base/timer.cpp

    r5ba22b rd13e27  
    5252std::map<std::string, TimerData> Timer::td;
    5353
    54 void Timer::Start(std::string event)
    55 {
    56 #ifdef HAVE_MPI
    57 #ifdef DEBUG_MEASURE_TIME
    58   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 #endif
    64 #endif
    65 }
    66 
    67 void Timer::Stop(std::string event)
    68 {
    69 #ifdef HAVE_MPI
    70 #ifdef DEBUG_MEASURE_TIME
    71   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 #endif
    82 #endif
    83 }
    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_TIME
    132  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 #endif
    141 }
    142 
    14354template <class T>
    14455static T min(T* data, int num_data, int& at_rank)
     
    17990}
    18091
     92void 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
     105void 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
     123void Timer::Clear()
     124{
     125  td.clear();
     126}
     127
     128pugi::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
     159std::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
     167void 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}
    181179void Timer::PrintGlobal()
    182180{
    183 #ifdef DEBUG_MEASURE_TIME
     181#ifdef OUTPUT_TIMING
    184182  std::map<std::string, TimerData>::const_iterator iter;
    185183  Comm& comm = *MG::GetComm();
     
    192190  int calls[size];
    193191
    194   comm.PrintStringOnce("Running times (global):");
     192  comm.PrintOnce(Timing, "Running times (global):");
    195193
    196194  int timer_size = Timer::td.size();
     
    216214        avg_calls = avg(calls, size);
    217215
    218         comm.PrintStringOnce("  %s: %e s (%d)", iter->first.c_str(), iter->second.duration, iter->second.total);
    219         comm.PrintStringOnce("    Min: %e s @ %d", min_duration, rank_min_duration);
    220         comm.PrintStringOnce("    Max: %e s @ %d", max_duration, rank_max_duration);
    221         comm.PrintStringOnce("    Avg: %e s", avg_duration);
    222         comm.PrintStringOnce("    Min calls: %d @ %d", min_calls, rank_min_calls);
    223         comm.PrintStringOnce("    Max calls: %d @ %d", max_calls, rank_max_calls);
    224         comm.PrintStringOnce("    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);
    225223    }
    226224  }else {
  • src/comm/comm.hpp

    r5ba22b rd13e27  
    102102  virtual void LevelSumArray(const Grid& grid, vmg_int* array, const vmg_int& size) {}
    103103
    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
    106107  virtual void PrintXML(const std::string& filename, const std::string& xml_data) = 0;
    107108  virtual void PrintXMLAll(const std::string& filename, const std::string& xml_data) = 0;
  • src/comm/comm_mpi.cpp

    r5ba22b rd13e27  
    344344}
    345345
    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) {
     346void 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
     369void 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) {
    358384    va_list args;
    359385    va_start(args, format);
     
    900926    }
    901927
    902 #ifdef DEBUG_OUTPUT
     928#ifdef OUTPUT_DEBUG
    903929    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]);
    905931#endif
    906932
  • src/comm/comm_mpi.hpp

    r5ba22b rd13e27  
    117117  void LevelSumArray(const Grid& grid,  vmg_int* array, const vmg_int& size);
    118118
    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
    121122  void PrintXML(const std::string& filename, const std::string& xml_data);
    122123  void PrintXMLAll(const std::string& filename, const std::string& xml_data);
  • src/comm/comm_serial.cpp

    r5ba22b rd13e27  
    126126
    127127  }
    128 
    129 #ifdef DEBUG_MATRIX_CHECKS
    130   grid.IsConsistent();
    131 #endif
    132128}
    133129
     
    168164
    169165  }
    170 
    171 #ifdef DEBUG_MATRIX_CHECKS
    172   grid.IsConsistent();
    173 #endif
    174166}
    175167
     
    192184}
    193185
    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);
     186void 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
     209void 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  }
    210230}
    211231
     
    497517
    498518  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);
    502520    return;
    503521  }
  • src/comm/comm_serial.hpp

    r5ba22b rd13e27  
    6464  void CommFromGhostsAsyncFinish(Grid& grid);
    6565
    66   void PrintString(const char* format, ...);
    67   void PrintStringOnce(const char* format, ...);
     66  void Print(const OutputLevel level, const char* format, ...);
     67  void PrintOnce(const OutputLevel level, const char* format, ...);
    6868  void PrintXML(const std::string& filename, const std::string& xml_data);
    6969  void PrintXMLAll(const std::string& filename, const std::string& xml_data);
  • src/commands/com_check_relative_residual.cpp

    r5ba22b rd13e27  
    5656    const vmg_float rel_res = std::fabs(res / init_res);
    5757
    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);
    6159
    6260    MPE_EVENT_END()
  • src/commands/com_initialize_residual_norm.cpp

    r5ba22b rd13e27  
    4949    new ObjectStorage<vmg_float>(arguments[0], residual);
    5050
    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);
    5452
    5553    MPE_EVENT_END()
  • src/commands/com_print_residual_norm.cpp

    r5ba22b rd13e27  
    4747  Request Run(Command::argument_vector arguments)
    4848  {
     49
     50#ifdef OUTPUT_DEBUG
    4951    MPE_EVENT_BEGIN()
    5052
     
    5557    if ((*sol)(sol->MaxLevel()).IsActive()) {
    5658      vmg_float residual = comm->ComputeResidualNorm(*sol, *rhs);
    57       comm->PrintStringOnce("Residual: %e", residual);
     59      comm->PrintOnce(Debug, "Residual: %e", residual);
    5860    }
    5961
    6062    MPE_EVENT_END()
     63#endif
    6164
    6265    return Continue;
  • src/grid/grid.cpp

    r5ba22b rd13e27  
    131131  avg /= Global().GlobalSize().Product();
    132132
    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);
    136134
    137135  if (std::abs(avg) > std::numeric_limits<vmg_float>::epsilon())
     
    152150  if (std::abs(val) > std::numeric_limits<vmg_float>::epsilon()) {
    153151
    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.");
    157153
    158154    for (iter = Iterators().Local().Begin(); iter != Iterators().Local().End(); ++iter)
    159155      (*this)(*iter) -= val;
    160156
    161 #ifdef DEBUG_OUTPUT
     157#ifdef OUPUT_DEBUG
    162158    val = 0.0;
    163159    for (iter = Iterators().Local().Begin(); iter != Iterators().Local().End(); ++iter)
    164160      val += GetVal(*iter);
    165161    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  }
    170165}
    171166
  • src/mg.cpp

    r5ba22b rd13e27  
    3333#endif
    3434
    35 #ifdef DEBUG_MEASURE_TIME
     35#ifdef OUTPUT_TIMING
    3636#ifdef HAVE_MPI
    3737#include <mpi.h>
     
    161161void MG::Solve()
    162162{
    163 #ifdef DEBUG_MEASURE_TIME
    164 #ifdef HAVE_MPI
     163#ifdef OUTPUT_TIMING
    165164  GetComm()->Barrier();
    166 #endif
    167165  Timer::Start("CompleteRunningTime");
    168166#endif
     
    178176  cl_finalize->ExecuteList();
    179177
    180 #ifdef DEBUG_MEASURE_TIME
    181 #ifdef HAVE_MPI
     178#ifdef OUTPUT_TIMING
    182179  GetComm()->Barrier();
    183 #endif
    184180  Timer::Stop("CompleteRunningTime");
    185 #ifdef DEBUG_MEASURE_TIME_OUTPUT
    186181#ifdef HAVE_MPI
    187182  Timer::PrintGlobal();
    188183#else
    189184  Timer::Print();
    190 #endif
    191185#endif
    192186#endif
  • src/units/particle/interface_fcs.cpp

    r5ba22b rd13e27  
    227227  MG::Solve();
    228228
    229 #ifdef DEBUG_MEASURE_TIME
    230229  Timer::Print();
    231 #endif
    232230}
    233231
  • src/units/particle/interface_particles.cpp

    r5ba22b rd13e27  
    8686  std::list<Particle::Particle>::iterator iter;
    8787
    88 #ifdef DEBUG_OUTPUT
     88#ifdef OUTPUT_DEBUG
    8989  vmg_float particle_charges = 0.0;
    9090  for (iter=particles.begin(); iter!=particles.end(); ++iter)
    9191    particle_charges += iter->Charge();
    9292  particle_charges = MG::GetComm()->GlobalSumRoot(particle_charges);
    93   comm.PrintStringOnce("Particle list charge sum: %e", particle_charges);
    94   comm.PrintString("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());
    9595#endif
    9696
     
    112112                               particle_grid.Local().Begin().Z() + k);
    113113
    114 #ifdef DEBUG_OUTPUT
     114#ifdef OUTPUT_DEBUG
    115115  Grid::iterator grid_iter;
    116116  vmg_float charge_sum = 0.0;
     
    118118    charge_sum += grid.GetVal(*grid_iter);
    119119  charge_sum = MG::GetComm()->GlobalSum(charge_sum);
    120   comm.PrintStringOnce("Grid charge sum: %e", charge_sum);
     120  comm.PrintOnce(Debug, "Grid charge sum: %e", charge_sum);
    121121#endif
    122122}
     
    126126  Index i;
    127127
    128 #ifdef DEBUG_OUTPUT
     128#ifdef OUTPUT_DEBUG
    129129  vmg_float e = 0.0;
    130130  vmg_float e_long = 0.0;
     
    185185          (*p1)->Pot() -= (*p1)->Charge() * spl.GetAntiDerivativeAtZero();
    186186
    187 #ifdef DEBUG_OUTPUT
     187#ifdef OUTPUT_DEBUG
    188188          e_long += 0.5 * (*p1)->Charge() * ip.EvaluatePotentialLR(**p1);
    189189          e_self += 0.5 * (*p1)->Charge() * (*p1)->Charge() * spl.GetAntiDerivativeAtZero();
     
    206206                      (*p1)->Field() += (*p2)->Charge() * dir * spl.EvaluateField(length);
    207207
    208 #ifdef DEBUG_OUTPUT
     208#ifdef OUTPUT_DEBUG
    209209                      e_short_peak += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length;
    210210                      e_short_spline += 0.5 * (*p1)->Charge() * (*p2)->Charge() / length * spl.EvaluatePotential(length);
     
    229229  comm.CommParticlesBack(particles);
    230230
    231 #ifdef DEBUG_OUTPUT
     231#ifdef OUTPUT_DEBUG
    232232  vmg_float* q = factory.GetObjectStorageArray<vmg_float>("PARTICLE_CHARGE_ARRAY");
    233233  const vmg_int& num_particles_local = factory.GetObjectStorageVal<vmg_int>("PARTICLE_NUM_LOCAL");
     
    245245  e = comm.GlobalSumRoot(e);
    246246
    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
    256254}
Note: See TracChangeset for help on using the changeset viewer.