Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[DVFS] Fix the update() method.
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 15 Feb 2018 14:14:00 +0000 (15:14 +0100)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Thu, 1 Mar 2018 12:42:50 +0000 (13:42 +0100)
The update() will be called AFTER a pstate has already
been changed; this implies that we need to keep track
of what pstate was active before the change in order to
update the flops already computed correctly.

src/surf/plugins/host_load.cpp

index 8e3dd94..82668bd 100644 (file)
@@ -72,13 +72,21 @@ void HostLoad::update()
 {
   double now = surf_get_clock();
   if (last_updated < now) {
+    /* flops == pstate_speed * cores_being_currently_used */
+    computed_flops += (now - last_updated) * current_flops;
+
     /* Current flop per second computed by the cpu; current_flops = k * pstate_speed_in_flops, k \in {0, 1, ..., cores}
      * number of active cores */
     current_flops = host->pimpl_cpu->constraint()->get_usage();
 
-    /* flops == pstate_speed * cores_being_currently_used */
-    computed_flops += (now - last_updated) * current_flops;
-    last_updated = now;
+    if (was_prev_idle) {
+      idle_time += (now - last_updated);
+    }
+
+    theor_max_flops += current_speed * host->getCoreCount() * (now - last_updated);
+    current_speed    = host->getSpeed();
+    last_updated     = now;
+    was_prev_idle    = (current_flops == 0);
   }
 }