Commit 6977a81c authored by Jonathan Jenkins's avatar Jonathan Jenkins

use a default sender->nic mapping function; some refactors

NOTES:
- torus does not use it, as it has some routing logic preventing direct usage.
  It probably can be done, but I'll leave that for later.
- collectives in torus, dragonfly don't use it yet.
parent c556c444
......@@ -58,7 +58,7 @@ struct model_net_method
tw_lpid (*model_net_method_find_local_device)(
const char * annotation,
int ignore_annotations,
tw_lp * sender);
tw_lpid sender_gid);
void (*mn_collective_call)(char* category, int message_size, int remote_event_size, const void* remote_event, tw_lp* sender);
void (*mn_collective_call_rc)(int message_size, tw_lp* sender);
};
......
......@@ -208,7 +208,7 @@ tw_lpid model_net_find_local_device(
int net_id,
const char * annotation,
int ignore_annotations,
tw_lp * sender);
tw_lpid sender_gid);
int model_net_get_msg_sz(int net_id);
......
......@@ -539,10 +539,8 @@ void router_credit_send(router_state * s, tw_bf * bf, terminal_message * msg, tw
void packet_generate(terminal_state * s, tw_bf * bf, terminal_message * msg, tw_lp * lp)
{
tw_lpid dest_terminal_id;
codes_mapping_get_lp_info(msg->final_dest_gid, lp_group_name, &mapping_grp_id,
NULL, &mapping_type_id, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, s->anno, 0,
mapping_rep_id, mapping_offset, &dest_terminal_id);
dest_terminal_id = model_net_find_local_device(DRAGONFLY, s->anno, 0,
msg->final_dest_gid);
msg->dest_terminal_id = dest_terminal_id;
const dragonfly_param *p = s->params;
......@@ -1839,7 +1837,7 @@ struct model_net_method dragonfly_method =
.mn_get_lp_type = dragonfly_get_cn_lp_type,
.mn_get_msg_sz = dragonfly_get_msg_sz,
.mn_report_stats = dragonfly_report_stats,
.model_net_method_find_local_device = dragonfly_find_local_device,
.model_net_method_find_local_device = NULL,
.mn_collective_call = dragonfly_collective,
.mn_collective_call_rc = dragonfly_collective_rc
};
......
......@@ -162,7 +162,7 @@ struct model_net_method loggp_method =
.mn_get_lp_type = loggp_get_lp_type,
.mn_get_msg_sz = loggp_get_msg_sz,
.mn_report_stats = loggp_report_stats,
.model_net_method_find_local_device = loggp_find_local_device,
.model_net_method_find_local_device = NULL,
.mn_collective_call = loggp_collective,
.mn_collective_call_rc = loggp_collective_rc
};
......@@ -541,11 +541,8 @@ static void handle_msg_start_event(
ns->net_send_next_idle += xmit_time + param->g*1000.0;
/* create new event to send msg to receiving NIC */
// TODO: make annotation-aware
codes_mapping_get_lp_info(m->final_dest_gid, lp_group_name, &mapping_grp_id,
NULL, &mapping_type_id, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, ns->anno, 0,
mapping_rep_id, mapping_offset, &dest_id);
dest_id = model_net_find_local_device(LOGGP, ns->anno, 0,
m->final_dest_gid);
dprintf("%lu (mn): start msg %lu->%lu, size %lu (%3s last)\n"
" now:%0.3le, idle[prev:%0.3le, next:%0.3le], "
......
......@@ -246,7 +246,7 @@ static void model_net_event_impl_base(
}
tw_lpid mn_lp = model_net_find_local_device(net_id, annotation,
ignore_annotations, sender);
ignore_annotations, sender->gid);
tw_stime poffset = codes_local_latency(sender);
if (in_sequence){
tw_stime tmp = mn_msg_offset;
......@@ -477,14 +477,38 @@ void model_net_report_stats(int net_id)
return;
}
static tw_lpid model_net_find_local_device_default(
int net_id,
const char * annotation,
int ignore_annotations,
tw_lpid sender_gid) {
char group_name[MAX_NAME_LENGTH];
int dummy, mapping_rep, mapping_offset;
int num_mn_lps;
tw_lpid rtn;
codes_mapping_get_lp_info(sender_gid, group_name, &dummy, NULL, &dummy,
NULL, &mapping_rep, &mapping_offset);
num_mn_lps = codes_mapping_get_lp_count(group_name, 1,
model_net_lp_config_names[net_id], annotation, ignore_annotations);
codes_mapping_get_lp_id(group_name, model_net_lp_config_names[net_id],
annotation, ignore_annotations, mapping_rep,
mapping_offset % num_mn_lps, &rtn);
return rtn;
}
tw_lpid model_net_find_local_device(
int net_id,
const char * annotation,
int ignore_annotations,
tw_lp * sender)
tw_lpid sender_gid)
{
return(method_array[net_id]->model_net_method_find_local_device(annotation,
ignore_annotations, sender));
if (method_array[net_id]->model_net_method_find_local_device == NULL)
return model_net_find_local_device_default(net_id, annotation,
ignore_annotations, sender_gid);
else
return(method_array[net_id]->model_net_method_find_local_device(
annotation, ignore_annotations, sender_gid));
}
/*
......
......@@ -128,7 +128,7 @@ struct model_net_method simplenet_method =
.mn_get_lp_type = sn_get_lp_type,
.mn_get_msg_sz = sn_get_msg_sz,
.mn_report_stats = sn_report_stats,
.model_net_method_find_local_device = sn_find_local_device,
.model_net_method_find_local_device = NULL, /* use the default */
.mn_collective_call = simple_net_collective,
.mn_collective_call_rc = simple_net_collective_rc
};
......@@ -471,11 +471,8 @@ static void handle_msg_start_event(
/* create new event to send msg to receiving NIC */
// TODO: don't ignore annotations
codes_mapping_get_lp_info(m->final_dest_gid, lp_group_name, &dummy, NULL,
&dummy, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, ns->anno, 0,
mapping_rep_id, mapping_offset, &dest_id);
dest_id = model_net_find_local_device(SIMPLENET, ns->anno, 0,
m->final_dest_gid);
// printf("\n msg start sending to %d ", dest_id);
void *m_data;
......
......@@ -158,7 +158,7 @@ struct model_net_method simplewan_method =
.mn_get_lp_type = sw_get_lp_type,
.mn_get_msg_sz = sw_get_msg_sz,
.mn_report_stats = sw_report_stats,
.model_net_method_find_local_device = sw_find_local_device,
.model_net_method_find_local_device = NULL,
.mn_collective_call = simple_wan_collective,
.mn_collective_call_rc = simple_wan_collective_rc
};
......@@ -677,10 +677,8 @@ static void handle_msg_start_event(
total_event_size = model_net_get_msg_sz(SIMPLEWAN) + m->event_size_bytes +
m->local_event_size_bytes;
codes_mapping_get_lp_info(m->final_dest_gid, lp_group_name, &dummy,
NULL, &dummy, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, ns->anno, 0,
mapping_rep_id, mapping_offset, &dest_id);
dest_id = model_net_find_local_device(SIMPLEWAN, ns->anno, 0,
m->final_dest_gid);
dest_rel_id = codes_mapping_get_lp_relative_id(dest_id, 0, 0);
m->dest_mn_rel_id = dest_rel_id;
......
......@@ -822,10 +822,9 @@ static void packet_generate( nodes_state * s,
int mapping_grp_id, mapping_rep_id, mapping_type_id, mapping_offset;
tw_lpid dst_lp;
// TODO: be annotation-aware
codes_mapping_get_lp_info(msg->final_dest_gid, grp_name, &mapping_grp_id, NULL,
&mapping_type_id, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(grp_name, LP_CONFIG_NM, s->anno, 0, mapping_rep_id,
mapping_offset, &dst_lp);
dst_lp = model_net_find_local_device(TORUS, s->anno, 0,
msg->final_dest_gid);
//mapping_offset, &dst_lp);
// dest_lp gets included to other required msgs through memcpys, so just
// set here
msg->dest_lp = dst_lp;
......@@ -1349,7 +1348,7 @@ struct model_net_method torus_method =
.mn_get_lp_type = torus_get_lp_type,
.mn_get_msg_sz = torus_get_msg_sz,
.mn_report_stats = torus_report_stats,
.model_net_method_find_local_device = torus_find_local_device,
.model_net_method_find_local_device = NULL,
.mn_collective_call = torus_collective,
.mn_collective_call_rc = torus_collective_rc
};
......
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