+ int result;
+ process* proc;
+
+ proc = opt::loba_algorithms.new_instance(opt::loba_algo, argc, argv);
+
+ proc_mutex->acquire();
+ ++proc_counter;
+ proc_mutex->release();
+
+ result = proc->run();
+
+ proc_mutex->acquire();
+ loads.push(proc->get_real_load());
+ comps.push(proc->get_comp_amount());
+ comp_iterations.push(proc->get_comp_iter());
+ all_comp_iterations.push(proc->get_all_comp_iter());
+ iter_deviation.push(proc->get_iter_deviation());
+ data_send_amount.push(proc->get_data_send_amount());
+ data_recv_amount.push(proc->get_data_recv_amount());
+ data_send_count.push(proc->get_data_send_count());
+ data_recv_count.push(proc->get_data_recv_count());
+ ctrl_send_amount.push(proc->get_ctrl_send_amount());
+ ctrl_recv_amount.push(proc->get_ctrl_recv_amount());
+ ctrl_send_count.push(proc->get_ctrl_send_count());
+ ctrl_recv_count.push(proc->get_ctrl_recv_count());
+ idle_duration.push(proc->get_idle_duration());
+ double c = proc->get_convergence();
+ if (c != -1.0)
+ convergence.push(c);
+
+ // Synchronization barrier...
+ // The goal is to circumvent a limitation in SimGrid (at least
+ // in version 3.5): a process must be alive when another one
+ // destroys a communication they had together.
+
+ --proc_counter;
+ proc_cond->broadcast();
+ while (proc_counter > 0)
+ proc_cond->wait(*proc_mutex);
+ proc_mutex->release();
+
+ delete proc;
+
+ return result;
+}
+
+static bool check_for_lost_load()
+{
+ bool res = true;
+ double total_init = process::get_total_load_init();
+ double total_exit = process::get_total_load_exit();
+ double lost = total_init - total_exit;
+ double lost_ratio = 100.0 * lost / total_init;
+ if (lost_ratio < -opt::load_ratio_threshold) {
+ XBT_ERROR("Gained load at exit! %g (%g%%) <============",
+ -lost, -lost_ratio);
+ res = false;
+ } else if (lost_ratio > opt::load_ratio_threshold) {
+ XBT_ERROR("Lost load at exit! %g (%g%%) <============",
+ lost, lost_ratio);
+ res = false;
+ } else
+ XBT_VERB("Total load at exit looks good: %g (%g%%)", lost, lost_ratio);
+
+ double total_running = process::get_total_load_running();
+ double running_ratio = 100.0 * total_running / total_init;
+ if (running_ratio < -opt::load_ratio_threshold) {
+ XBT_ERROR("Negative running load at exit! %g (%g%%) <============",
+ total_running, running_ratio);
+ res = false;
+ } else if (running_ratio > opt::load_ratio_threshold) {
+ XBT_ERROR("Remaining running load at exit! %g (%g%%) <============",
+ total_running, running_ratio);
+ res = false;
+ } else
+ XBT_VERB("Running load at exit looks good: %g (%g%%)",
+ total_running, running_ratio);
+ return res;
+}
+
+static void check_file_access(const std::string& name)
+{
+ if (access(name.c_str(), R_OK) != 0) {
+ std::cerr << "ERROR: cannot access to file \""
+ << name << "\" for reading: " << strerror(errno) << "\n";
+ exit(EXIT_FAILURE_ARGS);
+ }