Commit 93fc403d authored by Noah Wolfe's avatar Noah Wolfe
Browse files

Many changes. Ready to run on CCI

parent f4f4cd64
......@@ -28,11 +28,14 @@
#define lprintf(_fmt, ...) \
do {if (CS_LP_DBG) printf(_fmt, __VA_ARGS__);} while (0)
#define MAX_STATS 65536
#define PAYLOAD_SZ 1024
#define PAYLOAD_SZ 8
static int msg_size_hash_compare(
void *key, struct qhash_head *link);
int total_count_irecv = 0, total_count_isend = 0;
int total_irecvs = 0, total_isends = 0;
/* NOTE: Message tracking works in sequential mode only! */
static int debug_cols = 0;
/* Turning on this option slows down optimistic mode substantially. Only turn
......@@ -107,6 +110,9 @@ long long num_bytes_recvd=0;
long long num_syn_bytes_sent = 0;
long long num_syn_bytes_recvd = 0;
static int msgs_per_tick = 0;
static double tick_interval = 0;
double max_time = 0, max_comm_time = 0, max_wait_time = 0, max_send_time = 0, max_recv_time = 0;
double avg_time = 0, avg_comm_time = 0, avg_wait_time = 0, avg_send_time = 0, avg_recv_time = 0;
......@@ -149,7 +155,8 @@ struct mpi_workload_sample
unsigned long num_delays_sample;
unsigned long num_wait_all_sample;
unsigned long num_waits_sample;
unsigned long num_bytes_sample;
unsigned long num_bytes_sent_sample;
unsigned long num_bytes_recvd_sample;
unsigned long min_bytes_sample;
unsigned long max_bytes_sample;
double send_time_sample;
......@@ -229,7 +236,6 @@ struct nw_state
unsigned long num_waitall;
unsigned long num_waitsome;
/* time spent by the LP in executing the app trace*/
double start_time;
......@@ -271,9 +277,8 @@ struct nw_state
unsigned long num_bytes_sent;
unsigned long num_bytes_recvd;
unsigned long syn_data;
unsigned long gen_data;
unsigned long msgs_per_tick_sent;
/* For sampling data */
int sampling_indx;
int max_arr_size;
......@@ -319,6 +324,7 @@ struct nw_message
int64_t saved_num_bytes;
int64_t saved_min_bytes;
int64_t saved_max_bytes;
int64_t saved_msgs_per_tick_sent;
} rc;
};
......@@ -608,7 +614,7 @@ void finish_bckgnd_traffic(
(void)b;
(void)msg;
ns->is_finished = 1;
lprintf("\n LP %llu completed sending data %lu completed at time %lf ", LLU(lp->gid), ns->gen_data, tw_now(lp));
lprintf("\n LP %llu completed sending data %lu completed at time %lf ", LLU(lp->gid), ns->num_bytes_sent, tw_now(lp));
return;
}
......@@ -638,13 +644,24 @@ static void gen_synthetic_tr_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp
if(bf->c0)
return;
s->msgs_per_tick_sent--;
if(bf->c17){
s->msgs_per_tick_sent = m->rc.saved_msgs_per_tick_sent;
}
model_net_event_rc2(lp, &m->event_rc);
s->gen_data -= PAYLOAD_SZ;
s->num_bytes_sent -= PAYLOAD_SZ;
s->num_sends--;
s->compute_time = m->rc.saved_delay;
num_syn_bytes_sent -= PAYLOAD_SZ;
tw_rand_reverse_unif(lp->rng);
tw_rand_reverse_unif(lp->rng);
if(enable_sampling)
{
int indx = s->sampling_indx;
s->mpi_wkld_samples[indx].num_sends_sample--;
s->mpi_wkld_samples[indx].num_bytes_sent_sample -= PAYLOAD_SZ;
increment_sampling_check_rc(s, bf);
}
}
/* generate synthetic traffic */
......@@ -687,11 +704,39 @@ static void gen_synthetic_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * l
sizeof(nw_message), (const void*)&remote_m,
0, NULL, lp);
s->gen_data += PAYLOAD_SZ;
num_syn_bytes_sent += PAYLOAD_SZ;
s->num_bytes_sent += PAYLOAD_SZ;
num_bytes_sent += PAYLOAD_SZ;
s->num_sends++;
if(enable_sampling)
{
increment_sampling_check(s, lp, bf);
int indx = s->sampling_indx;
s->mpi_wkld_samples[indx].num_sends_sample++;
s->mpi_wkld_samples[indx].num_bytes_sent_sample += PAYLOAD_SZ;
s->mpi_wkld_samples[indx].send_time_sample = s->send_time;
m->rc.saved_max_bytes = s->mpi_wkld_samples[indx].max_bytes_sample;
m->rc.saved_min_bytes = s->mpi_wkld_samples[indx].min_bytes_sample;
s->mpi_wkld_samples[indx].comp_time_sample = s->compute_time;
}
int tick_delay = 0;
/* Check if num messages sent has reached total for the current tick window */
/* If so, issue next message to start at the beggining of the next tick */
//printf("LP:%llu, msgs_per_tick_sent:%llu, msgs_per_tick:%llu, tick_delay:%d, tick_interval:%llu, tw_now:%llu\n", LLU(lp->gid),LLU(s->msgs_per_tick_sent), LLU(msgs_per_tick), tick_delay, LLU(tick_interval), LLU(tw_now(lp)));
if(s->msgs_per_tick_sent >= msgs_per_tick){
tick_delay = tick_interval - (LLU(tw_now(lp)) % LLU(tick_interval));
m->rc.saved_delay = s->compute_time;
s->compute_time += tick_delay;
m->rc.saved_msgs_per_tick_sent = s->msgs_per_tick_sent;
s->msgs_per_tick_sent = 0;
bf->c17 = 1;
if(LLU(lp->gid) == 0)
printf("All messages transfered before tick. LP:%llu, msgs_per_tick_sent:%llu, msgs_per_tick:%llu, tick_delay:%d, tick_interval:%llu, tw_now:%llu\n", LLU(lp->gid),LLU(s->msgs_per_tick_sent), LLU(msgs_per_tick), tick_delay, LLU(tick_interval), LLU(tw_now(lp)));
}
s->msgs_per_tick_sent++;
/* New event after MEAN_INTERVAL */
tw_stime ts = mean_interval + tw_rand_exponential(lp->rng, noise);
tw_stime ts = 0.1 + tick_delay + mean_interval + tw_rand_exponential(lp->rng, noise);
tw_event * e;
nw_message * m_new;
e = tw_event_new(lp->gid, ts, lp);
......@@ -707,8 +752,17 @@ void arrive_syn_tr_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp)
(void)lp;
// printf("\n Data arrived %d total data %ld ", m->fwd.num_bytes, s->syn_data);
int data = m->fwd.num_bytes;
s->syn_data -= data;
num_syn_bytes_recvd -= data;
s->num_bytes_recvd -= data;
s->num_recvs--;
s->send_time = m->rc.saved_send_time;
num_bytes_recvd -= data;
if(enable_sampling)
{
int indx = s->sampling_indx;
s->mpi_wkld_samples[indx].num_recvs_sample--;
s->mpi_wkld_samples[indx].num_bytes_recvd_sample -= PAYLOAD_SZ;
increment_sampling_check_rc(s, bf);
}
}
void arrive_syn_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp)
{
......@@ -717,8 +771,18 @@ void arrive_syn_tr(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp)
// printf("\n Data arrived %d total data %ld ", m->fwd.num_bytes, s->syn_data);
int data = m->fwd.num_bytes;
s->syn_data += data;
num_syn_bytes_recvd += data;
s->num_bytes_recvd += data;
s->num_recvs++;
m->rc.saved_send_time = s->send_time;
s->send_time += tw_now(lp) - m->fwd.sim_start_time;
num_bytes_recvd += data;
if(enable_sampling)
{
increment_sampling_check(s, lp, bf);
int indx = s->sampling_indx;
s->mpi_wkld_samples[indx].num_recvs_sample++;
s->mpi_wkld_samples[indx].num_bytes_recvd_sample += PAYLOAD_SZ;
}
}
/* Debugging functions, may generate unused function warning */
/*static void print_waiting_reqs(uint32_t * reqs, int count)
......@@ -1370,19 +1434,6 @@ int get_global_id_of_job_rank(tw_lpid job_rank, int app_id)
}
static void codes_exec_mpi_send_rc(nw_state * s, tw_bf * bf, nw_message * m, tw_lp * lp)
{
if(enable_sampling)
{
int indx = s->sampling_indx;
s->mpi_wkld_samples[indx].num_sends_sample--;
s->mpi_wkld_samples[indx].num_bytes_sample -= m->rc.saved_num_bytes;
if(bf->c1)
{
s->sampling_indx--;
s->cur_interval_end -= sampling_interval;
}
}
if(bf->c15 || bf->c16)
s->num_sends--;
......@@ -1434,7 +1485,7 @@ static void codes_exec_mpi_send(nw_state* s,
increment_sampling_check(s, lp, bf);
int indx = s->sampling_indx;
s->mpi_wkld_samples[indx].num_sends_sample++;
s->mpi_wkld_samples[indx].num_bytes_sample += mpi_op->u.send.num_bytes;
s->mpi_wkld_samples[indx].num_bytes_sent_sample += mpi_op->u.send.num_bytes;
m->rc.saved_max_bytes = s->mpi_wkld_samples[indx].max_bytes_sample;
m->rc.saved_min_bytes = s->mpi_wkld_samples[indx].min_bytes_sample;
if(s->mpi_wkld_samples[indx].max_bytes_sample < mpi_op->u.send.num_bytes)
......@@ -1593,7 +1644,6 @@ static void update_completed_queue(nw_state* s,
if(enable_sampling)
{
increment_sampling_check(s, lp, bf);
printf("elapsed:%f compute:%f\n",s->elapsed_time, s->compute_time);
s->mpi_wkld_samples[s->sampling_indx].wait_time_sample = s->wait_time;
s->mpi_wkld_samples[s->sampling_indx].comm_time_sample = s->elapsed_time - s->compute_time;
}
......@@ -1877,6 +1927,8 @@ void nw_test_init(nw_state* s, tw_lp* lp)
s->compute_time = 0;
s->elapsed_time = 0;
s->msgs_per_tick_sent = 0;
s->app_id = lid.job;
s->local_rank = lid.rank;
......@@ -2055,7 +2107,7 @@ static void get_next_mpi_operation_rc(nw_state* s, tw_bf * bf, nw_message * m, t
{
int indx = s->sampling_indx;
s->mpi_wkld_samples[indx].num_sends_sample--;
s->mpi_wkld_samples[indx].num_bytes_sample -= m->rc.saved_num_bytes;
s->mpi_wkld_samples[indx].num_bytes_sent_sample -= m->rc.saved_num_bytes;
s->mpi_wkld_samples[indx].max_bytes_sample = m->rc.saved_max_bytes;
s->mpi_wkld_samples[indx].min_bytes_sample = m->rc.saved_min_bytes;
increment_sampling_check_rc(s, bf);
......@@ -2330,13 +2382,13 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
void nw_test_finalize(nw_state* s, tw_lp* lp)
{
total_syn_data += s->syn_data;
total_syn_data += s->num_bytes_recvd;
int written = 0;
int written2 = 0;
if(!s->nw_id){
written = sprintf(s->output_buf, "# Format <LP ID> <Terminal ID> <Total sends> <Total Recvs> <Bytes sent> <Bytes recvd> <Send time> <Comm. time> <Compute time> <Job ID>");
written2 = sprintf(s->output_buf2, "# Format <LP ID> <Terminal ID> <Interval> <Num Sends> <Num Recvs> <Num Collectives> <Num delays> <Num Wait_Alls> <Num Waits> <Send Time> <Wait Time> <Comm Time> <Compute Time> <Total Bytes> <Min Bytes> <Max Bytes>\n");
written = sprintf(s->output_buf, "# Format <LP ID> <MPI Rank ID> <Total sends> <Total Recvs> <Bytes sent> <Bytes recvd> <Send time> <Comm. time> <Compute time> <Job ID>");
written2 = sprintf(s->output_buf2, "# Format <LP ID> <Terminal ID> <Interval> <Num Sends> <Num Recvs> <Num Collectives> <Num delays> <Num Wait_Alls> <Num Waits> <Send Time> <Wait Time> <Comm Time> <Compute Time> <Total Bytes Sent> <Total Bytes Received> <Min Bytes Sent> <Max Bytes Sent>\n");
written2 += sprintf(s->output_buf2 + written2, "sampling-interval %lf sampling-end-time %lf\n", sampling_interval, sampling_end_time);
}
......@@ -2384,11 +2436,15 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
int count_irecv = 0, count_isend = 0;
count_irecv = qlist_count(&s->pending_recvs_queue);
count_isend = qlist_count(&s->arrival_queue);
total_count_irecv += count_irecv;
total_count_isend += count_isend;
total_irecvs += s->num_recvs;
total_isends += s->num_sends;
if(count_irecv > 0 || count_isend > 0)
{
unmatched = 1;
printf("\n LP %llu unmatched irecvs %d unmatched sends %d Total sends %ld receives %ld collectives %ld delays %ld wait alls %ld waits %ld send time %lf wait %lf",
LLU(lp->gid), count_irecv, count_isend, s->num_sends, s->num_recvs, s->num_cols, s->num_delays, s->num_waitall, s->num_wait, s->send_time, s->wait_time);
printf("\n LP %llu total un_irecvs %d/%d total un_isends %d/%d unmatched irecvs %d unmatched sends %d Total sends %ld receives %ld collectives %ld delays %ld wait alls %ld waits %ld send time %lf wait %lf",
LLU(lp->gid), total_count_irecv, total_irecvs, total_isends, total_count_isend, count_irecv, count_isend, s->num_sends, s->num_recvs, s->num_cols, s->num_delays, s->num_waitall, s->num_wait, s->send_time, s->wait_time);
}
written += sprintf(s->output_buf + written, "\n %llu %llu %ld %ld %ld %ld %lf %lf %lf %d", LLU(lp->gid), LLU(s->nw_id), s->num_sends, s->num_recvs, s->num_bytes_sent,
s->num_bytes_recvd, s->send_time, s->elapsed_time - s->compute_time, s->compute_time, s->app_id);
......@@ -2411,12 +2467,12 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
fwrite(s->mpi_wkld_samples, sizeof(struct mpi_workload_sample), s->sampling_indx + 1, workload_agg_log);
//printf("sampling_indx:%d sampling_interval:%f sampling_end_time:%f\n",s->sampling_indx, sampling_interval, sampling_end_time);
for(int i=0; i<sampling_end_time/sampling_interval; i++){
written2 += sprintf(s->output_buf2 + written2, "%llu %llu %d %lu %lu %lu %lu %lu %lu %lf %lf %lf %lf %lu %lu %lu\n",
written2 += sprintf(s->output_buf2 + written2, "%llu %llu %d %lu %lu %lu %lu %lu %lu %lf %lf %lf %lf %lu %lu %lu %lu\n",
LLU(lp->gid), LLU(s->nw_id), i, s->mpi_wkld_samples[i].num_sends_sample, s->mpi_wkld_samples[i].num_recvs_sample,
s->mpi_wkld_samples[i].num_cols_sample, s->mpi_wkld_samples[i].num_delays_sample, s->mpi_wkld_samples[i].num_wait_all_sample,
s->mpi_wkld_samples[i].num_waits_sample, s->mpi_wkld_samples[i].send_time_sample, s->mpi_wkld_samples[i].wait_time_sample,
s->mpi_wkld_samples[i].comm_time_sample, s->mpi_wkld_samples[i].comp_time_sample,
s->mpi_wkld_samples[i].num_bytes_sample, s->mpi_wkld_samples[i].min_bytes_sample, s->mpi_wkld_samples[i].max_bytes_sample);
s->mpi_wkld_samples[i].num_bytes_sent_sample, s->mpi_wkld_samples[i].num_bytes_recvd_sample, s->mpi_wkld_samples[i].min_bytes_sample, s->mpi_wkld_samples[i].max_bytes_sample);
}
lp_io_write(lp->gid, "mpi-sampling-stats", written2, s->output_buf2);
}
......@@ -2523,6 +2579,8 @@ const tw_optdef app_opt [] =
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"),
TWOPT_UINT("msgs_per_tick", msgs_per_tick, "Number of messages for each node to transfer between each simulated tick (Default 0)"),
TWOPT_STIME("tick_interval",tick_interval, "Length of a tick in nanoseconds (Default 0)"),
#ifdef ENABLE_CORTEX_PYTHON
TWOPT_CHAR("cortex-file", cortex_file, "Python file (without .py) containing the CoRtEx translation class"),
TWOPT_CHAR("cortex-class", cortex_class, "Python class implementing the CoRtEx translator"),
......
......@@ -16,7 +16,7 @@
#include "codes/configuration.h"
#include "codes/lp-type-lookup.h"
#define PAYLOAD_SZ 2048
#define PAYLOAD_SZ 8
static int net_id = 0;
static int traffic = 1;
......@@ -144,7 +144,8 @@ static void issue_event(
*/
/* skew each kickoff event slightly to help avoid event ties later on */
kickoff_time = 1.1 * g_tw_lookahead + tw_rand_exponential(lp->rng, arrival_time);
//kickoff_time = 1.1 * g_tw_lookahead + tw_rand_exponential(lp->rng, arrival_time);
kickoff_time = 1.1 * g_tw_lookahead + tw_rand_integer(lp->rng, 0, arrival_time);
e = tw_event_new(lp->gid, kickoff_time, lp);
m = tw_event_data(e);
......
......@@ -17,9 +17,7 @@
#include "codes/configuration.h"
#include "codes/lp-type-lookup.h"
#define PAYLOAD_SZ 512
#define PARAMS_LOG 1
#define PAYLOAD_SZ 8
static int net_id = 0;
static int offset = 2;
......@@ -27,15 +25,19 @@ static int traffic = 1;
static double arrival_time = 1000.0;
static double load = 0.0; //Percent utilization of terminal uplink
static double MEAN_INTERVAL = 0.0;
char * modelnet_stats_dir;
/* whether to pull instead of push */
static int num_servers_per_rep = 0;
static int num_routers_per_grp = 0;
static int num_nodes_per_grp = 0;
static char lp_io_dir[256] = {'\0'};
static lp_io_handle io_handle;
static unsigned int lp_io_use_suffix = 0;
static int do_lp_io = 0;
static int num_groups = 0;
static int num_nodes = 0;
static int num_msgs = 20;
typedef struct svr_msg svr_msg;
typedef struct svr_state svr_state;
......@@ -165,15 +167,18 @@ static const st_model_types *ft_svr_get_model_stat_types(void)
void ft_svr_register_model_stats()
{
st_model_type_register("server", ft_svr_get_model_stat_types());
st_model_type_register("nw-lp", ft_svr_get_model_stat_types());
}
const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
TWOPT_UINT("traffic", traffic, "UNIFORM RANDOM=1, NEAREST NEIGHBOR=2 "),
TWOPT_UINT("num_messages", num_msgs, "Number of messages to be generated per terminal "),
TWOPT_STIME("arrival_time", arrival_time, "INTER-ARRIVAL TIME"),
TWOPT_STIME("load", load, "percentage of terminal link bandiwdth to inject packets"),
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_END()
};
......@@ -184,7 +189,7 @@ const tw_lptype* svr_get_lp_type()
static void svr_add_lp_type()
{
lp_type_register("server", svr_get_lp_type());
lp_type_register("nw-lp", svr_get_lp_type());
}
static void issue_event(
......@@ -227,7 +232,8 @@ static void issue_event(
/* skew each kickoff event slightly to help avoid event ties later on */
// kickoff_time = 1.1 * g_tw_lookahead + tw_rand_exponential(lp->rng, arrival_time);
kickoff_time = g_tw_lookahead + tw_rand_exponential(lp->rng, MEAN_INTERVAL);
// kickoff_time = g_tw_lookahead + tw_rand_exponential(lp->rng, MEAN_INTERVAL);
kickoff_time = 1.1 * g_tw_lookahead + tw_rand_integer(lp->rng, 0, arrival_time);
e = tw_event_new(lp->gid, kickoff_time, lp);
m = tw_event_data(e);
......@@ -253,6 +259,9 @@ static void handle_kickoff_rev_event(
{
(void)b;
(void)m;
if(m->incremented_flag)
return;
ns->msg_sent_count--;
model_net_event_rc2(lp, &m->event_rc);
tw_rand_reverse_unif(lp->rng);
......@@ -265,6 +274,14 @@ static void handle_kickoff_event(
{
(void)b;
(void)m;
if(ns->msg_sent_count >= num_msgs)
{
m->incremented_flag = 1;
return;
}
m->incremented_flag = 0;
// char* anno;
char anno[MAX_NAME_LENGTH];
tw_lpid local_dest = -1, global_dest = -1;
......@@ -432,8 +449,6 @@ int main(
int num_nets;
int *net_ids;
lp_io_handle handle;
tw_opt_add(app_opt);
tw_init(&argc, &argv);
......@@ -473,7 +488,7 @@ int main(
MPI_Finalize();
return 0;
}
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1, "server",
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1, "nw-lp",
NULL, 1);
configuration_get_value_int(&config, "PARAMS", "num_routers", NULL, &num_routers_per_grp);
......@@ -481,118 +496,24 @@ int main(
num_nodes = num_groups * num_routers_per_grp * (num_routers_per_grp / 2);
num_nodes_per_grp = num_routers_per_grp * (num_routers_per_grp / 2);
num_nodes = codes_mapping_get_lp_count("MODELNET_GRP", 0, "server", NULL, 1);
num_nodes = codes_mapping_get_lp_count("MODELNET_GRP", 0, "nw-lp", NULL, 1);
printf("num_nodes:%d \n",num_nodes);
if(lp_io_prepare("modelnet-test", LP_IO_UNIQ_SUFFIX, &handle, MPI_COMM_WORLD) < 0)
if(lp_io_dir[0])
{
return(-1);
do_lp_io = 1;
int flags = lp_io_use_suffix ? LP_IO_UNIQ_SUFFIX : 0;
int ret = lp_io_prepare(lp_io_dir, flags, &io_handle, MPI_COMM_CODES);
assert(ret == 0 || !"lp_io_prepare failure");
}
modelnet_stats_dir = lp_io_handle_to_dir(handle);
tw_run();
model_net_report_stats(net_id);
#if PARAMS_LOG
if(!g_tw_mynode)
{
char temp_filename[1024];
char temp_filename_header[1024];
sprintf(temp_filename,"%s/sim_log.txt",modelnet_stats_dir);
sprintf(temp_filename_header,"%s/sim_log_header.txt",modelnet_stats_dir);
FILE *fattree_results_log=fopen(temp_filename, "a");
FILE *fattree_results_log_header=fopen(temp_filename_header, "a");
if(fattree_results_log == NULL)
printf("\n Failed to open results log file %s in synthetic-fattree\n",temp_filename);
if(fattree_results_log_header == NULL)
printf("\n Failed to open results log header file %s in synthetic-fattree\n",temp_filename_header);
printf("Printing Simulation Parameters/Results Log File\n");
fprintf(fattree_results_log_header,", <Workload>, <Load>, <Mean Interval>, ");
fprintf(fattree_results_log,"%11.3d, %5.2f, %15.2f, ",traffic, load, MEAN_INTERVAL);
fclose(fattree_results_log_header);
fclose(fattree_results_log);
}
#endif
if(lp_io_flush(handle, MPI_COMM_WORLD) < 0)
{
return(-1);
if (do_lp_io){
int ret = lp_io_flush(io_handle, MPI_COMM_CODES);
assert(ret == 0 || !"lp_io_flush failure");
}
model_net_report_stats(net_id);
tw_end();
#if PARAMS_LOG
if(!g_tw_mynode)
{
char temp_filename[1024];
char temp_filename_header[1024];
sprintf(temp_filename,"%s/sim_log.txt",modelnet_stats_dir);
sprintf(temp_filename_header,"%s/sim_log_header.txt",modelnet_stats_dir);
FILE *fattree_results_log=fopen(temp_filename, "a");
FILE *fattree_results_log_header=fopen(temp_filename_header, "a");
FILE *fattree_ross_csv_log=fopen("ross.csv", "r");
if(fattree_results_log == NULL)
printf("\n Failed to open results log file %s in synthetic-fattree\n",temp_filename);
if(fattree_results_log_header == NULL)
printf("\n Failed to open results log header file %s in synthetic-fattree\n",temp_filename_header);
if(fattree_ross_csv_log == NULL)
tw_error(TW_LOC, "\n Failed to open ross.csv log file \n");
printf("Reading ROSS specific data from ross.csv and Printing to Fat Tree Log File\n");
char * line = NULL;
size_t len = 0;
ssize_t read = getline(&line, &len, fattree_ross_csv_log);
while (read != -1)
{
read = getline(&line, &len, fattree_ross_csv_log);
}
char * pch;
pch = strtok (line,",");
int idx = 0;
int gvt_computations;
long long total_events, rollbacks, net_events;
float running_time, efficiency, event_rate;
while (pch != NULL)
{
pch = strtok (NULL, ",");
switch(idx)
{
case 4:
total_events = atoll(pch);
break;
case 13:
rollbacks = atoll(pch);
break;
case 17:
gvt_computations = atoi(pch);
break;
case 18:
net_events = atoll(pch);
break;
case 3:
running_time = atof(pch);
break;
case 8:
efficiency = atof(pch);
break;
case 19:
event_rate = atof(pch);
break;
}
idx++;
}
fprintf(fattree_results_log_header,"<Total Events>, <Rollbacks>, <GVT Computations>, <Net Events>, <Running Time>, <Efficiency>, <Event Rate>");
fprintf(fattree_results_log,"%14llu, %11llu, %18d, %12llu, %14.4f, %12.2f, %12.2f\n",total_events,rollbacks,gvt_computations,net_events,running_time,efficiency,event_rate);
fclose(fattree_results_log);
fclose(fattree_results_log_header);
fclose(fattree_ross_csv_log);
}
#endif
return 0;
}
......
......@@ -16,12 +16,11 @@
#include "codes/configuration.h"
#include "codes/lp-type-lookup.h"
#define PAYLOAD_SZ 256
#define PAYLOAD_SZ 8
#define LP_CONFIG_NM (model_net_lp_config_names[SLIMFLY])
#define PRINT_WORST_CASE_MATCH 0
#define PARAMS_LOG 1
FILE * slimfly_results_log_2=NULL;
FILE * slimfly_ross_csv_log=NULL;
......@@ -42,6 +41,7 @@ static char lp_io_dir[356] = {'\0'};
static lp_io_handle io_handle;
static unsigned int lp_io_use_suffix = 0;
static int do_lp_io = 0;
static int num_msgs = 20;
static int num_servers_per_rep = 0;
static int num_routers_per_grp = 0;
......@@ -124,6 +124,7 @@ const tw_optdef app_opt [] =
{
TWOPT_GROUP("Model net synthetic traffic " ),
TWOPT_UINT("traffic", traffic, "UNIFORM RANDOM=1, NEAREST NEIGHBOR=2 "),
TWOPT_UINT("num_messages", num_msgs, "Number of messages to be generated per terminal "),
TWOPT_STIME("arrival_time", arrival_time, "INTER-ARRIVAL TIME"),
TWOPT_STIME("load", load, "percentage of packet inter-arrival rate to simulate"),
TWOPT_CHAR("lp-io-dir", lp_io_dir, "Where to place io output (unspecified -> no output"),
......@@ -138,7 +139,7 @@ const tw_lptype* svr_get_lp_type()
static void svr_add_lp_type()
{
lp_type_register("server", svr_get_lp_type());
lp_type_register("nw-lp", svr_get_lp_type());
}
/* convert GiB/s and bytes to ns */
......@@ -230,7 +231,8 @@ static void issue_event(
}
/* skew each kickoff event slightly to help avoid event ties later on */
kickoff_time = g_tw_lookahead + tw_rand_exponential(lp->rng, MEAN_INTERVAL);
// kickoff_time = g_tw_lookahead + tw_rand_exponential(lp->rng, MEAN_INTERVAL);
kickoff_time = 1.1 * g_tw_lookahead + tw_rand_integer(lp->rng, 0, arrival_time);
e = tw_event_new(lp->gid, kickoff_time, lp);