Commit c647279b authored by Misbah Mubarak's avatar Misbah Mubarak

Adding multiple background traffic patterns

parent ec8ef620
......@@ -30,8 +30,8 @@ intercon = open(sys.argv[3], "wb")
def router(group, row, col):
return group*96 + row*16 + col
numblack = np.zeros((864,864), dtype=np.int)
numblue = np.zeros((864,864), dtype=np.int)
numblack = np.zeros((960,960), dtype=np.int)
numblue = np.zeros((960,960), dtype=np.int)
with open(filename) as ofile:
matches = re.findall('c\d+-\dc\ds\d+a0l\d+\((\d+):(\d):(\d+)\).(\w+).->.c\d+-\dc\ds\d+a0l\d+\((\d+):(\d):(\d+)\)', ofile.read(), re.MULTILINE)
......
......@@ -2,7 +2,7 @@ LPGROUPS
{
MODELNET_GRP
{
repetitions="864";
repetitions="960";
# name of this lp changes according to the model
nw-lp="2";
# these lp names will be the same for dragonfly-custom model
......@@ -27,7 +27,7 @@ PARAMS
# number of router columns
num_router_cols="16";
# number of groups in the network
num_groups="9";
num_groups="10";
# buffer size in bytes for local virtual channels
local_vc_size="8192";
#buffer size in bytes for global virtual channels
......
......@@ -2,7 +2,7 @@ LPGROUPS
{
MODELNET_GRP
{
repetitions="864";
repetitions="960";
# name of this lp changes according to the model
nw-lp="4";
# these lp names will be the same for dragonfly-custom model
......@@ -27,7 +27,7 @@ PARAMS
# number of router columns
num_router_cols="16";
# number of groups in the network
num_groups="9";
num_groups="10";
# buffer size in bytes for local virtual channels
local_vc_size="8192";
#buffer size in bytes for global virtual channels
......@@ -48,9 +48,9 @@ PARAMS
# number of global channels per router
num_global_channels="4";
# network config file for intra-group connections
intra-group-connections="../src/network-workloads/conf/dragonfly-custom/intra-theta";
intra-group-connections="../src/network-workloads/conf/dragonfly-custom/intra-theta-upd";
# network config file for inter-group connections
inter-group-connections="../src/network-workloads/conf/dragonfly-custom/inter-theta";
inter-group-connections="../src/network-workloads/conf/dragonfly-custom/inter-theta-upd";
# routing protocol to be used
routing="adaptive";
}
......@@ -28,7 +28,6 @@
#define lprintf(_fmt, ...) \
do {if (CS_LP_DBG) printf(_fmt, __VA_ARGS__);} while (0)
#define MAX_STATS 65536
#define PAYLOAD_SZ 1024
static int msg_size_hash_compare(
void *key, struct qhash_head *link);
......@@ -55,6 +54,7 @@ static int64_t EAGER_THRESHOLD = 8192;
static int alloc_spec = 0;
static tw_stime self_overhead = 10.0;
static tw_stime mean_interval = 100000;
static int payload_sz = 1024;
/* Doing LP IO*/
static char lp_io_dir[256] = {'\0'};
......@@ -138,6 +138,14 @@ enum MPI_NW_EVENTS
CLI_NBR_FINISH,
};
/* type of synthetic traffic */
enum TRAFFIC
{
UNIFORM = 1, /* sends message to a randomly selected node */
NEAREST_NEIGHBOR = 2, /* sends message to the next node (potentially connected to the same router) */
ALLTOALL = 3, /* sends message to all other nodes */
STENCIL = 4 /* sends message to 4 nearby neighbors */
};
struct mpi_workload_sample
{
/* Sampling data */
......@@ -203,6 +211,7 @@ struct nw_state
int app_id;
int local_rank;
int synthetic_pattern;
int is_finished;
int neighbor_completed;
......@@ -309,6 +318,7 @@ struct nw_message
double saved_wait_time;
double saved_delay;
int64_t saved_num_bytes;
int saved_syn_length;
} rc;
};
......@@ -591,12 +601,13 @@ static void gen_synthetic_tr_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp
if(bf->c0)
return;
model_net_event_rc2(lp, &m->event_rc);
s->gen_data -= PAYLOAD_SZ;
num_syn_bytes_sent -= PAYLOAD_SZ;
tw_rand_reverse_unif(lp->rng);
tw_rand_reverse_unif(lp->rng);
int i;
for (i=0; i < m->rc.saved_syn_length; i++){
model_net_event_rc2(lp, &m->event_rc);
s->gen_data -= payload_sz;
num_syn_bytes_sent -= payload_sz;
}
tw_rand_reverse_unif(lp->rng);
}
......@@ -611,38 +622,105 @@ static void gen_synthetic_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * l
/* Get job information */
tw_lpid global_dest_id;
int intm_dest_id;
nw_message remote_m;
struct codes_jobmap_id jid;
jid = codes_jobmap_to_local_id(s->nw_id, jobmap_ctx);
int num_clients = codes_jobmap_get_num_ranks(jid.job, jobmap_ctx);
int dest_svr = tw_rand_integer(lp->rng, 0, num_clients - 1);
if(dest_svr == s->local_rank)
/* Find destination */
int* dest_svr = NULL;
int i, length=0;
switch(s->synthetic_pattern)
{
dest_svr = (s->local_rank + 1) % num_clients;
}
jid.rank = dest_svr;
int intm_dest_id = codes_jobmap_to_global_id(jid, jobmap_ctx);
global_dest_id = codes_mapping_get_lpid_from_relative(intm_dest_id, NULL, NW_LP_NM, NULL, 0);
nw_message remote_m;
remote_m.fwd.sim_start_time = tw_now(lp);
remote_m.fwd.dest_rank = dest_svr;
remote_m.msg_type = CLI_BCKGND_ARRIVE;
remote_m.fwd.num_bytes = PAYLOAD_SZ;
remote_m.fwd.app_id = s->app_id;
remote_m.fwd.src_rank = s->local_rank;
m->event_rc = model_net_event(net_id, "synthetic-tr", global_dest_id, PAYLOAD_SZ, 0.0,
sizeof(nw_message), (const void*)&remote_m,
0, NULL, lp);
s->gen_data += PAYLOAD_SZ;
num_syn_bytes_sent += PAYLOAD_SZ;
case UNIFORM:
{
length = 1;
dest_svr = (int*) calloc(1, sizeof(int));
dest_svr[0] = tw_rand_integer(lp->rng, 0, num_clients - 1);
if(dest_svr[0] == s->local_rank)
dest_svr[0] = (s->local_rank + 1) % num_clients;
}
break;
case NEAREST_NEIGHBOR:
{
length = 1;
dest_svr = (int*) calloc(1, sizeof(int));
dest_svr[0] = (s->local_rank + 1) % num_clients;
}
break;
case ALLTOALL:
{
dest_svr = (int*) calloc(num_clients-1, sizeof(int));
int index = 0;
for (i=0;i<num_clients;i++)
{
if(i!=s->local_rank)
{
dest_svr[index] = i;
index++;
length++;
}
}
}
break;
case STENCIL: //2D 4-point stencil
{
/* I think this code snippet is coming from the LLNL stencil patterns. */
int digits, x=1, y=1, row, col, temp=num_clients;
length = 4;
dest_svr = (int*) calloc(4, sizeof(int));
for (digits = 0; temp > 0; temp >>= 1)
digits++;
digits = digits/2;
for (i = 0; i < digits; i++)
x = x * 2;
y = num_clients / x;
//printf("\nStencil Syn: x=%d, y=%d", x, y);
row = s->local_rank / y;
col = s->local_rank % y;
dest_svr[0] = row * y + ((col-1+y)%y); /* left neighbor */
dest_svr[1] = row * y + ((col+1+y)%y); /* right neighbor */
dest_svr[2] = ((row-1+x)%x) * y + col; /* bottom neighbor */
dest_svr[3] = ((row+1+x)%x) * y + col; /* up neighbor */
}
break;
default:
tw_error(TW_LOC, "Undefined traffic pattern");
}
/* Record length for reverse handler*/
m->rc.saved_syn_length = length;
if(length > 0)
{
// m->event_array_rc = (model_net_event_return) malloc(length * sizeof(model_net_event_return));
//printf("\nRANK %d Dests %d", s->local_rank, length);
for (i = 0; i < length; i++)
{
/* Generate synthetic traffic */
jid.rank = dest_svr[i];
intm_dest_id = codes_jobmap_to_global_id(jid, jobmap_ctx);
global_dest_id = codes_mapping_get_lpid_from_relative(intm_dest_id, NULL, NW_LP_NM, NULL, 0);
remote_m.fwd.sim_start_time = tw_now(lp);
remote_m.fwd.dest_rank = dest_svr[i];
remote_m.msg_type = CLI_BCKGND_ARRIVE;
remote_m.fwd.num_bytes = payload_sz;
remote_m.fwd.app_id = s->app_id;
remote_m.fwd.src_rank = s->local_rank;
// printf("\nAPP %d SRC %d Dest %d (twid %llu)", jid.job, s->local_rank, dest_svr[i], global_dest_id);
m->event_rc = model_net_event(net_id, "synthetic-tr", global_dest_id, payload_sz, 0.0,
sizeof(nw_message), (const void*)&remote_m,
0, NULL, lp);
s->gen_data += payload_sz;
num_syn_bytes_sent += payload_sz;
}
}
/* New event after MEAN_INTERVAL */
tw_stime ts = mean_interval + tw_rand_exponential(lp->rng, noise);
tw_event * e;
......@@ -651,6 +729,8 @@ static void gen_synthetic_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * l
m_new = (struct nw_message*)tw_event_data(e);
m_new->msg_type = CLI_BCKGND_GEN;
tw_event_send(e);
free(dest_svr);
}
void arrive_syn_tr_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp)
......@@ -1845,6 +1925,18 @@ void nw_test_init(nw_state* s, tw_lp* lp)
if(strcmp(file_name_of_job[lid.job], "synthetic") == 0)
{
int synthetic_pattern;
sscanf(file_name_of_job[lid.job], "synthetic%d", &synthetic_pattern);
if(synthetic_pattern <=0 || synthetic_pattern > 4)
{
printf("\n Undefined synthetic pattern: setting to uniform random ");
s->synthetic_pattern = 1;
}
else
{
s->synthetic_pattern = synthetic_pattern;
}
tw_event * e;
nw_message * m_new;
tw_stime ts = tw_rand_exponential(lp->rng, mean_interval/1000);
......
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