close_received = false;
finalizing = false;
- comp_iter = lb_iter = 0;
+ all_comp_iter = comp_iter = lb_iter = 0;
lb_thread = new_msg_thread("loba",
std::bind(&process::load_balance_loop, this));
"received_load is %g, but should be 0.0 !", received_load);
if (opt::log_rate < 0)
return;
- XBT_INFO("Final load after %d:%d iterations: %g",
- lb_iter, comp_iter, real_load);
+ XBT_INFO("Final load after %d:%d:%d iterations: %g",
+ lb_iter, comp_iter, all_comp_iter, real_load);
XBT_VERB("Expected load was: %g", expected_load);
XBT_VERB("Total computation for this process: %g", get_comp_amount());
print_loads(true, xbt_log_priority_debug);
// nothing to do with opt::bookkeeping
if (opt::log_rate && lb_iter % opt::log_rate == 0) {
- XBT_INFO("(%u:%u) current load: %g", lb_iter, comp_iter, real_load);
+ XBT_INFO("(%u:%u:%u) current load: %g",
+ lb_iter, comp_iter, all_comp_iter, real_load);
XBT_VERB("... expected load: %g", expected_load);
}
std::bind(&process::data_send, this, _1));
mutex.release();
+ ++all_comp_iter;
if (real_load == 0.0)
continue;
{
double load_to_send;
if (opt::bookkeeping) { // bookkeeping
- double excess_load;
+ double excess_load; // load amount we are able to send
if (opt::egocentric)
excess_load = std::max(0.0, real_load - expected_load);
else
excess_load = real_load;
- load_to_send = compute_load_to_send(std::min(excess_load,
- nb.get_debt()));
+
+ double balance = nb.get_debt() - nb.get_credit();
+ load_to_send = std::min(excess_load,
+ std::max(0.0, balance));
+
+ // adjust load to send (rounding, truncation, etc.)
+ load_to_send = compute_load_to_send(load_to_send);
if (load_to_send > 0.0)
nb.set_debt(nb.get_debt() - load_to_send);
} else { // !bookkeeping