Commit c3a6a949 authored by Xin's avatar Xin

fixing output collective call to file

parent 2013bcaf
......@@ -226,6 +226,7 @@ struct nw_state
int num_all_reduce;
double col_times[MAX_COL];
uint64_t col_msizes[MAX_COL];
char col_buf[100*MAX_COL];
double elapsed_time;
/* time spent in compute operations */
......@@ -1770,7 +1771,7 @@ void nw_test_init(nw_state* s, tw_lp* lp)
}
else
{
printf("\n Trace %s job id %d %d ", file_name_of_job[lid.job], s->app_id, s->local_rank);
printf("\n Trace %s job id %d %d on rank %d", file_name_of_job[lid.job], s->app_id, s->local_rank, s->nw_id);
strcpy(params_d.file_name, file_name_of_job[lid.job]);
params_d.num_net_traces = num_traces_of_job[lid.job];
params = (char*)&params_d;
......@@ -2097,9 +2098,9 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
{
bf->c1 = 1;
m->rc.saved_delay = s->all_reduce_time;
s->col_times[s->num_all_reduce] = (tw_now(lp) - s->col_time);
s->col_times[s->num_all_reduce] = (tw_now(lp) - s->col_time);
s->col_msizes[s->num_all_reduce] = mpi_op.u.collective.num_bytes;
s->all_reduce_time += (tw_now(lp) - s->col_time);
s->all_reduce_time += (tw_now(lp) - s->col_time);
m->rc.saved_send_time = s->col_time;
s->col_time = 0;
s->num_all_reduce++;
......@@ -2132,7 +2133,8 @@ 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)
{
int written = 0; written2 = 0;
int written = 0; int written2 = 0;
//printf("\n This is rank %lld", s->nw_id);
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>");
......@@ -2216,19 +2218,20 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
if(s->recv_time > max_recv_time)
max_recv_time = s->recv_time;
memset(s->output_buf, 0, sizeof(s->output_buf));
if(s->local_rank == 0 && debug_cols)
written2 = sprintf(s->output_buf, "rank_id nrep msize runtime_ns");
written2 = sprintf(s->col_buf, "rank_id nrep msize runtime_ns");
if(debug_cols)
{
printf("\n Rank %lld Avg all reduce time %lf ", s->nw_id, ns_to_s(s->all_reduce_time / s->num_all_reduce));
for (int i=0; i< s->num_all_reduce; i++)
{
written2 += sprintf(s->output_buf + written2, "\n %d %d %lld %lf",
s->local_rank, i, s->col_msizes[i], s->col_times[i]);
written2 += sprintf(s->col_buf + written2, "\n %d %d %lld %lf",
s->local_rank, i, s->col_msizes[i], s->col_times[i]);
//printf("\n buffer size=%d", written2);
}
lp_io_write(lp->gid, "mpi-col-stats", written2, s->output_buf);
lp_io_write(lp->gid, "mpi-col-stats", written2, s->col_buf);
}
avg_time += s->elapsed_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