Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[Energy] Missing power profiles for a host defaulted to 0
authorclement-dell <clement.mommessin@inria.fr>
Tue, 8 Oct 2019 13:45:02 +0000 (15:45 +0200)
committerclement-dell <clement.mommessin@inria.fr>
Tue, 8 Oct 2019 13:45:02 +0000 (15:45 +0200)
SG will not complain with an assert as long as this host is not used

src/plugins/host_energy.cpp

index b596892..a5543c4 100644 (file)
@@ -394,9 +394,17 @@ void HostEnergy::init_watts_range_list()
     XBT_WARN("%s", msg.c_str());
     return;
   }
     XBT_WARN("%s", msg.c_str());
     return;
   }
+
   const char* all_power_values_str = host_->get_property("wattage_per_state");
   const char* all_power_values_str = host_->get_property("wattage_per_state");
-  if (all_power_values_str == nullptr)
+  if (all_power_values_str == nullptr) {
+    /* If no power values are given, we assume it's 0 everywhere */
+    XBT_DEBUG("No energetic profiles given for host %s, using 0 W by default.", host_->get_cname());
+    for (int i = 0; i < host_->get_pstate_count(); ++i) {
+        PowerRange range(0,0,0);
+        power_range_watts_list_.push_back(range);
+    }
     return;
     return;
+  }
 
   std::vector<std::string> all_power_values;
   boost::split(all_power_values, all_power_values_str, boost::is_any_of(","));
 
   std::vector<std::string> all_power_values;
   boost::split(all_power_values, all_power_values_str, boost::is_any_of(","));