-* add several metrics
- - message exchanges : number/volume of sent/received data/ctrl messages
-
* for automatic process topology,
-> implement some random initial distribution of load
condition_t* proc_cond;
unsigned proc_counter = 0;
- statistics comps;
statistics loads;
+ statistics comps;
+ statistics data_send_amount;
+ statistics data_recv_amount;
+ statistics data_send_count;
+ statistics data_recv_count;
+ statistics ctrl_send_amount;
+ statistics ctrl_recv_amount;
+ statistics ctrl_send_count;
+ statistics ctrl_recv_count;
}
result = proc->run();
proc_mutex->acquire();
- comps.push(proc->get_comp());
loads.push(proc->get_real_load());
+ comps.push(proc->get_comp_amount());
+ 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());
// Synchronization barrier...
// The goal is to circumvent a limitation in SimGrid (at least
XBT_INFO(",----[ Results ]");
PR_STATS("Load", loads);
PR_STATS("Computation", comps);
+ PR_STATS("Data send", data_send_amount);
+ PR_STATS("Data recv", data_recv_amount);
+ PR_STATS("Data send #", data_send_count);
+ PR_STATS("Data recv #", data_recv_count);
+ PR_STATS("Ctrl send", ctrl_send_amount);
+ PR_STATS("Ctrl recv", ctrl_recv_amount);
+ PR_STATS("Ctrl send #", ctrl_send_count);
+ PR_STATS("Ctrl recv #", ctrl_recv_count);
XBT_INFO("| Total simulated time...................: %g",
simulated_time);
XBT_INFO("| Total simulation time..................: %g",
rev_neigh.insert(std::make_pair(host, ptr));
}
- comp = 0.0;
-
prev_load_broadcast = -1; // force sending of load on first send_all()
expected_load = real_load;
total_load_running += real_load;
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", comp);
+ XBT_VERB("Total computation for this process: %g", get_comp_amount());
}
int process::run()
TRACE_msg_set_task_category(task, TRACE_CAT_COMP);
XBT_DEBUG("compute %g flop%s", flops, ESSE(flops));
MSG_task_execute(task);
- comp += flops;
+ add_comp_amount(flops);
MSG_task_destroy(task);
sleep_until_date(next_iter_after_date, opt::min_comp_iter_duration);
void process::ctrl_send(neighbor& nb)
{
double info_to_send = expected_load;
- if (info_to_send != prev_load_broadcast)
- comm.ctrl_send(nb.get_ctrl_mbox(),
- new message(message::INFO, info_to_send));
+ if (info_to_send != prev_load_broadcast) {
+ message* msg = new message(message::INFO, info_to_send);
+ add_ctrl_send_mesg(msg->get_size());
+ comm.ctrl_send(nb.get_ctrl_mbox(), msg);
+ }
if (opt::bookkeeping) {
double debt_to_send = nb.get_to_send();
if (debt_to_send > 0.0) {
nb.set_to_send(0.0);
nb.set_debt(nb.get_debt() + debt_to_send);
- comm.ctrl_send(nb.get_ctrl_mbox(),
- new message(message::CREDIT, debt_to_send));
+ message* msg = new message(message::CREDIT, debt_to_send);
+ add_ctrl_send_mesg(msg->get_size());
+ comm.ctrl_send(nb.get_ctrl_mbox(), msg);
}
}
}
amount = std::min(load_to_send, opt::max_transfer_amount);
else
amount = load_to_send;
- comm.data_send(nb.get_data_mbox(), new message(message::LOAD, amount));
+ message* msg = new message(message::LOAD, amount);
+ add_data_send_mesg(msg->get_size());
+ comm.data_send(nb.get_data_mbox(), msg);
load_to_send -= amount;
}
}
XBT_DEBUG("%sblocking receive on ctrl (%g)", "\0non-" + !timeout, timeout);
while (ctrl_close_pending && comm.ctrl_recv(msg, from, timeout)) {
+ if (msg->get_type() != message::CTRL_CLOSE)
+ add_ctrl_recv_mesg(msg->get_size());
handle_message(msg, from);
timeout = 0.0;
}
XBT_DEBUG("%sblocking receive on data (%g)", "\0non-" + !timeout, timeout);
while (data_close_pending && comm.data_recv(msg, from, timeout)) {
+ if (msg->get_type() != message::DATA_CLOSE)
+ add_data_recv_mesg(msg->get_size());
handle_message(msg, from);
timeout = 0.0;
}
process(int argc, char* argv[]);
virtual ~process();
- double get_comp() const { return comp; }
- double get_real_load() const { return real_load; }
+ double get_real_load() const { return real_load; }
+ double get_comp_amount() const { return acc.comp_amount; }
+ double get_data_send_amount() const { return acc.data_send.amount; }
+ double get_data_recv_amount() const { return acc.data_recv.amount; }
+ unsigned get_data_send_count() const { return acc.data_send.count; }
+ unsigned get_data_recv_count() const { return acc.data_recv.count; }
+ double get_ctrl_send_amount() const { return acc.ctrl_send.amount; }
+ double get_ctrl_recv_amount() const { return acc.ctrl_recv.amount; }
+ unsigned get_ctrl_send_count() const { return acc.ctrl_send.count; }
+ unsigned get_ctrl_recv_count() const { return acc.ctrl_recv.count; }
int run();
unsigned lb_iter; // counter of load-balancing iterations
unsigned comp_iter; // counter of computation iterations
- double comp; // total computing done so far (flops)
-
double prev_load_broadcast; // used to ensure that we do not send
// a same information messages
double real_load; // current load
mutex_t mutex; // synchronization between threads
condition_t cond;
+ struct mesg_accounting {
+ double amount; // sum of message size
+ unsigned count; // number of messages
+ mesg_accounting(): amount(0.0), count(0) { }
+ };
+ struct accounting {
+ double comp_amount; // total computing done so far (flops)
+ mesg_accounting data_send; // data messages sent
+ mesg_accounting data_recv; // data messages received
+ mesg_accounting ctrl_send; // ctrl message sent
+ mesg_accounting ctrl_recv; // ctrl message received
+ accounting(): comp_amount(0.0) { }
+ };
+ accounting acc;
+
+ void add_comp_amount(double amount) { acc.comp_amount += amount; }
+ void add_data_send_mesg(double amount) {
+ ++acc.data_send.count;
+ acc.data_send.amount += amount;
+ }
+ void add_data_recv_mesg(double amount) {
+ ++acc.data_recv.count;
+ acc.data_recv.amount += amount;
+ }
+ void add_ctrl_send_mesg(double amount) {
+ ++acc.ctrl_send.count;
+ acc.ctrl_send.amount += amount;
+ }
+ void add_ctrl_recv_mesg(double amount) {
+ ++acc.ctrl_recv.count;
+ acc.ctrl_recv.amount += amount;
+ }
+
// Load-balancing loop
msg_thread* lb_thread;
void load_balance_loop();