Commit 8034222d authored by Jonathan Jenkins's avatar Jonathan Jenkins

modelnetify dragonfly router LP

parent 8d8d4392
...@@ -971,8 +971,8 @@ void router_credit_send(router_state * s, terminal_message * msg, ...@@ -971,8 +971,8 @@ void router_credit_send(router_state * s, terminal_message * msg,
(void**)&buf_msg, NULL); (void**)&buf_msg, NULL);
buf_msg->magic = terminal_magic_num; buf_msg->magic = terminal_magic_num;
} else { } else {
buf_e = tw_event_new(dest, ts , lp); buf_e = model_net_method_event_new(dest, ts, lp, DRAGONFLY_ROUTER,
buf_msg = tw_event_data(buf_e); (void**)&buf_msg, NULL);
buf_msg->magic = router_magic_num; buf_msg->magic = router_magic_num;
} }
...@@ -1190,15 +1190,15 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1190,15 +1190,15 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
//TODO: be annotation-aware //TODO: be annotation-aware
codes_mapping_get_lp_info(lp->gid, lp_group_name, &mapping_grp_id, NULL, codes_mapping_get_lp_info(lp->gid, lp_group_name, &mapping_grp_id, NULL,
&mapping_type_id, NULL, &mapping_rep_id, &mapping_offset); &mapping_type_id, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, "dragonfly_router", NULL, 1, codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM_ROUT, NULL, 1,
s->router_id, 0, &router_id); s->router_id, 0, &router_id);
// we are sending an event to the router, so no method_event here // we are sending an event to the router, so no method_event here
e = tw_event_new(router_id, s->terminal_available_time - tw_now(lp), lp); void * remote_event;
m = tw_event_data(e); e = model_net_method_event_new(router_id, s->terminal_available_time - tw_now(lp), lp,
DRAGONFLY_ROUTER, (void**)&m, &remote_event);
memcpy(m, &cur_entry->msg, sizeof(terminal_message)); memcpy(m, &cur_entry->msg, sizeof(terminal_message));
if (m->remote_event_size_bytes){ if (m->remote_event_size_bytes){
memcpy(model_net_method_get_edata(DRAGONFLY, m), cur_entry->event_data, memcpy(remote_event, cur_entry->event_data, m->remote_event_size_bytes);
m->remote_event_size_bytes);
} }
m->type = R_ARRIVE; m->type = R_ARRIVE;
...@@ -1223,7 +1223,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1223,7 +1223,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
bf->c2 = 1; bf->c2 = 1;
ts = codes_local_latency(lp); ts = codes_local_latency(lp);
tw_event *e_new = tw_event_new(cur_entry->msg.sender_lp, ts, lp); tw_event *e_new = tw_event_new(cur_entry->msg.sender_lp, ts, lp);
terminal_message* m_new = tw_event_data(e_new); void * m_new = tw_event_data(e_new);
void *local_event = (char*)cur_entry->event_data + void *local_event = (char*)cur_entry->event_data +
cur_entry->msg.remote_event_size_bytes; cur_entry->msg.remote_event_size_bytes;
memcpy(m_new, local_event, cur_entry->msg.local_event_size_bytes); memcpy(m_new, local_event, cur_entry->msg.local_event_size_bytes);
...@@ -1410,8 +1410,8 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg, ...@@ -1410,8 +1410,8 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
// no method_event here - message going to router // no method_event here - message going to router
tw_event * buf_e; tw_event * buf_e;
terminal_message * buf_msg; terminal_message * buf_msg;
buf_e = tw_event_new(msg->intm_lp_id, ts, lp); buf_e = model_net_method_event_new(msg->intm_lp_id, ts, lp,
buf_msg = tw_event_data(buf_e); DRAGONFLY_ROUTER, (void**)&buf_msg, NULL);
buf_msg->magic = router_magic_num; buf_msg->magic = router_magic_num;
buf_msg->vc_index = msg->vc_index; buf_msg->vc_index = msg->vc_index;
buf_msg->output_chan = msg->output_chan; buf_msg->output_chan = msg->output_chan;
...@@ -2083,7 +2083,7 @@ get_next_stop(router_state * s, ...@@ -2083,7 +2083,7 @@ get_next_stop(router_state * s,
} }
if(s->group_id == dest_group_id) if(s->group_id == dest_group_id)
{ {
codes_mapping_get_lp_id(lp_group_name, "dragonfly_router", s->anno, 0, dest_router_id, codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM_ROUT, s->anno, 0, dest_router_id,
0, &router_dest_id); 0, &router_dest_id);
return router_dest_id; return router_dest_id;
} }
...@@ -2124,7 +2124,7 @@ get_next_stop(router_state * s, ...@@ -2124,7 +2124,7 @@ get_next_stop(router_state * s,
} }
#endif #endif
} }
codes_mapping_get_lp_id(lp_group_name, "dragonfly_router", s->anno, 0, dest_lp, codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM_ROUT, s->anno, 0, dest_lp,
0, &router_dest_id); 0, &router_dest_id);
return router_dest_id; return router_dest_id;
...@@ -2356,7 +2356,7 @@ router_packet_receive( router_state * s, ...@@ -2356,7 +2356,7 @@ router_packet_receive( router_state * s,
} }
if(msg->remote_event_size_bytes > 0) { if(msg->remote_event_size_bytes > 0) {
void *m_data_src = model_net_method_get_edata(DRAGONFLY, msg); void *m_data_src = model_net_method_get_edata(DRAGONFLY_ROUTER, msg);
cur_chunk->event_data = (char*)malloc(msg->remote_event_size_bytes); cur_chunk->event_data = (char*)malloc(msg->remote_event_size_bytes);
memcpy(cur_chunk->event_data, m_data_src, msg->remote_event_size_bytes); memcpy(cur_chunk->event_data, m_data_src, msg->remote_event_size_bytes);
} }
...@@ -2401,8 +2401,8 @@ router_packet_receive( router_state * s, ...@@ -2401,8 +2401,8 @@ router_packet_receive( router_state * s,
bf->c3 = 1; bf->c3 = 1;
terminal_message *m; terminal_message *m;
ts = codes_local_latency(lp); ts = codes_local_latency(lp);
tw_event *e = tw_event_new(lp->gid, ts, lp); tw_event *e = model_net_method_event_new(lp->gid, ts, lp,
m = tw_event_data(e); DRAGONFLY_ROUTER, (void**)&m, NULL);
m->type = R_SEND; m->type = R_SEND;
m->magic = router_magic_num; m->magic = router_magic_num;
m->vc_index = output_port; m->vc_index = output_port;
...@@ -2546,10 +2546,9 @@ router_packet_send( router_state * s, ...@@ -2546,10 +2546,9 @@ router_packet_send( router_state * s,
s->next_output_available_time[output_port] - tw_now(lp), lp, s->next_output_available_time[output_port] - tw_now(lp), lp,
DRAGONFLY, (void**)&m, &m_data); DRAGONFLY, (void**)&m, &m_data);
} else { } else {
e = tw_event_new(cur_entry->msg.next_stop, e = model_net_method_event_new(cur_entry->msg.next_stop,
s->next_output_available_time[output_port] - tw_now(lp), lp); s->next_output_available_time[output_port] - tw_now(lp), lp,
m = tw_event_data(e); DRAGONFLY_ROUTER, (void**)&m, &m_data);
m_data = model_net_method_get_edata(DRAGONFLY, m);
} }
memcpy(m, &cur_entry->msg, sizeof(terminal_message)); memcpy(m, &cur_entry->msg, sizeof(terminal_message));
if (m->remote_event_size_bytes){ if (m->remote_event_size_bytes){
...@@ -2613,8 +2612,8 @@ router_packet_send( router_state * s, ...@@ -2613,8 +2612,8 @@ router_packet_send( router_state * s,
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 + delay + tw_rand_unif(lp->rng);
e = tw_event_new(lp->gid, ts, lp); e = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY_ROUTER,
m_new = tw_event_data(e); (void**)&m_new, NULL);
m_new->type = R_SEND; m_new->type = R_SEND;
m_new->magic = router_magic_num; m_new->magic = router_magic_num;
m_new->vc_index = output_port; m_new->vc_index = output_port;
...@@ -2682,8 +2681,8 @@ void router_buf_update(router_state * s, tw_bf * bf, terminal_message * msg, tw_ ...@@ -2682,8 +2681,8 @@ void router_buf_update(router_state * s, tw_bf * bf, terminal_message * msg, tw_
bf->c2 = 1; bf->c2 = 1;
terminal_message *m; terminal_message *m;
tw_stime ts = codes_local_latency(lp); tw_stime ts = codes_local_latency(lp);
tw_event *e = tw_event_new(lp->gid, ts, lp); tw_event *e = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY_ROUTER,
m = tw_event_data(e); (void**)&m, NULL);
m->type = R_SEND; m->type = R_SEND;
m->vc_index = indx; m->vc_index = indx;
m->magic = router_magic_num; m->magic = router_magic_num;
...@@ -2829,7 +2828,6 @@ static const tw_lptype* router_get_lp_type(void) ...@@ -2829,7 +2828,6 @@ static const tw_lptype* router_get_lp_type(void)
static void dragonfly_register(tw_lptype *base_type) { static void dragonfly_register(tw_lptype *base_type) {
lp_type_register(LP_CONFIG_NM_TERM, base_type); lp_type_register(LP_CONFIG_NM_TERM, base_type);
lp_type_register("dragonfly_router", &dragonfly_lps[1]);
} }
static void router_register(tw_lptype *base_type) { static void router_register(tw_lptype *base_type) {
...@@ -2849,7 +2847,11 @@ struct model_net_method dragonfly_method = ...@@ -2849,7 +2847,11 @@ struct model_net_method dragonfly_method =
.mn_get_msg_sz = dragonfly_get_msg_sz, .mn_get_msg_sz = dragonfly_get_msg_sz,
.mn_report_stats = dragonfly_report_stats, .mn_report_stats = dragonfly_report_stats,
.mn_collective_call = dragonfly_collective, .mn_collective_call = dragonfly_collective,
.mn_collective_call_rc = dragonfly_collective_rc .mn_collective_call_rc = dragonfly_collective_rc,
.mn_sample_fn = NULL,
.mn_sample_rc_fn = NULL,
.mn_sample_init_fn = NULL,
.mn_sample_fini_fn = NULL
}; };
struct model_net_method dragonfly_router_method = struct model_net_method dragonfly_router_method =
...@@ -2864,5 +2866,9 @@ struct model_net_method dragonfly_router_method = ...@@ -2864,5 +2866,9 @@ struct model_net_method dragonfly_router_method =
.mn_get_msg_sz = dragonfly_get_msg_sz, .mn_get_msg_sz = dragonfly_get_msg_sz,
.mn_report_stats = NULL, // not yet supported .mn_report_stats = NULL, // not yet supported
.mn_collective_call = NULL, .mn_collective_call = NULL,
.mn_collective_call_rc = NULL .mn_collective_call_rc = NULL,
.mn_sample_fn = NULL,
.mn_sample_rc_fn = NULL,
.mn_sample_init_fn = NULL,
.mn_sample_fini_fn = NULL
}; };
...@@ -254,6 +254,9 @@ void model_net_base_configure(){ ...@@ -254,6 +254,9 @@ void model_net_base_configure(){
offsetof(model_net_wrap_msg, msg.m_torus); offsetof(model_net_wrap_msg, msg.m_torus);
msg_offsets[DRAGONFLY] = msg_offsets[DRAGONFLY] =
offsetof(model_net_wrap_msg, msg.m_dfly); offsetof(model_net_wrap_msg, msg.m_dfly);
// note: dragonfly router uses the same event struct
msg_offsets[DRAGONFLY_ROUTER] =
offsetof(model_net_wrap_msg, msg.m_dfly);
msg_offsets[LOGGP] = msg_offsets[LOGGP] =
offsetof(model_net_wrap_msg, msg.m_loggp); offsetof(model_net_wrap_msg, msg.m_loggp);
......
...@@ -84,7 +84,10 @@ int* model_net_configure(int *id_count){ ...@@ -84,7 +84,10 @@ int* model_net_configure(int *id_count){
*id_count = 0; *id_count = 0;
for (int i = 0; i < MAX_NETS; i++) { for (int i = 0; i < MAX_NETS; i++) {
if (do_config_nets[i]){ if (do_config_nets[i]){
method_array[i]->mn_configure(); // some don't need configuration (dragonfly router is covered by
// dragonfly)
if (method_array[i]->mn_configure != NULL)
method_array[i]->mn_configure();
(*id_count)++; (*id_count)++;
} }
} }
......
...@@ -5,13 +5,13 @@ LPGROUPS ...@@ -5,13 +5,13 @@ LPGROUPS
repetitions="36"; repetitions="36";
server="2"; server="2";
modelnet_dragonfly="2"; modelnet_dragonfly="2";
dragonfly_router="1"; modelnet_dragonfly_router="1";
} }
} }
PARAMS PARAMS
{ {
packet_size="512"; packet_size="512";
modelnet_order=( "dragonfly" ); modelnet_order=( "dragonfly","dragonfly_router" );
# scheduler options # scheduler options
modelnet_scheduler="fcfs"; modelnet_scheduler="fcfs";
chunk_size="32"; chunk_size="32";
......
...@@ -168,7 +168,7 @@ int main( ...@@ -168,7 +168,7 @@ int main(
codes_mapping_setup(); codes_mapping_setup();
net_ids = model_net_configure(&num_nets); net_ids = model_net_configure(&num_nets);
assert(num_nets==1); assert(num_nets>=1);
net_id = *net_ids; net_id = *net_ids;
free(net_ids); free(net_ids);
...@@ -177,7 +177,7 @@ int main( ...@@ -177,7 +177,7 @@ int main(
if(net_id == DRAGONFLY) if(net_id == DRAGONFLY)
{ {
num_routers = codes_mapping_get_lp_count("MODELNET_GRP", 0, num_routers = codes_mapping_get_lp_count("MODELNET_GRP", 0,
"dragonfly_router", NULL, 1); "modelnet_dragonfly_router", NULL, 1);
offset = 1; offset = 1;
} }
...@@ -335,7 +335,7 @@ static void handle_kickoff_event( ...@@ -335,7 +335,7 @@ static void handle_kickoff_event(
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1, num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1,
"server", NULL, 1); "server", NULL, 1);
num_routers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1, num_routers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1,
"dragonfly_router", NULL, 1); "modelnet_dragonfly_router", NULL, 1);
lps_per_rep = num_servers_per_rep * 2 + num_routers_per_rep; lps_per_rep = num_servers_per_rep * 2 + num_routers_per_rep;
......
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