Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
host_energy: rework the code converting the old syntax to the new one
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 7 Oct 2019 15:27:28 +0000 (17:27 +0200)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Mon, 7 Oct 2019 19:47:37 +0000 (21:47 +0200)
Write it very similarly to the python script provided in the MR.

Just because I don't trust myself with this conversion code.

src/plugins/host_energy.cpp

index f1167b8..a6e0d76 100644 (file)
@@ -343,20 +343,30 @@ void HostEnergy::init_watts_range_list()
       double p_full;
       double p_epsilon;
 
-      if (current_power_values.size() == 2) { // Case: Idle:AllCores
-        p_full    = xbt_str_parse_double((current_power_values.at(1)).c_str(),
+      if (current_power_values.size() == 3) {
+        p_idle     = xbt_str_parse_double((current_power_values.at(0)).c_str(),
                                       "Invalid obsolete XML file. Fix your watt_per_state property.");
-        p_epsilon = p_full;
-      } else { // Case: Idle:Epsilon:AllCores
         p_one_core = xbt_str_parse_double((current_power_values.at(1)).c_str(),
                                           "Invalid obsolete XML file. Fix your watt_per_state property.");
         p_full     = xbt_str_parse_double((current_power_values.at(2)).c_str(),
                                       "Invalid obsolete XML file. Fix your watt_per_state property.");
-        if (host_->get_core_count() == 1)
+        if (host_->get_core_count() == 1) {
           p_epsilon = p_full;
-        else
+        } else {
           p_epsilon = p_one_core - ((p_full - p_one_core) / (host_->get_core_count() - 1));
+        }
+      } else { // consuption given with idle and full only
+        p_idle = xbt_str_parse_double((current_power_values.at(0)).c_str(),
+                                      "Invalid obsolete XML file. Fix your watt_per_state property.");
+        p_full = xbt_str_parse_double((current_power_values.at(1)).c_str(),
+                                      "Invalid obsolete XML file. Fix your watt_per_state property.");
+        if (host_->get_core_count() == 1) {
+          p_epsilon = p_full;
+        } else {
+          p_epsilon = p_idle;
+        }
       }
+
       PowerRange range(p_idle, p_epsilon, p_full);
       power_range_watts_list_.push_back(range);