From: Arnaud Giersch Date: Tue, 18 Jan 2011 10:25:38 +0000 (+0100) Subject: Define process::lb_load(), and use it. X-Git-Tag: v0.1~188^2~34 X-Git-Url: https://bilbo.iut-bm.univ-fcomte.fr/and/gitweb/loba.git/commitdiff_plain/9ec598fc7b8d73ed8e9822aed084ad1e1b2918b6?ds=inline Define process::lb_load(), and use it. --- diff --git a/process.cpp b/process.cpp index ac9ab24..0afbf29 100644 --- a/process.cpp +++ b/process.cpp @@ -91,10 +91,9 @@ int process::run() comp_iter, load); } - if (opt::bookkeeping) - expected_load -= load_balance(expected_load); - else - load -= load_balance(load); + double ld = lb_load(); + ld -= load_balance(ld); + lb_load() = ld; print_loads(true, xbt_log_priority_debug); @@ -121,9 +120,7 @@ int process::run() // block on receiving unless there is something to compute or // to send - bool wait = (load == 0 && - ((opt::bookkeeping ? expected_load : load) - == prev_load_broadcast)); + bool wait = (load == 0 && lb_load() == prev_load_broadcast); receive(wait); // one of our neighbor is finalizing diff --git a/process.h b/process.h index b15f982..1b4f9ca 100644 --- a/process.h +++ b/process.h @@ -16,6 +16,7 @@ #include #include "communicator.h" #include "neighbor.h" +#include "options.h" class process { public: @@ -76,6 +77,8 @@ private: double load; // current load double expected_load; // expected load in bookkeeping mode + double& lb_load() { return opt::bookkeeping ? expected_load : load; } + // The load balancing algorithm comes here... // Parameter "my_load" is the load to take into account for myself // (may be load or expected load).