Commit a2889d14 authored by Misbah Mubarak's avatar Misbah Mubarak
Browse files

Adding LP-IO stats for mpi-sim layer

parent 7b287701
...@@ -140,6 +140,11 @@ struct nw_state ...@@ -140,6 +140,11 @@ struct nw_state
/* Pending wait operation */ /* Pending wait operation */
struct pending_waits * wait_op; struct pending_waits * wait_op;
unsigned long num_bytes_sent;
unsigned long num_bytes_recvd;
char output_buf[512];
}; };
/* data for handling reverse computation. /* data for handling reverse computation.
...@@ -726,6 +731,7 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -726,6 +731,7 @@ static void codes_exec_mpi_send(nw_state* s,
} }
num_bytes_sent += mpi_op->u.send.num_bytes; num_bytes_sent += mpi_op->u.send.num_bytes;
s->num_bytes_sent += mpi_op->u.send.num_bytes;
nw_message local_m; nw_message local_m;
nw_message remote_m; nw_message remote_m;
...@@ -831,6 +837,8 @@ static void update_arrival_queue_rc(nw_state* s, ...@@ -831,6 +837,8 @@ static void update_arrival_queue_rc(nw_state* s,
nw_message * m, tw_lp * lp) nw_message * m, tw_lp * lp)
{ {
s->recv_time = m->rc.saved_recv_time; s->recv_time = m->rc.saved_recv_time;
s->num_bytes_recvd -= m->fwd.num_bytes;
codes_local_latency_reverse(lp); codes_local_latency_reverse(lp);
if(m->fwd.found_match >= 0) if(m->fwd.found_match >= 0)
...@@ -875,7 +883,7 @@ static void update_arrival_queue_rc(nw_state* s, ...@@ -875,7 +883,7 @@ static void update_arrival_queue_rc(nw_state* s,
static void update_arrival_queue(nw_state* s, tw_bf * bf, nw_message * m, tw_lp * lp) static void update_arrival_queue(nw_state* s, tw_bf * bf, nw_message * m, tw_lp * lp)
{ {
m->rc.saved_recv_time = s->recv_time; m->rc.saved_recv_time = s->recv_time;
s->num_bytes_recvd += m->fwd.num_bytes;
// send a callback to the sender to increment times // send a callback to the sender to increment times
tw_event *e_callback = tw_event *e_callback =
...@@ -968,6 +976,8 @@ void nw_test_init(nw_state* s, tw_lp* lp) ...@@ -968,6 +976,8 @@ void nw_test_init(nw_state* s, tw_lp* lp)
/* clock starts when the first event is processed */ /* clock starts when the first event is processed */
s->start_time = tw_now(lp); s->start_time = tw_now(lp);
codes_issue_next_event(lp); codes_issue_next_event(lp);
s->num_bytes_sent = 0;
s->num_bytes_recvd = 0;
return; return;
} }
...@@ -1023,6 +1033,7 @@ static void get_next_mpi_operation_rc(nw_state* s, tw_bf * bf, nw_message * m, t ...@@ -1023,6 +1033,7 @@ static void get_next_mpi_operation_rc(nw_state* s, tw_bf * bf, nw_message * m, t
if(m->op_type == CODES_WK_ISEND) if(m->op_type == CODES_WK_ISEND)
codes_issue_next_event_rc(lp); codes_issue_next_event_rc(lp);
s->num_sends--; s->num_sends--;
s->num_bytes_sent += saved_num_bytes;
num_bytes_sent -= saved_num_bytes; num_bytes_sent -= saved_num_bytes;
} }
break; break;
...@@ -1163,6 +1174,9 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l ...@@ -1163,6 +1174,9 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
void nw_test_finalize(nw_state* s, tw_lp* lp) void nw_test_finalize(nw_state* s, tw_lp* lp)
{ {
int written = 0;
if(!s->nw_id)
written = sprintf(s->output_buf, "# Format <LP ID> <Terminal ID> <Total sends> <Total Recvs> <Bytes sent> <Bytes recvd> <Send time> <Comm. time> <Compute time>");
if(s->nw_id < num_net_traces) if(s->nw_id < num_net_traces)
{ {
int count_irecv = qlist_count(&s->pending_recvs_queue); int count_irecv = qlist_count(&s->pending_recvs_queue);
...@@ -1170,6 +1184,10 @@ void nw_test_finalize(nw_state* s, tw_lp* lp) ...@@ -1170,6 +1184,10 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
printf("\n LP %ld unmatched irecvs %d unmatched sends %d Total sends %ld receives %ld collectives %ld delays %ld wait alls %ld waits %ld send time %lf wait %lf", printf("\n LP %ld unmatched irecvs %d unmatched sends %d Total sends %ld receives %ld collectives %ld delays %ld wait alls %ld waits %ld send time %lf wait %lf",
lp->gid, count_irecv, count_isend, s->num_sends, s->num_recvs, s->num_cols, s->num_delays, s->num_waitall, s->num_wait, s->send_time, s->wait_time); lp->gid, count_irecv, count_isend, s->num_sends, s->num_recvs, s->num_cols, s->num_delays, s->num_waitall, s->num_wait, s->send_time, s->wait_time);
written += sprintf(s->output_buf + written, "\n %lu %lu %ld %ld %ld %ld %lf %lf %lf", lp->gid, s->nw_id, s->num_sends, s->num_recvs, s->num_bytes_sent,
s->num_bytes_recvd, s->send_time, s->elapsed_time - s->compute_time, s->compute_time);
lp_io_write(lp->gid, "mpi-replay-stats", written, s->output_buf);
if(s->elapsed_time - s->compute_time > max_comm_time) if(s->elapsed_time - s->compute_time > max_comm_time)
max_comm_time = s->elapsed_time - s->compute_time; max_comm_time = s->elapsed_time - s->compute_time;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment