Commit 9e064093 authored by Xin's avatar Xin

enable change of background payload size

parent c3a6a949
......@@ -30,13 +30,13 @@
do {if (CS_LP_DBG) printf(_fmt, __VA_ARGS__);} while (0)
#define MAX_STATS 65536
#define PAYLOAD_SZ 1024
#define MAX_COL 500
#define MAX_COL 100
static int msg_size_hash_compare(
void *key, struct qhash_head *link);
/* NOTE: Message tracking works in sequential mode only! */
int debug_cols = 1;
int debug_cols = 0;
int enable_msg_tracking = 0;
tw_lpid TRACK_LP = -1;
......@@ -51,6 +51,7 @@ static int num_dumpi_traces = 0;
static int alloc_spec = 0;
static tw_stime self_overhead = 10.0;
static tw_stime mean_interval = 100000;
int payload = 1024;
/* Doing LP IO*/
static char lp_io_dir[256] = {'\0'};
......@@ -225,8 +226,10 @@ struct nw_state
double all_reduce_time;
int num_all_reduce;
double col_times[MAX_COL];
uint64_t col_msizes[MAX_COL];
char col_buf[100*MAX_COL];
int col_msizes[MAX_COL];
int counters[MAX_COL];
int index;
char col_buf[50*MAX_COL];
double elapsed_time;
/* time spent in compute operations */
......@@ -582,9 +585,9 @@ static void gen_synthetic_tr_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp
return;
model_net_event_rc2(lp, &m->event_rc);
s->gen_data -= PAYLOAD_SZ;
s->gen_data -= payload;;
num_syn_bytes_sent -= PAYLOAD_SZ;
num_syn_bytes_sent -= payload;
tw_rand_reverse_unif(lp->rng);
tw_rand_reverse_unif(lp->rng);
......@@ -622,16 +625,16 @@ static void gen_synthetic_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * l
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.num_bytes = payload;
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,
m->event_rc = model_net_event(net_id, "synthetic-tr", global_dest_id, payload, 0.0,
sizeof(nw_message), (const void*)&remote_m,
0, NULL, lp);
s->gen_data += PAYLOAD_SZ;
num_syn_bytes_sent += PAYLOAD_SZ;
s->gen_data += payload;
num_syn_bytes_sent += payload;
/* New event after MEAN_INTERVAL */
tw_stime ts = mean_interval + tw_rand_exponential(lp->rng, noise);
......@@ -1680,6 +1683,7 @@ void nw_test_init(nw_state* s, tw_lp* lp)
s->num_reduce = 0;
s->reduce_time = 0;
s->all_reduce_time = 0;
s->index = 0;
if(!num_net_traces)
num_net_traces = num_mpi_lps;
......@@ -1951,10 +1955,19 @@ static void get_next_mpi_operation_rc(nw_state* s, tw_bf * bf, nw_message * m, t
{
if(bf->c1)
{
s->col_times[s->num_all_reduce] = 0;
s->col_msizes[s->num_all_reduce] = 0;
s->col_time = m->rc.saved_send_time;
if(s->counters[s->index] > 1)
{
s->col_times[s->index] -= s->col_time;
s->counters[s->index]--;
}
else {
s->col_times[s->index] = 0;
s->col_msizes[s->index] = 0;
s->counters[s->index] = 0;
s->index--;
}
s->num_all_reduce--;
s->col_time = m->rc.saved_send_time;
s->all_reduce_time -= s->col_time;
}
else
......@@ -2098,8 +2111,19 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
{
bf->c1 = 1;
m->rc.saved_delay = s->all_reduce_time;
s->col_times[s->num_all_reduce] = (tw_now(lp) - s->col_time);
s->col_msizes[s->num_all_reduce] = mpi_op.u.collective.num_bytes;
if(s->col_msizes[s->index] == mpi_op.u.collective.num_bytes)
{
s->col_times[s->index] += (tw_now(lp)-s->col_time);
s->counters[s->index]++;
}
else
{
s->index++;
s->col_times[s->index] += (tw_now(lp)-s->col_time);
s->col_msizes[s->index] = mpi_op.u.collective.num_bytes;
s->counters[s->index]++;
}
s->all_reduce_time += (tw_now(lp) - s->col_time);
m->rc.saved_send_time = s->col_time;
s->col_time = 0;
......@@ -2219,17 +2243,19 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
max_recv_time = s->recv_time;
if(s->local_rank == 0 && debug_cols)
written2 = sprintf(s->col_buf, "rank_id nrep msize runtime_ns");
written2 = sprintf(s->col_buf, "rank_id msize avg_runtime_ns");
if(debug_cols)
{
printf("\n Rank %lld Avg all reduce time %lf ", s->nw_id, ns_to_s(s->all_reduce_time / s->num_all_reduce));
for (int i=0; i< s->num_all_reduce; i++)
for (int i=0; i<= s->index; i++)
{
written2 += sprintf(s->col_buf + written2, "\n %d %d %lld %lf",
s->local_rank, i, s->col_msizes[i], s->col_times[i]);
written2 += sprintf(s->col_buf + written2, "\n %d %d %lf",
s->local_rank, s->col_msizes[i], (s->col_times[i]/s->counters[i]));
//printf("\n buffer size=%d", written2);
}
lp_io_write(lp->gid, "mpi-col-stats", written2, s->col_buf);
}
......@@ -2312,6 +2338,7 @@ const tw_optdef app_opt [] =
TWOPT_UINT("sampling_interval", sampling_interval, "sampling interval for MPI operations"),
TWOPT_UINT("enable_sampling", enable_sampling, "enable sampling (only works in sequential mode)"),
TWOPT_STIME("sampling_end_time", sampling_end_time, "sampling_end_time"),
TWOPT_UINT("payload", payload, "background traffic payload size in byte"),
TWOPT_CHAR("lp-io-dir", lp_io_dir, "Where to place io output (unspecified -> no output"),
TWOPT_UINT("lp-io-use-suffix", lp_io_use_suffix, "Whether to append uniq suffix to lp-io directory (default 0)"),
TWOPT_CHAR("offset_file", offset_file, "offset file name"),
......
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