From 9ec598fc7b8d73ed8e9822aed084ad1e1b2918b6 Mon Sep 17 00:00:00 2001 From: Arnaud Giersch Date: Tue, 18 Jan 2011 11:25:38 +0100 Subject: [PATCH 1/1] Define process::lb_load(), and use it. --- process.cpp | 11 ++++------- process.h | 3 +++ 2 files changed, 7 insertions(+), 7 deletions(-) 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). -- 2.39.5