Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Allow units in smpi factors.
authordegomme <adegomme@users.noreply.github.com>
Mon, 15 Apr 2019 09:12:48 +0000 (11:12 +0200)
committerdegomme <adegomme@users.noreply.github.com>
Mon, 15 Apr 2019 09:12:48 +0000 (11:12 +0200)
To make it optional (as parse_factor is used for actual factors and not only seconds on some occasions), remove the warning in surf if a unit-less value is used.

src/smpi/internals/smpi_utils.cpp
src/surf/xml/surfxml_sax_cb.cpp

index ddde90d..931d3ec 100644 (file)
@@ -8,6 +8,7 @@
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 #include <boost/tokenizer.hpp>
 #include "xbt/log.h"
 #include "xbt/sysdep.h"
 #include <boost/tokenizer.hpp>
+#include "src/surf/xml/platf_private.hpp"
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)");
 
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(smpi_utils, smpi, "Logging specific to SMPI (utils)");
 
@@ -48,7 +49,7 @@ std::vector<s_smpi_factor_t> parse_factor(const std::string& smpi_coef_string)
         }
       } else {
         try {
         }
       } else {
         try {
-          fact.values.push_back(std::stod(*factor_iter));
+          fact.values.push_back(surf_parse_get_time((*factor_iter).c_str(), "smpi factor", std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter));
         } catch (std::invalid_argument& ia) {
           throw std::invalid_argument(std::string("Invalid factor value ") + std::to_string(iteration) + " in chunk " +
                                       std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter);
         } catch (std::invalid_argument& ia) {
           throw std::invalid_argument(std::string("Invalid factor value ") + std::to_string(iteration) + " in chunk " +
                                       std::to_string(smpi_factor.size() + 1) + ": " + *factor_iter);
index 26046c6..e57ae9f 100644 (file)
@@ -183,10 +183,6 @@ double surf_parse_get_value_with_unit(const char* string, const unit_scale& unit
   if (ptr == string)
     surf_parse_error(std::string("cannot parse number:") + string);
   if (ptr[0] == '\0') {
   if (ptr == string)
     surf_parse_error(std::string("cannot parse number:") + string);
   if (ptr[0] == '\0') {
-    if (res == 0)
-      return res; // Ok, 0 can be unit-less
-
-    XBT_WARN("Deprecated unit-less value '%s' for %s %s. %s", string, entity_kind, name.c_str(), error_msg);
     ptr = (char*)default_unit;
   }
   auto u = units.find(ptr);
     ptr = (char*)default_unit;
   }
   auto u = units.find(ptr);