Commit ed16435e authored by Misbah Mubarak's avatar Misbah Mubarak

Committing some changes to reverse handlers

parent 6f7899ea
......@@ -24,7 +24,7 @@
#define TRACE -1
#define MAX_WAIT_REQS 512
#define CS_LP_DBG 0
#define EAGER_THRESHOLD 8192
#define EAGER_THRESHOLD 81920000
#define RANK_HASH_TABLE_SZ 2000
#define NOISE 3.0
#define NW_LP_NM "nw-lp"
......@@ -36,7 +36,7 @@
static int msg_size_hash_compare(
void *key, struct qhash_head *link);
int enable_msg_tracking = 1;
int enable_msg_tracking = 0;
int unmatched = 0;
char workload_type[128];
......
......@@ -20,7 +20,7 @@
#include <vector>
#include <map>
#define DUMP_CONNECTIONS 1
#define DUMP_CONNECTIONS 0
#define CREDIT_SIZE 8
#define DFLY_HASH_TABLE_SIZE 4999
......@@ -1807,29 +1807,29 @@ void dragonfly_custom_rsample_fin(router_state * s,
" channels \n%d terminal channels", p->intra_grp_radix, p->num_global_channels);
fclose(fp);
}
char rt_fn[MAX_NAME_LENGTH];
if(strcmp(router_sample_file, "") == 0)
sprintf(rt_fn, "dragonfly-router-sampling-%ld.bin", g_tw_mynode);
else
sprintf(rt_fn, "%s-%ld.bin", router_sample_file, g_tw_mynode);
int i = 0;
char rt_fn[MAX_NAME_LENGTH];
if(strcmp(router_sample_file, "") == 0)
sprintf(rt_fn, "dragonfly-router-sampling-%ld.bin", g_tw_mynode);
else
sprintf(rt_fn, "%s-%ld.bin", router_sample_file, g_tw_mynode);
int i = 0;
int size_sample = sizeof(tw_lpid) + p->radix * (sizeof(int64_t) + sizeof(tw_stime)) + sizeof(tw_stime) + 2 * sizeof(long);
FILE * fp = fopen(rt_fn, "a");
fseek(fp, sample_rtr_bytes_written, SEEK_SET);
int size_sample = sizeof(tw_lpid) + p->radix * (sizeof(int64_t) + sizeof(tw_stime)) + sizeof(tw_stime) + 2 * sizeof(long);
FILE * fp = fopen(rt_fn, "a");
fseek(fp, sample_rtr_bytes_written, SEEK_SET);
for(; i < s->op_arr_size; i++)
{
fwrite((void*)&(s->rsamples[i].router_id), sizeof(tw_lpid), 1, fp);
fwrite(s->rsamples[i].busy_time, sizeof(tw_stime), p->radix, fp);
fwrite(s->rsamples[i].link_traffic_sample, sizeof(int64_t), p->radix, fp);
fwrite((void*)&(s->rsamples[i].end_time), sizeof(tw_stime), 1, fp);
fwrite((void*)&(s->rsamples[i].fwd_events), sizeof(long), 1, fp);
fwrite((void*)&(s->rsamples[i].rev_events), sizeof(long), 1, fp);
}
sample_rtr_bytes_written += (s->op_arr_size * size_sample);
fclose(fp);
for(; i < s->op_arr_size; i++)
{
fwrite((void*)&(s->rsamples[i].router_id), sizeof(tw_lpid), 1, fp);
fwrite(s->rsamples[i].busy_time, sizeof(tw_stime), p->radix, fp);
fwrite(s->rsamples[i].link_traffic_sample, sizeof(int64_t), p->radix, fp);
fwrite((void*)&(s->rsamples[i].end_time), sizeof(tw_stime), 1, fp);
fwrite((void*)&(s->rsamples[i].fwd_events), sizeof(long), 1, fp);
fwrite((void*)&(s->rsamples[i].rev_events), sizeof(long), 1, fp);
}
sample_rtr_bytes_written += (s->op_arr_size * size_sample);
fclose(fp);
}
void dragonfly_custom_sample_init(terminal_state * s,
tw_lp * lp)
......@@ -1939,18 +1939,19 @@ void dragonfly_custom_sample_fin(terminal_state * s,
"\nbusy time (double)\nsample end time(double) \nforward events (long) \nreverse events (long)");
fclose(fp);
}
char rt_fn[MAX_NAME_LENGTH];
if(strncmp(cn_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(rt_fn, "a");
fseek(fp, sample_bytes_written, SEEK_SET);
fwrite(s->sample_stat, sizeof(struct dfly_cn_sample), s->op_arr_size, fp);
fclose(fp);
char rt_fn[MAX_NAME_LENGTH];
if(strncmp(cn_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(rt_fn, "a");
fseek(fp, sample_bytes_written, SEEK_SET);
fwrite(s->sample_stat, sizeof(struct dfly_cn_sample), s->op_arr_size, 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));
}
static void terminal_buf_update_rc(terminal_state * s,
......@@ -2447,6 +2448,7 @@ static int do_global_adaptive_routing( router_state * s,
if(num_min_chans > 1)
{
bf->c10 = 1;
dest_rtr_bs = get_intra_router(s->router_id, min_rtr_b, s->params->num_routers);
dest_rtr_b_sel = tw_rand_integer(lp->rng, 0, dest_rtr_bs.size() - 1);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM_ROUT, s->anno, 0, dest_rtr_bs[dest_rtr_b_sel],
......@@ -2475,6 +2477,7 @@ static int do_global_adaptive_routing( router_state * s,
if(num_nonmin_chans > 1)
{
bf->c11 = 1;
dest_rtr_bs = get_intra_router(s->router_id, nonmin_rtr_b, s->params->num_routers);
dest_rtr_b_sel = tw_rand_integer(lp->rng, 0, dest_rtr_bs.size() - 1);
codes_mapping_get_lp_id(lp_group_name, LP_CONFIG_NM_ROUT, s->anno, 0, dest_rtr_bs[dest_rtr_b_sel],
......@@ -2585,20 +2588,31 @@ static void router_packet_receive_rc(router_state * s,
int output_port = msg->saved_vc;
int output_chan = msg->saved_channel;
tw_rand_reverse_unif(lp->rng);
tw_rand_reverse_unif(lp->rng);
if(bf->c20)
{
for(int i = 0; i < 12; i++)
for(int i = 0; i < 8; i++)
tw_rand_reverse_unif(lp->rng);
if(bf->c10)
{
tw_rand_reverse_unif(lp->rng);
tw_rand_reverse_unif(lp->rng);
}
if(bf->c11)
{
tw_rand_reverse_unif(lp->rng);
tw_rand_reverse_unif(lp->rng);
}
}
if(bf->c19)
tw_rand_reverse_unif(lp->rng);
tw_rand_reverse_unif(lp->rng);
if(bf->c6)
{
for(int i = 0; i < 6; i++)
for(int i = 0; i < 4; i++)
tw_rand_reverse_unif(lp->rng);
}
if(bf->c2) {
......@@ -2857,7 +2871,6 @@ static void router_packet_send_rc(router_state * s,
}
s->next_output_available_time[output_port] = msg->saved_available_time;
prepend_to_terminal_custom_message_list(s->pending_msgs[output_port],
s->pending_msgs_tail[output_port], output_chan, cur_entry);
......
......@@ -18,6 +18,7 @@
/**** BEGIN SIMULATION DATA STRUCTURES ****/
int model_net_base_magic;
int mn_sample_enabled = 0;
// message-type specific offsets - don't want to get bitten later by alignment
// issues...
......@@ -36,7 +37,6 @@ static const char * annos[CONFIGURATION_MAX_ANNOS];
static model_net_base_params all_params[CONFIGURATION_MAX_ANNOS];
static tw_stime mn_sample_interval = 0.0;
static int mn_sample_enabled = 0;
static tw_stime mn_sample_end = 0.0;
typedef struct model_net_base_state {
......
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