if (argc < 2 || !(std::istringstream(argv[1]) >> real_load))
throw std::invalid_argument("bad or missing initial load parameter");
if (argc < 2 || !(std::istringstream(argv[1]) >> real_load))
throw std::invalid_argument("bad or missing initial load parameter");
neigh.assign(argv + 2, argv + argc);
pneigh.reserve(neigh.size());
neigh.assign(argv + 2, argv + argc);
pneigh.reserve(neigh.size());
expected_load = real_load;
total_load_running += real_load;
total_load_init += real_load;
expected_load = real_load;
total_load_running += real_load;
total_load_init += real_load;
if (opt::log_rate < 0)
return;
XBT_INFO("Final load after %d:%d iterations: %g",
lb_iter, comp_iter, real_load);
XBT_VERB("Expected load was: %g", expected_load);
XBT_VERB("Total computation for this process: %g", get_comp_amount());
if (opt::log_rate < 0)
return;
XBT_INFO("Final load after %d:%d iterations: %g",
lb_iter, comp_iter, real_load);
XBT_VERB("Expected load was: %g", expected_load);
XBT_VERB("Total computation for this process: %g", get_comp_amount());
double next_iter_after_date = MSG_get_clock() + opt::min_comp_iter_duration;
while (still_running()) {
double next_iter_after_date = MSG_get_clock() + opt::min_comp_iter_duration;
while (still_running()) {
std::for_each(neigh.begin(), neigh.end(),
std::bind(&process::data_send, this, _1));
mutex.release();
std::for_each(neigh.begin(), neigh.end(),
std::bind(&process::data_send, this, _1));
mutex.release();
- // last send, for not losing load scheduled to be sent
- std::for_each(neigh.begin(), neigh.end(),
- std::bind(&process::data_send, this, _1));
XBT_DEBUG("send DATA_CLOSE to %zu neighbor%s",
neigh.size(), ESSE(neigh.size()));
std::for_each(neigh.begin(), neigh.end(),
XBT_DEBUG("send DATA_CLOSE to %zu neighbor%s",
neigh.size(), ESSE(neigh.size()));
std::for_each(neigh.begin(), neigh.end(),
- if (opt::bookkeeping) {
- load_to_send = std::min(real_load, nb.get_debt());
- if (load_to_send >= opt::min_transfer_amount) {
+ if (opt::bookkeeping) { // bookkeeping
+ double excess_load;
+ 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()));
+ if (load_to_send > 0.0)
- real_load -= load_to_send;
- } else {
- load_to_send = 0.0;
- }
- } else {
- load_to_send = nb.get_to_send();
- if (load_to_send >= opt::min_transfer_amount) {
- nb.set_to_send(0.0);
- real_load -= load_to_send;
- } else {
- load_to_send = 0.0;
- }
+ } else { // !bookkeeping
+ load_to_send = compute_load_to_send(nb.get_to_send());
+ if (load_to_send > 0.0)
+ nb.set_to_send(nb.get_to_send() - load_to_send);