Commit 5f9dc15a authored by Misbah Mubarak's avatar Misbah Mubarak

Adding same feature for dragonfly

parent 9ab40113
...@@ -49,7 +49,7 @@ struct terminal_message ...@@ -49,7 +49,7 @@ struct terminal_message
short last_hop; short last_hop;
/* For routing */ /* For routing */
int intm_group_id; int intm_group_id;
short chunk_id; int chunk_id;
uint64_t packet_size; uint64_t packet_size;
uint64_t num_chunks; uint64_t num_chunks;
int remote_event_size_bytes; int remote_event_size_bytes;
......
...@@ -358,7 +358,7 @@ static void dragonfly_report_stats() ...@@ -358,7 +358,7 @@ static void dragonfly_report_stats()
/* print statistics */ /* print statistics */
if(!g_tw_mynode) if(!g_tw_mynode)
{ {
printf("\n Total hops %lld total finished packets %d ", avg_hops, total_finished_packets); printf("\n total finished packets %d ", total_finished_packets);
printf(" Average number of hops traversed %f average message latency %lf us maximum message latency %lf us \n", (float)avg_hops/total_finished_packets, avg_time/(total_finished_packets*1000), max_time/1000); printf(" Average number of hops traversed %f average message latency %lf us maximum message latency %lf us \n", (float)avg_hops/total_finished_packets, avg_time/(total_finished_packets*1000), max_time/1000);
if(routing == ADAPTIVE || routing == PROG_ADAPTIVE) if(routing == ADAPTIVE || routing == PROG_ADAPTIVE)
printf("\n ADAPTIVE ROUTING STATS: %d percent packets routed minimally %d percent packets routed non-minimally completed packets %d ", total_minimal_packets, total_nonmin_packets, total_completed_packets); printf("\n ADAPTIVE ROUTING STATS: %d percent packets routed minimally %d percent packets routed non-minimally completed packets %d ", total_minimal_packets, total_nonmin_packets, total_completed_packets);
...@@ -448,6 +448,7 @@ static tw_stime dragonfly_packet_event(char const * category, tw_lpid final_dest ...@@ -448,6 +448,7 @@ static tw_stime dragonfly_packet_event(char const * category, tw_lpid final_dest
msg->magic = terminal_magic_num; msg->magic = terminal_magic_num;
msg->is_pull = is_pull; msg->is_pull = is_pull;
msg->pull_size = pull_size; msg->pull_size = pull_size;
msg->chunk_id = 0;
if(is_last_pckt) /* Its the last packet so pass in remote and local event information*/ if(is_last_pckt) /* Its the last packet so pass in remote and local event information*/
{ {
...@@ -464,7 +465,6 @@ static tw_stime dragonfly_packet_event(char const * category, tw_lpid final_dest ...@@ -464,7 +465,6 @@ static tw_stime dragonfly_packet_event(char const * category, tw_lpid final_dest
tmp_ptr += self_event_size; tmp_ptr += self_event_size;
} }
} }
//printf("\n dragonfly remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time);
tw_event_send(e_new); tw_event_send(e_new);
return xfer_to_nic_time; return xfer_to_nic_time;
} }
...@@ -596,71 +596,102 @@ static void packet_generate(terminal_state * s, ...@@ -596,71 +596,102 @@ static void packet_generate(terminal_state * s,
terminal_message * msg, terminal_message * msg,
tw_lp * lp) tw_lp * lp)
{ {
const dragonfly_param *p = s->params; const dragonfly_param *p = s->params;
tw_stime ts; tw_stime ts;
tw_event *e; tw_event *e;
terminal_message *m; terminal_message *m;
int i, total_event_size; int i, total_event_size;
int chunk_id = msg->chunk_id;
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)
num_chunks++; num_chunks++;
if(!num_chunks) if(!num_chunks)
num_chunks = 1; num_chunks = 1;
msg->num_chunks = num_chunks; msg->num_chunks = num_chunks;
msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter + tw_rand_integer(lp->rng, 0, lp->gid + g_tw_nlp * s->packet_counter); msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter + tw_rand_integer(lp->rng, 0, lp->gid + g_tw_nlp * s->packet_counter);
msg->travel_start_time = tw_now(lp); msg->travel_start_time = tw_now(lp);
for(i = 0; i < num_chunks; i++) ts = codes_local_latency(lp);
{
ts = g_tw_lookahead + 0.1 + tw_rand_exponential(lp->rng, MEAN_INTERVAL/200); int chan = -1, j;
int chan = -1, j; for(j = 0; j < p->num_vcs; j++)
for(j = 0; j < p->num_vcs; j++) {
{ if(s->vc_occupancy[j] < p->cn_vc_size * num_chunks)
if(s->vc_occupancy[j] < p->cn_vc_size * num_chunks) {
{ chan=j;
chan=j; break;
break; }
} }
} // this is a terminal event, so use the method-event version
// this is a terminal event, so use the method-event version void * m_data;
void * m_data; e = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY,
e = model_net_method_event_new(lp->gid, i+ts, lp, DRAGONFLY, (void**)&m, &m_data);
(void**)&m, &m_data); memcpy(m, msg, sizeof(terminal_message));
memcpy(m, msg, sizeof(terminal_message)); void * m_data_src = model_net_method_get_edata(DRAGONFLY, msg);
void * m_data_src = model_net_method_get_edata(DRAGONFLY, msg); if (msg->remote_event_size_bytes){
if (msg->remote_event_size_bytes){ memcpy(m_data, m_data_src, msg->remote_event_size_bytes);
memcpy(m_data, m_data_src, msg->remote_event_size_bytes); }
} if (msg->local_event_size_bytes){
if (msg->local_event_size_bytes){ memcpy((char*)m_data + msg->remote_event_size_bytes,
memcpy((char*)m_data + msg->remote_event_size_bytes, (char*)m_data_src + msg->remote_event_size_bytes,
(char*)m_data_src + msg->remote_event_size_bytes, msg->local_event_size_bytes);
msg->local_event_size_bytes); }
} m->intm_group_id = -1;
m->intm_group_id = -1; m->saved_vc=0;
m->saved_vc=0; m->chunk_id = msg->chunk_id;
m->chunk_id = i; m->magic = terminal_magic_num;
m->magic = terminal_magic_num; /* if(msg->packet_ID == TRACK && msg->chunk_id == num_chunks-1)
/* if(msg->packet_ID == TRACK && msg->chunk_id == num_chunks-1) printf("\n packet generated %lld at terminal %d chunk id %d ", msg->packet_ID, (int)lp->gid, i);
printf("\n packet generated %lld at terminal %d chunk id %d ", msg->packet_ID, (int)lp->gid, i); */
*/ m->output_chan = -1;
m->output_chan = -1; if(chan != -1) // If the input queue is available
if(chan != -1) // If the input queue is available {
{ // Send the packet out
// Send the packet out m->type = T_SEND;
m->type = T_SEND; tw_event_send(e);
tw_event_send(e); }
} else
else {
{ printf("\n Exceeded queue size, exitting %d", s->vc_occupancy[0]);
printf("\n Exceeded queue size, exitting %d", s->vc_occupancy[0]); MPI_Finalize();
MPI_Finalize(); exit(-1);
exit(-1); } //else
} //else
} // for /* Now schedule another packet generate event */
if(chunk_id < num_chunks - 1)
{
/* Issue another packet generate event */
tw_event * e_gen;
terminal_message * m_gen;
void * m_gen_data;
/* Keep the packet generate event a little behind packet send */
ts = ts + codes_local_latency(lp);
e_gen = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY, (void**)&m_gen,(void**)&m_gen_data);
void *m_gen_data_src = model_net_method_get_edata(DRAGONFLY, msg);
memcpy(m_gen, msg, sizeof(terminal_message));
m_gen->chunk_id = ++chunk_id;
m_gen->type = T_GENERATE;
if (msg->remote_event_size_bytes){
memcpy(m_gen_data, m_gen_data_src,
msg->remote_event_size_bytes);
m_gen_data = (char*)m_gen_data + msg->remote_event_size_bytes;
m_gen_data_src = (char*)m_gen_data_src + msg->remote_event_size_bytes;
}
if (msg->local_event_size_bytes)
memcpy(m_gen_data, m_gen_data_src, msg->local_event_size_bytes);
tw_event_send(e_gen);
}
total_event_size = model_net_get_msg_sz(DRAGONFLY) + total_event_size = model_net_get_msg_sz(DRAGONFLY) +
msg->remote_event_size_bytes + msg->local_event_size_bytes; msg->remote_event_size_bytes + msg->local_event_size_bytes;
mn_stats* stat; mn_stats* stat;
...@@ -922,6 +953,7 @@ void ...@@ -922,6 +953,7 @@ void
terminal_init( terminal_state * s, terminal_init( terminal_state * s,
tw_lp * lp ) tw_lp * lp )
{ {
// printf("\n terminal ID %ld ", lp->gid);
uint32_t h1 = 0, h2 = 0; uint32_t h1 = 0, h2 = 0;
bj_hashlittle2(LP_METHOD_NM, strlen(LP_METHOD_NM), &h1, &h2); bj_hashlittle2(LP_METHOD_NM, strlen(LP_METHOD_NM), &h1, &h2);
terminal_magic_num = h1 + h2; terminal_magic_num = h1 + h2;
...@@ -1189,7 +1221,7 @@ static void node_collective_fan_out(terminal_state * s, ...@@ -1189,7 +1221,7 @@ static void node_collective_fan_out(terminal_state * s,
{ {
bf->c1 = 1; bf->c1 = 1;
tw_event* e_new; tw_event* e_new;
nodes_message * msg_new; terminal_message * msg_new;
tw_stime xfer_to_nic_time; tw_stime xfer_to_nic_time;
for( i = 0; i < s->num_children; i++ ) for( i = 0; i < s->num_children; i++ )
...@@ -1211,7 +1243,7 @@ static void node_collective_fan_out(terminal_state * s, ...@@ -1211,7 +1243,7 @@ static void node_collective_fan_out(terminal_state * s,
e_new = model_net_method_event_new(child_nic_id, e_new = model_net_method_event_new(child_nic_id,
xfer_to_nic_time, xfer_to_nic_time,
lp, DRAGONFLY, (void**)&msg_new, &m_data); lp, DRAGONFLY, (void**)&msg_new, &m_data);
memcpy(msg_new, msg, sizeof(nodes_message)); memcpy(msg_new, msg, sizeof(terminal_message));
if (msg->remote_event_size_bytes){ if (msg->remote_event_size_bytes){
memcpy(m_data, model_net_method_get_edata(DRAGONFLY, msg), memcpy(m_data, model_net_method_get_edata(DRAGONFLY, msg),
msg->remote_event_size_bytes); msg->remote_event_size_bytes);
...@@ -1802,6 +1834,7 @@ static void router_packet_receive( router_state * s, ...@@ -1802,6 +1834,7 @@ static void router_packet_receive( router_state * s,
/* sets up the router virtual channels, global channels, local channels, compute node channels */ /* sets up the router virtual channels, global channels, local channels, compute node channels */
void router_setup(router_state * r, tw_lp * lp) void router_setup(router_state * r, tw_lp * lp)
{ {
//printf("\n Router ID %ld ", lp->gid);
uint32_t h1 = 0, h2 = 0; uint32_t h1 = 0, h2 = 0;
bj_hashlittle2(LP_METHOD_NM, strlen(LP_METHOD_NM), &h1, &h2); bj_hashlittle2(LP_METHOD_NM, strlen(LP_METHOD_NM), &h1, &h2);
router_magic_num = h1 + h2; router_magic_num = h1 + h2;
......
...@@ -859,11 +859,10 @@ static void packet_generate( nodes_state * s, ...@@ -859,11 +859,10 @@ static void packet_generate( nodes_state * s,
s->packet_counter++; s->packet_counter++;
if(msg->packet_ID == TRACE) /*if(msg->packet_ID == TRACE)
printf("\n packet generated %lld at lp %d dest %d final dest %d chunk_id %d num_chunks %d", msg->packet_ID, (int)lp->gid, (int)dst_lp, (int)msg->dest_lp, msg->chunk_id, num_chunks); printf("\n packet generated %lld at lp %d dest %d final dest %d chunk_id %d num_chunks %d", msg->packet_ID, (int)lp->gid, (int)dst_lp, (int)msg->dest_lp, msg->chunk_id, num_chunks); */
ts = codes_local_latency(lp); ts = codes_local_latency(lp);
printf("\n Packet send after %f ", ts);
void *m_data; void *m_data;
e_h = model_net_method_event_new(lp->gid, ts, lp, TORUS, (void**)&m, e_h = model_net_method_event_new(lp->gid, ts, lp, TORUS, (void**)&m,
...@@ -891,6 +890,7 @@ static void packet_generate( nodes_state * s, ...@@ -891,6 +890,7 @@ static void packet_generate( nodes_state * s,
if(chunk_id < num_chunks - 1) if(chunk_id < num_chunks - 1)
{ {
bf->c1 = 1;
/* Issue another packet generate event */ /* Issue another packet generate event */
tw_event * e_gen; tw_event * e_gen;
nodes_message * m_gen; nodes_message * m_gen;
...@@ -1201,8 +1201,12 @@ static void node_rc_handler(nodes_state * s, tw_bf * bf, nodes_message * msg, tw ...@@ -1201,8 +1201,12 @@ static void node_rc_handler(nodes_state * s, tw_bf * bf, nodes_message * msg, tw
if(!num_chunks) if(!num_chunks)
num_chunks = 1; num_chunks = 1;
//s->next_flit_generate_time[(saved_dim * 2) + saved_dir][0] = msg->saved_available_time; //s->next_flit_generate_time[(saved_dim * 2) + saved_dir][0] = msg->saved_available_time;
tw_rand_reverse_unif(lp->rng); codes_local_latency_reverse(lp);
mn_stats* stat;
if(bf->c1)
codes_local_latency_reverse(lp);
mn_stats* stat;
stat = model_net_find_stats(msg->category, s->torus_stats_array); stat = model_net_find_stats(msg->category, s->torus_stats_array);
stat->send_count--; stat->send_count--;
stat->send_bytes -= msg->packet_size; stat->send_bytes -= msg->packet_size;
......
...@@ -2,10 +2,10 @@ LPGROUPS ...@@ -2,10 +2,10 @@ LPGROUPS
{ {
MODELNET_GRP MODELNET_GRP
{ {
repetitions="33"; repetitions="36";
server="32"; server="2";
modelnet_dragonfly="32"; modelnet_dragonfly="2";
dragonfly_router="8"; dragonfly_router="1";
} }
} }
PARAMS PARAMS
...@@ -17,7 +17,7 @@ PARAMS ...@@ -17,7 +17,7 @@ PARAMS
chunk_size="32"; chunk_size="32";
# modelnet_scheduler="round-robin"; # modelnet_scheduler="round-robin";
num_vcs="1"; num_vcs="1";
num_routers="8"; num_routers="4";
local_vc_size="32768"; local_vc_size="32768";
global_vc_size="65536"; global_vc_size="65536";
cn_vc_size="32768"; cn_vc_size="32768";
......
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