Commit 0547a991 authored by Misbah Mubarak's avatar Misbah Mubarak
Browse files

updating MPI sim layer for blocking receives, updating dragonfly model for the...

updating MPI sim layer for blocking receives, updating dragonfly model for the message remainders, checking for negative byte size in dumpi traces
parent 8f702e82
...@@ -189,7 +189,7 @@ struct codes_workload_op ...@@ -189,7 +189,7 @@ struct codes_workload_op
/* TODO: not sure why source rank is here */ /* TODO: not sure why source rank is here */
int source_rank;/* source rank of MPI send message */ int source_rank;/* source rank of MPI send message */
int dest_rank; /* dest rank of MPI send message */ int dest_rank; /* dest rank of MPI send message */
int num_bytes; /* number of bytes to be transferred over the network */ int64_t num_bytes; /* number of bytes to be transferred over the network */
int16_t data_type; /* MPI data type to be matched with the recv */ int16_t data_type; /* MPI data type to be matched with the recv */
int count; /* number of elements to be received */ int count; /* number of elements to be received */
int tag; /* tag of the message */ int tag; /* tag of the message */
......
...@@ -107,7 +107,7 @@ struct mpi_msgs_queue ...@@ -107,7 +107,7 @@ struct mpi_msgs_queue
int tag; int tag;
int source_rank; int source_rank;
int dest_rank; int dest_rank;
int num_bytes; uint64_t num_bytes;
tw_stime req_init_time; tw_stime req_init_time;
dumpi_req_id req_id; dumpi_req_id req_id;
struct qlist_head ql; struct qlist_head ql;
...@@ -204,7 +204,7 @@ struct nw_message ...@@ -204,7 +204,7 @@ struct nw_message
{ {
tw_lpid src_rank; tw_lpid src_rank;
tw_lpid dest_rank; tw_lpid dest_rank;
int num_bytes; int64_t num_bytes;
int num_matched; int num_matched;
int data_type; int data_type;
double sim_start_time; double sim_start_time;
...@@ -222,7 +222,7 @@ struct nw_message ...@@ -222,7 +222,7 @@ struct nw_message
double saved_recv_time; double saved_recv_time;
double saved_wait_time; double saved_wait_time;
double saved_delay; double saved_delay;
int saved_num_bytes; int64_t saved_num_bytes;
struct codes_workload_op * saved_op; struct codes_workload_op * saved_op;
} rc; } rc;
}; };
...@@ -285,6 +285,21 @@ static void print_waiting_reqs(int32_t * reqs, int count) ...@@ -285,6 +285,21 @@ static void print_waiting_reqs(int32_t * reqs, int count)
for(i = 0; i < count; i++ ) for(i = 0; i < count; i++ )
printf(" %d ", reqs[i]); printf(" %d ", reqs[i]);
} }
static void print_msgs_queue(struct qlist_head * head, int is_send)
{
if(is_send)
printf("\n Send msgs queue: ");
else
printf("\n Recv msgs queue: ");
struct qlist_head * ent = NULL;
mpi_msgs_queue * current = NULL;
qlist_for_each(ent, head)
{
current = qlist_entry(ent, mpi_msgs_queue, ql);
printf(" \n Source %d Dest %d bytes %d tag %d ", current->source_rank, current->dest_rank, current->num_bytes, current->tag);
}
}
static void print_completed_queue(struct qlist_head * head) static void print_completed_queue(struct qlist_head * head)
{ {
printf("\n Completed queue: "); printf("\n Completed queue: ");
...@@ -370,8 +385,8 @@ static int notify_posted_wait(nw_state* s, ...@@ -370,8 +385,8 @@ static int notify_posted_wait(nw_state* s,
wait_elem->num_completed, wait_elem->num_completed,
wait_elem->count, wait_elem->count,
lp->gid); lp->gid);
if(wait_elem->num_completed > wait_elem->count) // if(wait_elem->num_completed > wait_elem->count)
tw_lp_suspend(lp, 1, 0); // tw_lp_suspend(lp, 1, 0);
if(wait_elem->num_completed == wait_elem->count) if(wait_elem->num_completed == wait_elem->count)
{ {
...@@ -522,7 +537,7 @@ static void codes_exec_mpi_wait_all( ...@@ -522,7 +537,7 @@ static void codes_exec_mpi_wait_all(
struct completed_requests* current = NULL; struct completed_requests* current = NULL;
qlist_for_each(ent, &s->completed_reqs) qlist_for_each(ent, &s->completed_reqs)
{ {
current = qlist_entry(ent, completed_requests, ql); current = qlist_entry(ent, struct completed_requests, ql);
if(current->req_id == req_id) if(current->req_id == req_id)
num_matched++; num_matched++;
} }
...@@ -590,6 +605,8 @@ static int rm_matching_rcv(nw_state * ns, ...@@ -590,6 +605,8 @@ static int rm_matching_rcv(nw_state * ns,
if(qi->op_type == CODES_WK_IRECV) if(qi->op_type == CODES_WK_IRECV)
update_completed_queue(ns, bf, m, lp, qi->req_id); update_completed_queue(ns, bf, m, lp, qi->req_id);
else if(qi->op_type == CODES_WK_RECV)
codes_issue_next_event(lp);
qlist_del(&qi->ql); qlist_del(&qi->ql);
...@@ -811,11 +828,9 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -811,11 +828,9 @@ static void codes_exec_mpi_send(nw_state* s,
m->rc.saved_num_bytes = mpi_op->u.send.num_bytes; m->rc.saved_num_bytes = mpi_op->u.send.num_bytes;
/* model-net event */ /* model-net event */
tw_lpid dest_rank; tw_lpid dest_rank;
codes_mapping_get_lp_info(lp->gid, lp_group_name, &mapping_grp_id, dest_rank = codes_mapping_get_lpid_from_relative(global_dest_rank, NULL, "nw-lp", NULL, 0);
lp_type_name, &mapping_type_id, annotation, &mapping_rep_id, &mapping_offset); // if(net_id == DRAGONFLY) /* special handling for the dragonfly case */
/* {
if(net_id == DRAGONFLY) /* special handling for the dragonfly case */
{
int num_routers, lps_per_rep, factor; int num_routers, lps_per_rep, factor;
num_routers = codes_mapping_get_lp_count(lp_group_name, 1, num_routers = codes_mapping_get_lp_count(lp_group_name, 1,
"modelnet_dragonfly_router", NULL, 1); "modelnet_dragonfly_router", NULL, 1);
...@@ -825,11 +840,11 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -825,11 +840,11 @@ static void codes_exec_mpi_send(nw_state* s,
} }
else else
{ {
/* other cases like torus/simplenet/loggp etc. */ */ /* other cases like torus/simplenet/loggp etc. */
codes_mapping_get_lp_id(lp_group_name, lp_type_name, NULL, 1, /* codes_mapping_get_lp_id(lp_group_name, lp_type_name, NULL, 1,
global_dest_rank, mapping_offset, &dest_rank); global_dest_rank, mapping_offset, &dest_rank);
} }
*/
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; s->num_bytes_sent += mpi_op->u.send.num_bytes;
...@@ -880,12 +895,12 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -880,12 +895,12 @@ static void codes_exec_mpi_send(nw_state* s,
{ {
if(mpi_op->op_type == CODES_WK_ISEND) if(mpi_op->op_type == CODES_WK_ISEND)
{ {
fprintf(workload_log, "\n (%lf) APP %d MPI ISEND SOURCE %ld DEST %ld BYTES %ld ", fprintf(workload_log, "\n (%lf) APP %d MPI ISEND SOURCE %ld DEST %ld TAG %d BYTES %ld ",
tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.num_bytes); tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.tag, mpi_op->u.send.num_bytes);
} }
else else
fprintf(workload_log, "\n (%lf) APP ID %d MPI SEND SOURCE %ld DEST %ld BYTES %ld ", fprintf(workload_log, "\n (%lf) APP ID %d MPI SEND SOURCE %ld DEST %ld TAG %d BYTES %ld ",
tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.num_bytes); tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.tag, mpi_op->u.send.num_bytes);
} }
/* isend executed, now get next MPI operation from the queue */ /* isend executed, now get next MPI operation from the queue */
if(mpi_op->op_type == CODES_WK_ISEND) if(mpi_op->op_type == CODES_WK_ISEND)
...@@ -1004,6 +1019,8 @@ static void update_arrival_queue_rc(nw_state* s, ...@@ -1004,6 +1019,8 @@ static void update_arrival_queue_rc(nw_state* s,
} }
if(qi->op_type == CODES_WK_IRECV) if(qi->op_type == CODES_WK_IRECV)
update_completed_queue_rc(s, bf, m, lp); update_completed_queue_rc(s, bf, m, lp);
else if(qi->op_type == CODES_WK_RECV)
codes_issue_next_event_rc(lp);
} }
else if(m->fwd.found_match < 0) else if(m->fwd.found_match < 0)
{ {
...@@ -1125,7 +1142,6 @@ void nw_test_init(nw_state* s, tw_lp* lp) ...@@ -1125,7 +1142,6 @@ void nw_test_init(nw_state* s, tw_lp* lp)
return; return;
} }
if (strcmp(workload_type, "dumpi") == 0){ if (strcmp(workload_type, "dumpi") == 0){
strcpy(params_d.file_name, file_name_of_job[lid.job]); strcpy(params_d.file_name, file_name_of_job[lid.job]);
params_d.num_net_traces = num_traces_of_job[lid.job]; params_d.num_net_traces = num_traces_of_job[lid.job];
...@@ -1409,6 +1425,7 @@ void nw_test_finalize(nw_state* s, tw_lp* lp) ...@@ -1409,6 +1425,7 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
} }
int count_irecv = qlist_count(&s->pending_recvs_queue); int count_irecv = qlist_count(&s->pending_recvs_queue);
int count_isend = qlist_count(&s->arrival_queue); int count_isend = qlist_count(&s->arrival_queue);
if(count_irecv || count_isend)
printf("\n LP %llu 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 %llu 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);
...@@ -1422,6 +1439,11 @@ void nw_test_finalize(nw_state* s, tw_lp* lp) ...@@ -1422,6 +1439,11 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
if(s->elapsed_time > max_time ) if(s->elapsed_time > max_time )
max_time = s->elapsed_time; max_time = s->elapsed_time;
if(count_irecv || count_isend)
{
print_msgs_queue(&s->pending_recvs_queue, 0);
print_msgs_queue(&s->arrival_queue, 1);
}
if(enable_sampling) if(enable_sampling)
{ {
fseek(workload_agg_log, sample_bytes_written, SEEK_SET); fseek(workload_agg_log, sample_bytes_written, SEEK_SET);
......
...@@ -1116,22 +1116,15 @@ void packet_generate(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1116,22 +1116,15 @@ void packet_generate(terminal_state * s, tw_bf * bf, terminal_message * msg,
assert(lp->gid != msg->dest_terminal_id); assert(lp->gid != msg->dest_terminal_id);
const dragonfly_param *p = s->params; const dragonfly_param *p = s->params;
double delay = p->cn_delay;
int total_event_size; int total_event_size;
uint64_t num_chunks = msg->packet_size / p->chunk_size; uint64_t num_chunks = msg->packet_size / p->chunk_size;
if (msg->packet_size % s->params->chunk_size) if (msg->packet_size % s->params->chunk_size)
{
delay = bytes_to_ns(msg->packet_size % p->chunk_size, p->cn_bandwidth);
num_chunks++; num_chunks++;
}
if(!num_chunks) if(!num_chunks)
num_chunks = 1; num_chunks = 1;
nic_ts = g_tw_lookahead + (num_chunks * s->params->cn_delay) + tw_rand_unif(lp->rng);
nic_ts = g_tw_lookahead + ((num_chunks - 1)* p->cn_delay) + delay + tw_rand_unif(lp->rng);
msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter; msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter;
msg->my_N_hop = 0; msg->my_N_hop = 0;
...@@ -1266,20 +1259,19 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1266,20 +1259,19 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
return; return;
} }
uint64_t num_chunks = cur_entry->msg.packet_size / s->params->chunk_size; uint64_t num_chunks = cur_entry->msg.packet_size/s->params->chunk_size;
if(msg->packet_size % s->params->chunk_size) if(cur_entry->msg.packet_size % s->params->chunk_size)
num_chunks++; num_chunks++;
if(!num_chunks) if(!num_chunks)
num_chunks = 1; num_chunks = 1;
double delay = s->params->cn_delay; tw_stime delay = s->params->cn_delay;
if((cur_entry->msg.packet_size % s->params->chunk_size) && (cur_entry->msg.chunk_id == num_chunks - 1)) if((cur_entry->msg.packet_size % s->params->chunk_size) && (cur_entry->msg.chunk_id == num_chunks - 1))
delay = bytes_to_ns(cur_entry->msg.packet_size % s->params->chunk_size, s->params->cn_bandwidth); delay = bytes_to_ns(cur_entry->msg.packet_size % s->params->chunk_size, s->params->cn_bandwidth);
msg->saved_available_time = s->terminal_available_time; msg->saved_available_time = s->terminal_available_time;
ts = g_tw_lookahead + delay + tw_rand_unif(lp->rng); ts = g_tw_lookahead + delay + tw_rand_unif(lp->rng);
s->terminal_available_time = maxd(s->terminal_available_time, tw_now(lp)); s->terminal_available_time = maxd(s->terminal_available_time, tw_now(lp));
s->terminal_available_time += ts; s->terminal_available_time += ts;
...@@ -1307,6 +1299,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1307,6 +1299,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
m->local_event_size_bytes = 0; m->local_event_size_bytes = 0;
tw_event_send(e); tw_event_send(e);
if(cur_entry->msg.chunk_id == num_chunks - 1 && if(cur_entry->msg.chunk_id == num_chunks - 1 &&
(cur_entry->msg.local_event_size_bytes > 0)) { (cur_entry->msg.local_event_size_bytes > 0)) {
bf->c2 = 1; bf->c2 = 1;
...@@ -1323,6 +1316,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1323,6 +1316,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
cur_entry = return_head(s->terminal_msgs, s->terminal_msgs_tail, 0); cur_entry = return_head(s->terminal_msgs, s->terminal_msgs_tail, 0);
rc_stack_push(lp, cur_entry, free, s->st); rc_stack_push(lp, cur_entry, free, s->st);
s->terminal_length -= s->params->chunk_size; s->terminal_length -= s->params->chunk_size;
cur_entry = s->terminal_msgs[0]; cur_entry = s->terminal_msgs[0];
/* if there is another packet inline then schedule another send event */ /* if there is another packet inline then schedule another send event */
...@@ -1400,6 +1394,8 @@ void packet_arrive_rc(terminal_state * s, tw_bf * bf, terminal_message * msg, tw ...@@ -1400,6 +1394,8 @@ void packet_arrive_rc(terminal_state * s, tw_bf * bf, terminal_message * msg, tw
if(bf->c7) if(bf->c7)
{ {
//assert(!hash_link);
tw_rand_reverse_unif(lp->rng);
N_finished_msgs--; N_finished_msgs--;
s->finished_msgs--; s->finished_msgs--;
total_msg_sz -= msg->total_size; total_msg_sz -= msg->total_size;
...@@ -1432,8 +1428,8 @@ void packet_arrive_rc(terminal_state * s, tw_bf * bf, terminal_message * msg, tw ...@@ -1432,8 +1428,8 @@ void packet_arrive_rc(terminal_state * s, tw_bf * bf, terminal_message * msg, tw
void send_remote_event(terminal_state * s, terminal_message * msg, tw_lp * lp, tw_bf * bf, char * event_data, int remote_event_size) void send_remote_event(terminal_state * s, terminal_message * msg, tw_lp * lp, tw_bf * bf, char * event_data, int remote_event_size)
{ {
void * tmp_ptr = model_net_method_get_edata(DRAGONFLY, msg); void * tmp_ptr = model_net_method_get_edata(DRAGONFLY, msg);
tw_stime ts = g_tw_lookahead + bytes_to_ns(msg->remote_event_size_bytes, (1/s->params->cn_bandwidth)); //tw_stime ts = g_tw_lookahead + bytes_to_ns(msg->remote_event_size_bytes, (1/s->params->cn_bandwidth));
tw_stime ts = g_tw_lookahead + tw_rand_unif(lp->rng);
if (msg->is_pull){ if (msg->is_pull){
bf->c4 = 1; bf->c4 = 1;
struct codes_mctx mc_dst = struct codes_mctx mc_dst =
...@@ -1467,6 +1463,14 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1467,6 +1463,14 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
key.message_id = msg->message_id; key.message_id = msg->message_id;
key.sender_id = msg->sender_lp; key.sender_id = msg->sender_lp;
struct qhash_head *hash_link = NULL;
struct dfly_qhash_entry * tmp = NULL;
hash_link = qhash_search(s->rank_tbl, &key);
if(hash_link)
tmp = qhash_entry(hash_link, struct dfly_qhash_entry, hash_link);
uint64_t total_chunks = msg->total_size / s->params->chunk_size; uint64_t total_chunks = msg->total_size / s->params->chunk_size;
if(msg->total_size % s->params->chunk_size) if(msg->total_size % s->params->chunk_size)
...@@ -1475,6 +1479,15 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1475,6 +1479,15 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
if(!total_chunks) if(!total_chunks)
total_chunks = 1; total_chunks = 1;
/*if(tmp)
{
if(tmp->num_chunks >= total_chunks || tmp->num_chunks < 0)
{
//tw_output(lp, "\n invalid number of chunks %d for LP %ld ", tmp->num_chunks, lp->gid);
tw_lp_suspend(lp, 0, 0);
return;
}
}*/
assert(lp->gid == msg->dest_terminal_id); assert(lp->gid == msg->dest_terminal_id);
if(msg->packet_ID == LLU(TRACK_PKT)) if(msg->packet_ID == LLU(TRACK_PKT))
...@@ -1566,16 +1579,10 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1566,16 +1579,10 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
/* Now retreieve the number of chunks completed from the hash and update /* Now retreieve the number of chunks completed from the hash and update
* them */ * them */
void *m_data_src = model_net_method_get_edata(DRAGONFLY, msg); void *m_data_src = model_net_method_get_edata(DRAGONFLY, msg);
struct qhash_head *hash_link = NULL;
struct dfly_qhash_entry * tmp = NULL;
hash_link = qhash_search(s->rank_tbl, &key);
/* If an entry does not exist then create one */ /* If an entry does not exist then create one */
if(!hash_link) if(!tmp)
{ {
bf->c5 = 1; bf->c5 = 1;
struct dfly_qhash_entry * d_entry = malloc(sizeof (struct dfly_qhash_entry)); struct dfly_qhash_entry * d_entry = malloc(sizeof (struct dfly_qhash_entry));
...@@ -1587,11 +1594,9 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1587,11 +1594,9 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
s->rank_tbl_pop++; s->rank_tbl_pop++;
hash_link = &(d_entry->hash_link); hash_link = &(d_entry->hash_link);
tmp = d_entry;
} }
if(hash_link)
tmp = qhash_entry(hash_link, struct dfly_qhash_entry, hash_link);
assert(tmp); assert(tmp);
tmp->num_chunks++; tmp->num_chunks++;
...@@ -1613,20 +1618,14 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1613,20 +1618,14 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
tmp->remote_event_size = msg->remote_event_size_bytes; tmp->remote_event_size = msg->remote_event_size_bytes;
memcpy(tmp->remote_event_data, m_data_src, msg->remote_event_size_bytes); memcpy(tmp->remote_event_data, m_data_src, msg->remote_event_size_bytes);
} }
if (dragonfly_max_latency < tw_now( lp ) - msg->travel_start_time) if (dragonfly_max_latency < tw_now( lp ) - msg->travel_start_time) {
{
bf->c3 = 1; bf->c3 = 1;
msg->saved_available_time = dragonfly_max_latency; msg->saved_available_time = dragonfly_max_latency;
dragonfly_max_latency = tw_now( lp ) - msg->travel_start_time; dragonfly_max_latency = tw_now( lp ) - msg->travel_start_time;
} }
/* If all chunks of a message have arrived then send a remote event to the /* If all chunks of a message have arrived then send a remote event to the
* callee*/ * callee*/
/*if(tmp->num_chunks >= total_chunks || tmp->num_chunks < 0) //assert(tmp->num_chunks <= total_chunks);
{
//tw_output(lp, "\n invalid number of chunks %d for LP %ld ", tmp->num_chunks, lp->gid);
tw_lp_suspend(lp, 0, 0);
return;
}*/
if(tmp->num_chunks >= total_chunks) if(tmp->num_chunks >= total_chunks)
{ {
...@@ -2376,13 +2375,14 @@ void dragonfly_router_final(router_state * s, ...@@ -2376,13 +2375,14 @@ void dragonfly_router_final(router_state * s,
written += sprintf(s->output_buf + written, "# Router ports in the order: %d local channels, %d global channels \n", written += sprintf(s->output_buf + written, "# Router ports in the order: %d local channels, %d global channels \n",
p->num_routers, p->num_global_channels); p->num_routers, p->num_global_channels);
} }
written += sprintf(s->output_buf + written, "\n %llu %d %d", written += sprintf(s->output_buf + written, "%llu %d %d",
LLU(lp->gid), LLU(lp->gid),
s->router_id / p->num_routers, s->router_id / p->num_routers,
s->router_id % p->num_routers); s->router_id % p->num_routers);
for(int d = 0; d < p->num_routers + p->num_global_channels; d++) for(int d = 0; d < p->num_routers + p->num_global_channels; d++)
written += sprintf(s->output_buf + written, " %lf", s->busy_time[d]); written += sprintf(s->output_buf + written, " %lf", s->busy_time[d]);
sprintf(s->output_buf + written, "\n");
lp_io_write(lp->gid, "dragonfly-router-stats", written, s->output_buf); lp_io_write(lp->gid, "dragonfly-router-stats", written, s->output_buf);
written = 0; written = 0;
...@@ -2392,7 +2392,7 @@ void dragonfly_router_final(router_state * s, ...@@ -2392,7 +2392,7 @@ void dragonfly_router_final(router_state * s,
written += sprintf(s->output_buf2 + written, "# Router ports in the order: %d local channels, %d global channels \n", written += sprintf(s->output_buf2 + written, "# Router ports in the order: %d local channels, %d global channels \n",
p->num_routers, p->num_global_channels); p->num_routers, p->num_global_channels);
} }
written += sprintf(s->output_buf2 + written, "\n %llu %d %d", written += sprintf(s->output_buf2 + written, "%llu %d %d",
LLU(lp->gid), LLU(lp->gid),
s->router_id / p->num_routers, s->router_id / p->num_routers,
s->router_id % p->num_routers); s->router_id % p->num_routers);
...@@ -2400,6 +2400,7 @@ void dragonfly_router_final(router_state * s, ...@@ -2400,6 +2400,7 @@ void dragonfly_router_final(router_state * s,
for(int d = 0; d < p->num_routers + p->num_global_channels; d++) for(int d = 0; d < p->num_routers + p->num_global_channels; d++)
written += sprintf(s->output_buf2 + written, " %lld", LLD(s->link_traffic[d])); written += sprintf(s->output_buf2 + written, " %lld", LLD(s->link_traffic[d]));
sprintf(s->output_buf2 + written, "\n");
lp_io_write(lp->gid, "dragonfly-router-traffic", written, s->output_buf2); lp_io_write(lp->gid, "dragonfly-router-traffic", written, s->output_buf2);
} }
...@@ -2896,19 +2897,19 @@ router_packet_send( router_state * s, ...@@ -2896,19 +2897,19 @@ router_packet_send( router_state * s,
} }
int to_terminal = 1, global = 0; int to_terminal = 1, global = 0;
double bandwidth = s->params->cn_bandwidth;
double delay = s->params->cn_delay; double delay = s->params->cn_delay;
double bandwidth = s->params->cn_bandwidth;
if(output_port < s->params->num_routers) { if(output_port < s->params->num_routers) {
to_terminal = 0; to_terminal = 0;
bandwidth = s->params->local_bandwidth;
delay = s->params->local_delay; delay = s->params->local_delay;
bandwidth = s->params->local_bandwidth;
} else if(output_port < s->params->num_routers + } else if(output_port < s->params->num_routers +
s->params->num_global_channels) { s->params->num_global_channels) {
to_terminal = 0; to_terminal = 0;
global = 1; global = 1;
bandwidth = s->params->global_bandwidth;
delay = s->params->global_delay; delay = s->params->global_delay;
bandwidth = s->params->global_bandwidth;
} }
uint64_t num_chunks = cur_entry->msg.packet_size / s->params->chunk_size; uint64_t num_chunks = cur_entry->msg.packet_size / s->params->chunk_size;
...@@ -3006,7 +3007,7 @@ router_packet_send( router_state * s, ...@@ -3006,7 +3007,7 @@ router_packet_send( router_state * s,
if(cur_entry != NULL) { if(cur_entry != NULL) {
bf->c3 = 1; bf->c3 = 1;
terminal_message *m_new; terminal_message *m_new;
ts = g_tw_lookahead + delay + tw_rand_unif(lp->rng); ts = g_tw_lookahead + bytetime + tw_rand_unif(lp->rng);
e = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY_ROUTER, e = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY_ROUTER,
(void**)&m_new, NULL); (void**)&m_new, NULL);
m_new->type = R_SEND; m_new->type = R_SEND;
...@@ -3219,7 +3220,7 @@ tw_lptype dragonfly_lps[] = ...@@ -3219,7 +3220,7 @@ tw_lptype dragonfly_lps[] =
(map_f) codes_mapping, (map_f) codes_mapping,
sizeof(router_state), sizeof(router_state),
}, },
{NULL, NULL, NULL, NULL, NULL, NULL, 0}, {NULL, NULL, NULL, NULL, NULL, NULL, NULL, 0},
}; };
/* returns the dragonfly lp type for lp registration */ /* returns the dragonfly lp type for lp registration */
......
...@@ -92,7 +92,7 @@ static int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank ...@@ -92,7 +92,7 @@ static int dumpi_trace_nw_workload_load(const char* params, int app_id, int rank
static void dumpi_trace_nw_workload_get_next(int app_id, int rank, struct codes_workload_op *op); static void dumpi_trace_nw_workload_get_next(int app_id, int rank, struct codes_workload_op *op);