namespace {
- void sleep_until_date(double& date, double duration = 0.0)
+ void sleep_until_date(double& date, double duration)
{
double sleep_duration = date - MSG_get_clock();
if (sleep_duration > 0.0)
++lb_iter;
}
+ mutex.acquire();
if (!opt::bookkeeping)
expected_load = real_load - get_sum_of_to_send();
// nothing to do with opt::bookkeeping
print_loads(true, xbt_log_priority_debug);
// send
+ comm.ctrl_flush(false);
std::for_each(neigh.begin(), neigh.end(),
bind(&process::ctrl_send, this, _1));
prev_load_broadcast = expected_load;
+ mutex.release();
sleep_until_date(next_iter_after_date, opt::min_lb_iter_duration);
ctrl_receive(0.0);
-
- comm.ctrl_flush(false);
}
XBT_VERB("Going to finalize for %s...", __func__);
double next_iter_after_date = MSG_get_clock() + opt::min_comp_iter_duration;
while (still_running()) {
// receive
+ mutex.acquire();
if (real_load > 0.0)
data_receive(0.0);
else
data_receive(opt::min_comp_iter_duration);
+ mutex.release();
+ // send
comm.data_flush(false);
+ mutex.acquire();
+ std::for_each(neigh.begin(), neigh.end(),
+ bind(&process::data_send, this, _1));
+ mutex.release();
if (real_load == 0.0)
continue;
- // send
- std::for_each(neigh.begin(), neigh.end(),
- bind(&process::data_send, this, _1));
-
// compute
++comp_iter;
double flops = opt::comp_cost(real_load);
if (!last_status) {
/* nop */
+ } else if (opt::exit_request) {
+ XBT_VERB("Global exit requested");
+ last_status = false;
+
} else if (opt::time_limit && MSG_get_clock() >= opt::time_limit) {
XBT_VERB("Reached time limit: %g/%g", MSG_get_clock(), opt::time_limit);
last_status = false;