Commit 8c1f323e authored by Jonathan Jenkins's avatar Jonathan Jenkins

Updating modelnet to the new codes-mapping API

parent 7f9d96d1
This diff is collapsed.
......@@ -417,7 +417,7 @@ static void handle_msg_start_event(
mn_stats* stat;
int mapping_grp_id, mapping_type_id, mapping_rep_id, mapping_offset;
tw_lpid dest_id;
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
char lp_group_name[MAX_NAME_LENGTH];
int total_event_size;
double xmit_time;
struct param_table_entry *param;
......@@ -462,8 +462,11 @@ 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 */
codes_mapping_get_lp_info(m->final_dest_gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id , mapping_offset, &dest_id);
// 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, NULL, 1,
mapping_rep_id, mapping_offset, &dest_id);
void *m_data;
// printf("\n msg start sending to %d ", dest_id);
......@@ -529,13 +532,6 @@ static tw_stime loggp_packet_event(
tw_stime xfer_to_nic_time;
loggp_message * msg;
char* tmp_ptr;
#if 0
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
int mapping_grp_id, mapping_rep_id, mapping_type_id, mapping_offset;
codes_mapping_get_lp_info(sender->gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id, mapping_offset, &dest_id);
#endif
xfer_to_nic_time = codes_local_latency(sender);
e_new = model_net_method_event_new(sender->gid, xfer_to_nic_time+offset,
......@@ -661,12 +657,15 @@ static struct param_table_entry* find_params(uint64_t msg_size)
static tw_lpid loggp_find_local_device(tw_lp *sender)
{
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
char lp_group_name[MAX_NAME_LENGTH];
int mapping_grp_id, mapping_rep_id, mapping_type_id, mapping_offset;
tw_lpid dest_id;
codes_mapping_get_lp_info(sender->gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id, mapping_offset, &dest_id);
//TODO: be annotation-aware
codes_mapping_get_lp_info(sender->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, NULL, 1,
mapping_rep_id, mapping_offset, &dest_id);
return(dest_id);
}
......
......@@ -138,11 +138,14 @@ void model_net_base_lp_init(
model_net_base_state * ns,
tw_lp * lp){
// obtain the underlying lp type through codes-mapping
char grp_name[MAX_NAME_LENGTH], lp_type_name[MAX_NAME_LENGTH];
int grp_id, lp_type_id, grp_rep_id, offset;
codes_mapping_get_lp_info(lp->gid, grp_name, &grp_id, &lp_type_id,
lp_type_name, &grp_rep_id, &offset);
char lp_type_name[MAX_NAME_LENGTH];
int dummy;
// TODO: ignoring annotation to get things up and running, but we'll want
// to actually have a sane design here at some point
// we only need the lp type name for this lp
codes_mapping_get_lp_info(lp->gid, NULL, &dummy,
lp_type_name, &dummy, NULL, &dummy, &dummy);
// find the corresponding method name / index
for (int i = 0; i < MAX_NETS; i++){
......
......@@ -60,7 +60,9 @@ static int sn_get_msg_sz(void);
/* Returns the simplenet magic number */
static int sn_get_magic();
#if SIMPLENET_DEBUG
static void print_msg(sn_message *m);
#endif
/* collective network calls */
static void simple_net_collective();
......@@ -423,9 +425,9 @@ static void handle_msg_start_event(
sn_message *m_new;
tw_stime send_queue_time = 0;
mn_stats* stat;
int mapping_grp_id, mapping_type_id, mapping_rep_id, mapping_offset;
int mapping_rep_id, mapping_offset, dummy;
tw_lpid dest_id;
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
char lp_group_name[MAX_NAME_LENGTH];
int total_event_size;
total_event_size = model_net_get_msg_sz(SIMPLENET) + m->event_size_bytes +
......@@ -456,8 +458,11 @@ static void handle_msg_start_event(
/* create new event to send msg to receiving NIC */
codes_mapping_get_lp_info(m->final_dest_gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id , mapping_offset, &dest_id);
// 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, NULL, 1,
mapping_rep_id, mapping_offset, &dest_id);
// printf("\n msg start sending to %d ", dest_id);
void *m_data;
......@@ -527,21 +532,9 @@ static tw_stime simplenet_packet_event(
tw_event * e_new;
tw_stime xfer_to_nic_time;
sn_message * msg;
tw_lpid dest_id;
char* tmp_ptr;
#if 0
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
int mapping_grp_id, mapping_rep_id, mapping_type_id, mapping_offset;
codes_mapping_get_lp_info(sender->gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id, mapping_offset, &dest_id);
#endif
//dest_id = sender->gid;
dest_id = src_lp;
xfer_to_nic_time = codes_local_latency(sender);
//e_new = tw_event_new(dest_id, xfer_to_nic_time+offset, sender);
//msg = tw_event_data(e_new);
// this is a self message
e_new = model_net_method_event_new(sender->gid, xfer_to_nic_time+offset,
sender, SIMPLENET, (void**)&msg, (void**)&tmp_ptr);
......@@ -556,10 +549,6 @@ static tw_stime simplenet_packet_event(
msg->is_pull = is_pull;
msg->pull_size = pull_size;
//tmp_ptr = (char*)msg;
//tmp_ptr += model_net_get_msg_sz(SIMPLENET);
//printf("\n Sending to LP %d msg magic %d ", (int)dest_id, sn_get_magic());
/*Fill in simplenet information*/
if(is_last_pckt) /* Its the last packet so pass in remote event information*/
{
......@@ -575,10 +564,7 @@ static tw_stime simplenet_packet_event(
memcpy(tmp_ptr, self_event, self_event_size);
tmp_ptr += self_event_size;
}
// printf("\n Last packet size: %d ", sn_get_msg_sz() + remote_event_size + self_event_size);
}
//print_base_from(SIMPLENET, msg);
//print_msg(msg);
tw_event_send(e_new);
return xfer_to_nic_time;
}
......@@ -587,7 +573,6 @@ static void sn_setup(const void* net_params)
{
simplenet_param* sn_param = (simplenet_param*)net_params;
sn_set_params(sn_param->net_startup_ns, sn_param->net_bw_mbps);
//printf("\n Bandwidth setup %lf %lf ", sn_param->net_startup_ns, sn_param->net_bw_mbps);
}
static void simplenet_packet_event_rc(tw_lp *sender)
......@@ -598,21 +583,26 @@ static void simplenet_packet_event_rc(tw_lp *sender)
static tw_lpid sn_find_local_device(tw_lp *sender)
{
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
int mapping_grp_id, mapping_rep_id, mapping_type_id, mapping_offset;
char lp_group_name[MAX_NAME_LENGTH];
int mapping_rep_id, mapping_offset, dummy;
tw_lpid dest_id;
codes_mapping_get_lp_info(sender->gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id, mapping_offset, &dest_id);
// TODO: don't ignore annotations
codes_mapping_get_lp_info(sender->gid, lp_group_name, &dummy, NULL,
&dummy, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, NULL, 1,
mapping_rep_id, mapping_offset, &dest_id);
return(dest_id);
}
#if SIMPLENET_DEBUG
void print_msg(sn_message *m){
printf(" sn:\n type:%d, magic:%d, src:%lu, dest:%lu, esize:%d, lsize:%d\n",
m->event_type, m->magic, m->src_gid, m->final_dest_gid,
m->event_size_bytes, m->local_event_size_bytes);
}
#endif
/*
......
......@@ -238,7 +238,7 @@ static double * parse_mat(char * buf, int *nvals_first, int *nvals_total, int is
*nvals_total = 0;
/* parse the files by line */
int line_ct, line_ct_prev;
int line_ct, line_ct_prev = 0;
char * line_save;
char * line = strtok_r(buf, "\r\n", &line_save);
while (line != NULL){
......@@ -310,8 +310,8 @@ static void sw_set_params(char * startup_fname, char * bw_fname){
sbuf[fsize_s] = '\0';
char *bbuf = malloc(fsize_b+1);
bbuf[fsize_b] = '\0';
fread(sbuf, 1, fsize_s, sf);
fread(bbuf, 1, fsize_b, bf);
assert(fread(sbuf, 1, fsize_s, sf) == fsize_s);
assert(fread(bbuf, 1, fsize_b, bf) == fsize_b);
fclose(sf);
fclose(bf);
......@@ -357,12 +357,13 @@ static void sw_init(
sw_magic = h1+h2;
/* printf("\n sw_magic %d ", sw_magic); */
/* inititalize logical ID */
ns->id = codes_mapping_get_lp_global_rel_id(lp->gid);
/* inititalize global logical ID
* TODO: be annotation aware */
ns->id = codes_mapping_get_lp_relative_id(lp->gid, 0, 0);
/* get the total number of simplewans */
if (num_lps == -1){
num_lps = codes_mapping_get_global_lp_count(LP_CONFIG_NM);
num_lps = codes_mapping_get_lp_count(NULL, 0, LP_CONFIG_NM, NULL, 1);
assert(num_lps > 0);
if (mat_len == -1){
tw_error(TW_LOC, "Simplewan config matrix not initialized "
......@@ -651,9 +652,9 @@ static void handle_msg_start_event(
sw_message *m_new;
tw_stime send_queue_time = 0;
mn_stats* stat;
int mapping_grp_id, mapping_type_id, mapping_rep_id, mapping_offset;
int mapping_rep_id, mapping_offset, dummy;
tw_lpid dest_id;
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
char lp_group_name[MAX_NAME_LENGTH];
int total_event_size;
int dest_rel_id;
double bw, startup;
......@@ -661,9 +662,12 @@ 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, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id , mapping_offset, &dest_id);
dest_rel_id = codes_mapping_get_lp_global_rel_id(dest_id);
// 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, NULL, 1,
mapping_rep_id, mapping_offset, &dest_id);
dest_rel_id = codes_mapping_get_lp_relative_id(dest_id, 0, 0);
m->dest_mn_rel_id = dest_rel_id;
/* grab the link params */
......@@ -796,28 +800,17 @@ static tw_stime simplewan_packet_event(
tw_event * e_new;
tw_stime xfer_to_nic_time;
sw_message * msg;
tw_lpid dest_id;
char* tmp_ptr;
#if 0
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
int mapping_grp_id, mapping_rep_id, mapping_type_id, mapping_offset;
codes_mapping_get_lp_info(sender->gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id, mapping_offset, &dest_id);
#endif
dest_id = src_lp;
xfer_to_nic_time = codes_local_latency(sender);
#if SIMPLEWAN_DEBUG
printf("%lu: final %lu packet sz %d remote sz %d self sz %d is_last_pckt %d latency %lf\n",
(dest_id - 1) / 2, final_dest_lp, packet_size,
(src_lp - 1) / 2, final_dest_lp, packet_size,
remote_event_size, self_event_size, is_last_pckt,
xfer_to_nic_time+offset);
#endif
//e_new = tw_event_new(dest_id, xfer_to_nic_time+offset, sender);
//msg = tw_event_data(e_new);
e_new = model_net_method_event_new(sender->gid, xfer_to_nic_time+offset,
sender, SIMPLEWAN, (void**)&msg, (void**)&tmp_ptr);
strcpy(msg->category, category);
......@@ -831,9 +824,6 @@ static tw_stime simplewan_packet_event(
msg->is_pull = is_pull;
msg->pull_size = pull_size;
//tmp_ptr = (char*)msg;
//tmp_ptr += sw_get_msg_sz();
//printf("\n Sending to LP %d msg magic %d ", (int)dest_id, sw_get_magic());
/*Fill in simplewan information*/
if(is_last_pckt) /* Its the last packet so pass in remote event information*/
......@@ -871,12 +861,13 @@ static void simplewan_packet_event_rc(tw_lp *sender)
static tw_lpid sw_find_local_device(tw_lp *sender)
{
char lp_type_name[MAX_NAME_LENGTH], lp_group_name[MAX_NAME_LENGTH];
int mapping_grp_id, mapping_rep_id, mapping_type_id, mapping_offset;
char lp_group_name[MAX_NAME_LENGTH];
int mapping_rep_id, mapping_offset, dummy;
tw_lpid dest_id;
codes_mapping_get_lp_info(sender->gid, lp_group_name, &mapping_grp_id, &mapping_type_id, lp_type_name, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, mapping_rep_id, mapping_offset, &dest_id);
// TODO: don't ignore annotation
codes_mapping_get_lp_info(sender->gid, lp_group_name, &dummy, NULL, &dummy, NULL, &mapping_rep_id, &mapping_offset);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM, NULL, 1, mapping_rep_id, mapping_offset, &dest_id);
return(dest_id);
}
......
This diff is collapsed.
......@@ -156,11 +156,13 @@ int main(
codes_mapping_setup();
num_servers = codes_mapping_get_group_reps("MODELNET_GRP") * codes_mapping_get_lp_count("MODELNET_GRP", "server");
num_servers = codes_mapping_get_lp_count("MODELNET_GRP", 0, "server",
NULL, 1);
assert(num_servers == 2);
if(net_id == DRAGONFLY)
{
num_routers = codes_mapping_get_group_reps("MODELNET_GRP") * codes_mapping_get_lp_count("MODELNET_GRP", "dragonfly_router");
num_routers = codes_mapping_get_lp_count("MODELNET_GRP", 0,
"dragonfly_router", NULL, 1);
offset = 1;
}
......@@ -207,7 +209,7 @@ static void svr_init(
/* find my own server index */
codes_mapping_get_lp_info(lp->gid, grp_name, &grp_id,
&lp_type_id, lp_type_name, &grp_rep_id, &offset);
lp_type_name, &lp_type_id, NULL, &grp_rep_id, &offset);
ns->svr_idx = grp_rep_id;
/* first server sends a dummy event to itself that will kick off the real
......@@ -381,7 +383,7 @@ static void handle_pong_event(
return;
}
codes_mapping_get_lp_id("MODELNET_GRP", "server", 1,
codes_mapping_get_lp_id("MODELNET_GRP", "server", NULL, 1, 1,
0, &peer_gid);
m_remote.svr_event_type = PING;
......
......@@ -168,7 +168,8 @@ int main(
codes_mapping_setup();
num_servers = codes_mapping_get_group_reps("MODELNET_GRP") * codes_mapping_get_lp_count("MODELNET_GRP", "server");
num_servers = codes_mapping_get_lp_count("MODELNET_GRP", 0, "server",
NULL, 1);
assert(num_servers == 3);
if(lp_io_prepare("modelnet-test", LP_IO_UNIQ_SUFFIX, &handle, MPI_COMM_WORLD) < 0)
......
......@@ -168,10 +168,12 @@ int main(
codes_mapping_setup();
num_servers = codes_mapping_get_group_reps("MODELNET_GRP") * codes_mapping_get_lp_count("MODELNET_GRP", "server");
num_servers = codes_mapping_get_lp_count("MODELNET_GRP", 0, "server",
NULL, 1);
if(net_id == DRAGONFLY)
{
num_routers = codes_mapping_get_group_reps("MODELNET_GRP") * codes_mapping_get_lp_count("MODELNET_GRP", "dragonfly_router");
num_routers = codes_mapping_get_lp_count("MODELNET_GRP", 0,
"dragonfly_router", NULL, 1);
offset = 1;
}
......@@ -320,8 +322,10 @@ static void handle_kickoff_event(
/* record when transfers started on this server */
ns->start_ts = tw_now(lp);
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", "server");
num_routers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", "dragonfly_router");
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1,
"server", NULL, 1);
num_routers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1,
"dragonfly_router", NULL, 1);
lps_per_rep = num_servers_per_rep * 2 + num_routers_per_rep;
......
......@@ -179,10 +179,12 @@ int main(
codes_mapping_setup();
num_servers = codes_mapping_get_group_reps("MODELNET_GRP") * codes_mapping_get_lp_count("MODELNET_GRP", "server");
num_servers = codes_mapping_get_lp_count("MODELNET_GRP", 0, "server",
NULL, 1);
if(net_id == DRAGONFLY)
{
num_routers = codes_mapping_get_group_reps("MODELNET_GRP") * codes_mapping_get_lp_count("MODELNET_GRP", "dragonfly_router");
num_routers = codes_mapping_get_lp_count("MODELNET_GRP", 0,
"dragonfly_router", NULL, 1);
offset = 1;
}
......@@ -336,8 +338,10 @@ static void handle_kickoff_event(
/* record when transfers started on this server */
ns->start_ts = tw_now(lp);
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", "server");
num_routers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", "dragonfly_router");
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1,
"server", NULL, 1);
num_routers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1,
"dragonfly_router", NULL, 1);
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