Commit 7b80ed8a authored by Misbah Mubarak's avatar Misbah Mubarak

Adding sampling examples in synthetic workload test program, fixing a reverse...

Adding sampling examples in synthetic workload test program, fixing a reverse handler bug in synthetic workload test
parent 043fa973
...@@ -163,7 +163,10 @@ static void handle_kickoff_rev_event( ...@@ -163,7 +163,10 @@ static void handle_kickoff_rev_event(
if(m->incremented_flag) if(m->incremented_flag)
return; return;
model_net_event_rc(net_id, lp, PAYLOAD_SZ); if(b->c1)
tw_rand_reverse_unif(lp->rng);
model_net_event_rc(net_id, lp, PAYLOAD_SZ);
ns->msg_sent_count--; ns->msg_sent_count--;
tw_rand_reverse_unif(lp->rng); tw_rand_reverse_unif(lp->rng);
} }
...@@ -194,16 +197,14 @@ static void handle_kickoff_event( ...@@ -194,16 +197,14 @@ static void handle_kickoff_event(
m_remote->svr_event_type = REMOTE; m_remote->svr_event_type = REMOTE;
assert(net_id == DRAGONFLY); /* only supported for dragonfly model right now. */ assert(net_id == DRAGONFLY); /* only supported for dragonfly model right now. */
ns->start_ts = tw_now(lp); ns->start_ts = tw_now(lp);
codes_mapping_get_lp_info(lp->gid, group_name, &group_index, lp_type_name, &lp_type_index, anno, &rep_id, &offset);
codes_mapping_get_lp_info(lp->gid, group_name, &group_index, lp_type_name, &lp_type_index, anno, &rep_id, &offset); int local_id = codes_mapping_get_lp_relative_id(lp->gid, 0, 0);
int local_id = codes_mapping_get_lp_relative_id(lp->gid, 0, 0);
/* in case of uniform random traffic, send to a random destination. */ /* in case of uniform random traffic, send to a random destination. */
if(traffic == UNIFORM) if(traffic == UNIFORM)
{ {
b->c1 = 1;
local_dest = tw_rand_integer(lp->rng, 0, num_nodes - 1); local_dest = tw_rand_integer(lp->rng, 0, num_nodes - 1);
} }
else if(traffic == NEAREST_GROUP) else if(traffic == NEAREST_GROUP)
...@@ -367,7 +368,7 @@ int main( ...@@ -367,7 +368,7 @@ int main(
/* 5 days of simulation time */ /* 5 days of simulation time */
g_tw_ts_end = s_to_ns(5 * 24 * 60 * 60); g_tw_ts_end = s_to_ns(5 * 24 * 60 * 60);
//model_net_enable_sampling(8000, 10000); model_net_enable_sampling(8000, 16000);
if(net_id != DRAGONFLY) if(net_id != DRAGONFLY)
{ {
......
...@@ -80,6 +80,9 @@ FILE * dragonfly_log = NULL; ...@@ -80,6 +80,9 @@ FILE * dragonfly_log = NULL;
int sample_bytes_written = 0; int sample_bytes_written = 0;
int sample_rtr_bytes_written = 0; int sample_rtr_bytes_written = 0;
char cn_sample_file[MAX_NAME_LENGTH];
char router_sample_file[MAX_NAME_LENGTH];
typedef struct terminal_message_list terminal_message_list; typedef struct terminal_message_list terminal_message_list;
struct terminal_message_list { struct terminal_message_list {
terminal_message msg; terminal_message msg;
...@@ -521,6 +524,11 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){ ...@@ -521,6 +524,11 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){
configuration_get_value_double(&config, "PARAMS", "router_delay", anno, configuration_get_value_double(&config, "PARAMS", "router_delay", anno,
&p->router_delay); &p->router_delay);
configuration_get_value(&config, "PARAMS", "cn_sample_file", anno, cn_sample_file,
MAX_NAME_LENGTH);
configuration_get_value(&config, "PARAMS", "rt_sample_file", anno, router_sample_file,
MAX_NAME_LENGTH);
char routing_str[MAX_NAME_LENGTH]; char routing_str[MAX_NAME_LENGTH];
configuration_get_value(&config, "PARAMS", "routing", anno, routing_str, configuration_get_value(&config, "PARAMS", "routing", anno, routing_str,
MAX_NAME_LENGTH); MAX_NAME_LENGTH);
...@@ -1983,13 +1991,17 @@ void dragonfly_rsample_fin(router_state * s, ...@@ -1983,13 +1991,17 @@ void dragonfly_rsample_fin(router_state * s,
p->radix, p->radix); p->radix, p->radix);
fclose(fp); fclose(fp);
} }
char file_name[64]; char cn_fn[MAX_NAME_LENGTH];
sprintf(file_name, "dragonfly-router-sampling-%ld.bin", g_tw_mynode); if(strcmp(router_sample_file, "") == 0)
sprintf(cn_fn, "dragonfly-router-sampling-%ld.bin", g_tw_mynode);
else
sprintf(cn_fn, "%s-%ld.bin", router_sample_file, g_tw_mynode);
int i = 0; int i = 0;
int j = 0; int j = 0;
int size_sample = sizeof(tw_lpid) + p->radix * (sizeof(int64_t) + sizeof(tw_stime)) + sizeof(tw_stime); int size_sample = sizeof(tw_lpid) + p->radix * (sizeof(int64_t) + sizeof(tw_stime)) + sizeof(tw_stime);
FILE * fp = fopen(file_name, "a"); FILE * fp = fopen(cn_fn, "wa");
fseek(fp, sample_rtr_bytes_written, SEEK_SET); fseek(fp, sample_rtr_bytes_written, SEEK_SET);
for(; i < s->op_arr_size; i++) for(; i < s->op_arr_size; i++)
...@@ -2132,16 +2144,18 @@ void dragonfly_sample_fin(terminal_state * s, ...@@ -2132,16 +2144,18 @@ void dragonfly_sample_fin(terminal_state * s,
"data size per sample \t finished hops \t time to finish chunks \t busy time \t sample end time"); "data size per sample \t finished hops \t time to finish chunks \t busy time \t sample end time");
fclose(fp); fclose(fp);
} }
char file_name[64]; char rt_fn[MAX_NAME_LENGTH];
sprintf(file_name, "dragonfly-cn-sampling-%ld.bin", g_tw_mynode); if(strncmp(router_sample_file, "", 10) == 0)
sprintf(rt_fn, "dragonfly-cn-sampling-%ld.bin", g_tw_mynode);
else
sprintf(rt_fn, "%s-%ld.bin", cn_sample_file, g_tw_mynode);
FILE * fp = fopen(file_name, "a"); FILE * fp = fopen(rt_fn, "wa");
fseek(fp, sample_bytes_written, SEEK_SET); fseek(fp, sample_bytes_written, SEEK_SET);
fwrite(s->sample_stat, sizeof(struct dfly_cn_sample), s->op_arr_size, fp); fwrite(s->sample_stat, sizeof(struct dfly_cn_sample), s->op_arr_size, fp);
fclose(fp); fclose(fp);
sample_bytes_written += (s->op_arr_size * sizeof(struct dfly_cn_sample)); sample_bytes_written += (s->op_arr_size * sizeof(struct dfly_cn_sample));
//printf("\n Bytes written %ld ", sample_bytes_written);
} }
void terminal_buf_update_rc(terminal_state * s, void terminal_buf_update_rc(terminal_state * s,
......
...@@ -25,4 +25,6 @@ PARAMS ...@@ -25,4 +25,6 @@ PARAMS
cn_bandwidth="5.25"; cn_bandwidth="5.25";
message_size="368"; message_size="368";
routing="nonminimal"; routing="nonminimal";
cn_sample_file = "dragonfly-sample-ur";
rt_sample_file = "dragonfly-router-ur";
} }
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