Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
[SMPI/LB] Normalize load + notify heap of changes
authorChristian Heinrich <franz-christian.heinrich@inria.fr>
Fri, 10 Aug 2018 09:38:24 +0000 (11:38 +0200)
committerChristian Heinrich <franz-christian.heinrich@inria.fr>
Tue, 2 Oct 2018 14:28:39 +0000 (16:28 +0200)
src/smpi/plugins/load_balancer/LoadBalancer.cpp

index a95a116..dde6fa6 100644 (file)
@@ -83,11 +83,14 @@ void LoadBalancer::run()
   for (auto& host : available_hosts) {
     std::vector<simgrid::s4u::ActorPtr> actors = host->get_all_actors();
     heap_handle update_handle                  = usable_hosts.push(host); // Required to update elements in the heap
   for (auto& host : available_hosts) {
     std::vector<simgrid::s4u::ActorPtr> actors = host->get_all_actors();
     heap_handle update_handle                  = usable_hosts.push(host); // Required to update elements in the heap
-    additional_load[host]                      = {update_handle, 0}; // Save the handle for later
+    additional_load[host]                      = {update_handle, 0};      // Save the handle for later
+    const double total_flops_computed          = sg_host_get_computed_flops(host);
     for (auto& actor : actors) {
     for (auto& actor : actors) {
-      additional_load[host].load += actor_computation[actor->get_pid()];
+      additional_load[host].load += actor_computation[actor->get_pid()] / total_flops_computed; // Normalize load - this allows comparison
+                                                                                                // even between hosts with different frequencies
       XBT_DEBUG("Actor %li -> %f", actor->get_pid(), actor_computation[actor->get_pid()]);
     }
       XBT_DEBUG("Actor %li -> %f", actor->get_pid(), actor_computation[actor->get_pid()]);
     }
+    usable_hosts.increase(update_handle);
     XBT_DEBUG("Host %s initialized to %f", host->get_cname(), additional_load[host].load);
   }
 
     XBT_DEBUG("Host %s initialized to %f", host->get_cname(), additional_load[host].load);
   }