Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Use if(false) to comment debugging code, and be sure that it always compiles.
authorArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 21 Jul 2021 13:08:39 +0000 (15:08 +0200)
committerArnaud Giersch <arnaud.giersch@univ-fcomte.fr>
Wed, 21 Jul 2021 21:27:05 +0000 (23:27 +0200)
src/smpi/internals/smpi_deployment.cpp
src/surf/surf_interface.hpp
src/xbt/memory_map.cpp

index 576176b..a095f01 100644 (file)
@@ -24,10 +24,11 @@ public:
   {
     auto* group = new simgrid::smpi::Group(size_);
     comm_world_ = new simgrid::smpi::Comm(group, nullptr, false, -1);
-    //  FIXME : using MPI_Attr_put with MPI_UNIVERSE_SIZE is forbidden and we make it a no-op (which triggers a warning
-    //  as MPI_ERR_ARG is returned). Directly calling Comm::attr_put breaks for now, as MPI_UNIVERSE_SIZE,is <0
-    //  instance.comm_world->attr_put<simgrid::smpi::Comm>(MPI_UNIVERSE_SIZE, reinterpret_cast<void*>(instance.size));
-
+    if (false) {
+      // FIXME : using MPI_Attr_put with MPI_UNIVERSE_SIZE is forbidden and we make it a no-op (which triggers a warning
+      // as MPI_ERR_ARG is returned). Directly calling Comm::attr_put breaks for now, as MPI_UNIVERSE_SIZE,is <0
+      comm_world_->attr_put<simgrid::smpi::Comm>(MPI_UNIVERSE_SIZE, reinterpret_cast<void*>(size_));
+    }
     universe_size += max_no_processes;
   }
 
index af27388..d0d38ae 100644 (file)
@@ -10,6 +10,7 @@
 #include "src/surf/surf_private.hpp"
 #include "xbt/function_types.h"
 
+#include <cfloat>
 #include <cmath>
 #include <functional>
 #include <set>
@@ -41,11 +42,13 @@ inline auto& watched_hosts() // avoid static initialization order fiasco
 
 static inline void double_update(double* variable, double value, double precision)
 {
-  // printf("Updating %g -= %g +- %g\n",*variable,value,precision);
-  // xbt_assert(value==0  || value>precision);
-  // Check that precision is higher than the machine-dependent size of the mantissa. If not, brutal rounding  may
-  // happen, and the precision mechanism is not active...
-  // xbt_assert(*variable< (2<<DBL_MANT_DIG)*precision && FLT_RADIX==2);
+  if (false) { // debug
+    fprintf(stderr, "Updating %g -= %g +- %g\n", *variable, value, precision);
+    xbt_assert(value == 0.0 || value > precision);
+    // Check that precision is higher than the machine-dependent size of the mantissa. If not, brutal rounding  may
+    // happen, and the precision mechanism is not active...
+    xbt_assert(FLT_RADIX == 2 && *variable < precision * exp2(DBL_MANT_DIG));
+  }
   *variable -= value;
   if (*variable < precision)
     *variable = 0.0;
index 98e9bff..b3ea8b1 100644 (file)
@@ -155,11 +155,10 @@ std::vector<VmMap> get_memory_map(pid_t pid)
     if (dladdr(reinterpret_cast<void*>(address), &dlinfo))
       memreg.pathname = dlinfo.dli_fname;
 
-#if 0 /* debug */
-    std::fprintf(stderr, "Region: %016" PRIx64 "-%016" PRIx64 " | %c%c%c | %s\n", memreg.start_addr, memreg.end_addr,
-              (memreg.prot & PROT_READ) ? 'r' : '-', (memreg.prot & PROT_WRITE) ? 'w' : '-',
-              (memreg.prot & PROT_EXEC) ? 'x' : '-', memreg.pathname.c_str());
-#endif
+    if (false) // debug
+      std::fprintf(stderr, "Region: %016" PRIx64 "-%016" PRIx64 " | %c%c%c | %s\n", memreg.start_addr, memreg.end_addr,
+                   (memreg.prot & PROT_READ) ? 'r' : '-', (memreg.prot & PROT_WRITE) ? 'w' : '-',
+                   (memreg.prot & PROT_EXEC) ? 'x' : '-', memreg.pathname.c_str());
 
     ret.push_back(std::move(memreg));
     address += size;
@@ -290,7 +289,8 @@ std::vector<VmMap> get_memory_map(pid_t pid)
 
     /* Create space for a new map region in the region's array and copy the */
     /* parsed stuff from the temporal memreg variable */
-    // std::fprintf(stderr, "Found region for %s\n", not memreg.pathname.empty() ? memreg.pathname.c_str() : "(null)");
+    if (false) // debug
+      std::fprintf(stderr, "Found region for %s\n", not memreg.pathname.empty() ? memreg.pathname.c_str() : "(null)");
 
     ret.push_back(std::move(memreg));
   }