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

Many changes. Ready to run on CCI

parent f4f4cd64
......@@ -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);
m = tw_event_data(e);
......@@ -255,6 +257,7 @@ static void handle_kickoff_rev_event(
(void)b;
(void)m;
(void)lp;
if(m->incremented_flag)
if(b->c1)
tw_rand_reverse_unif(lp->rng);
......@@ -272,6 +275,13 @@ static void handle_kickoff_event(
{
(void)m;
if(ns->msg_sent_count >= num_msgs)
{
m->incremented_flag = 1;
return;
}
m->incremented_flag = 0;
char anno[MAX_NAME_LENGTH];
tw_lpid local_dest = -1, global_dest = -1;
......@@ -471,7 +481,7 @@ int main(
net_id = *net_ids;
free(net_ids);
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1, "server", NULL, 1);
num_servers_per_rep = codes_mapping_get_lp_count("MODELNET_GRP", 1, "nw-lp", NULL, 1);
configuration_get_value_int(&config, "PARAMS", "num_terminals", NULL, &num_terminals);
configuration_get_value_int(&config, "PARAMS", "num_routers", NULL, &num_routers_per_grp);
num_groups = (num_routers_per_grp * 2);
......@@ -479,12 +489,6 @@ int main(
num_nodes_per_grp = num_routers_per_grp * num_servers_per_rep;
total_routers = num_routers_per_grp * num_routers_per_grp * 2;
/* if(lp_io_prepare("modelnet-test", LP_IO_UNIQ_SUFFIX, &handle, MPI_COMM_WORLD) < 0)
{
return(-1);
}
*/
if(lp_io_dir[0])
{
do_lp_io = 1;
......@@ -517,102 +521,8 @@ int main(
model_net_report_stats(net_id);
if(rank == 0)
{
#if PARAMS_LOG
//Open file to append simulation results
char log[200];
sprintf( log, "slimfly-results-log.txt");
slimfly_results_log_2=fopen(log, "a");
if(slimfly_results_log_2 == NULL)
tw_error(TW_LOC, "\n Failed to open slimfly results log file \n");
printf("Printing Simulation Parameters/Results Log File\n");
fprintf(slimfly_results_log_2,"%16.3d, %6.2f, %13.2f, ",traffic, load, MEAN_INTERVAL);
#endif
}
/* if(lp_io_flush(handle, MPI_COMM_WORLD) < 0)
{
assert(ret == 0 || !"lp_io_flush failure");
return(-1);
}
*/
tw_end();
if(rank == 0)
{
#if PARAMS_LOG
slimfly_ross_csv_log=fopen("ross.csv", "r");
if(slimfly_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 Slim Fly Log File\n");
char * line = NULL;
size_t len = 0;
ssize_t read = getline(&line, &len, slimfly_ross_csv_log);
while (read != -1)
{
read = getline(&line, &len, slimfly_ross_csv_log);
}
// read = getline(&line, &len, slimfly_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, ",");
// printf("%d: %s\n",idx,pch);
switch(idx)
{
/* case 0:
printf("%s\n",pch);
break;
case 1:
printf("%s\n",pch);
break;
case 2:
printf("%s\n",pch);
break;
case 3:
printf("%s\n",pch);
break;
case 4:
printf("%s\n",pch);
break;
*/
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(slimfly_results_log_2,"%12llu, %10llu, %16d, %10llu, %17.4f, %10.2f, %22.2f\n",total_events,rollbacks,gvt_computations,net_events,running_time,efficiency,event_rate);
fclose(slimfly_results_log_2);
fclose(slimfly_ross_csv_log);
#endif
}
return 0;
}
......
......@@ -2099,19 +2099,19 @@ dragonfly_custom_terminal_final( terminal_state * s,
sprintf(meta_filename, "dragonfly-msg-stats.meta");
FILE * fp = fopen(meta_filename, "w+");
fprintf(fp, "# Format <LP id> <Terminal ID> <Total Data Size> <Total Packet Latency> <# Flits/Packets finished> <Avg hops> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
fprintf(fp, "# Format <LP id> <Terminal ID> <Total Data Size> <Total Packet Latency> <# Flits/Packets finished> <Packets Generated> <Avg hops> <Busy Time> <Max packet Latency> <Min packet Latency >\n");
}
int written = 0;
written += sprintf(s->output_buf + written, "%llu %u %llu %lf %ld %lf %lf %lf %lf\n",
written += sprintf(s->output_buf + written, "%llu %u %llu %lf %ld %ld %lf %lf %lf %lf\n",
LLU(lp->gid), s->terminal_id, LLU(s->total_msg_size), s->total_time,
s->finished_packets, (double)s->total_hops/s->finished_chunks,
s->finished_packets, s->packet_gen, (double)s->total_hops/s->finished_chunks,
s->busy_time, s->max_latency, s->min_latency);
lp_io_write(lp->gid, (char*)"dragonfly-msg-stats", written, s->output_buf);
if(s->terminal_msgs[0] != NULL)
printf("[%llu] leftover terminal messages \n", LLU(lp->gid));
// if(s->terminal_msgs[0] != NULL)
// printf("[%llu] leftover terminal messages \n", LLU(lp->gid));
//if(s->packet_gen != s->packet_fin)
......@@ -2131,17 +2131,17 @@ void dragonfly_custom_router_final(router_state * s,
{
free(s->global_channel);
int i, j;
for(i = 0; i < s->params->radix; i++) {
for(j = 0; j < s->params->num_vcs; j++) {
if(s->queued_msgs[i][j] != NULL) {
printf("[%llu] leftover queued messages %d %d %d\n", LLU(lp->gid), i, j,
s->vc_occupancy[i][j]);
}
if(s->pending_msgs[i][j] != NULL) {
printf("[%llu] lefover pending messages %d %d\n", LLU(lp->gid), i, j);
}
}
}
// for(i = 0; i < s->params->radix; i++) {
// for(j = 0; j < s->params->num_vcs; j++) {
// if(s->queued_msgs[i][j] != NULL) {
// printf("[%llu] leftover queued messages %d %d %d\n", LLU(lp->gid), i, j,
// s->vc_occupancy[i][j]);
// }
// if(s->pending_msgs[i][j] != NULL) {
// printf("[%llu] lefover pending messages %d %d\n", LLU(lp->gid), i, j);
// }
// }
// }
rc_stack_destroy(s->st);
......
......@@ -2744,17 +2744,17 @@ void fattree_terminal_final( ft_terminal_state * s, tw_lp * lp )
int written = 0;
if(!s->terminal_id && !s->rail_id)
written = sprintf(s->output_buf, "# Format <LP id> <Terminal ID> <Rail ID> <Total Data Size> <Avg packet latency> <# Flits/Packets finished> <Avg hops> <Busy Time>\n");
written = sprintf(s->output_buf, "# Format <LP id> <Terminal ID> <Total Data Size> <Total packet latency> <# Flits/Packets finished> <Packets Generated> <Avg hops> <Busy Time>\n");
written += sprintf(s->output_buf + written, "%llu %u %u %llu %lf %ld %lf %lf\n",
LLU(lp->gid), s->terminal_id, s->rail_id, s->total_msg_size, s->total_time,
s->finished_packets, (double)s->total_hops/s->finished_chunks,
written += sprintf(s->output_buf + written, "%llu %u %llu %lf %ld %ld %lf %lf\n",
LLU(lp->gid), s->terminal_id, LLU(s->total_msg_size), s->total_time,
s->finished_packets, s->packet_gen ,(double)s->total_hops/s->finished_chunks,
s->busy_time[0]);
lp_io_write(lp->gid, "fattree-msg-stats", written, s->output_buf);
if(s->terminal_msgs[0] != NULL)
printf("[%llu] leftover terminal messages \n", LLU(lp->gid));
// if(s->terminal_msgs[0] != NULL)
// printf("[%llu] leftover terminal messages \n", LLU(lp->gid));
//if(s->packet_gen != s->packet_fin)
// printf("\n generated %d finished %d ", s->packet_gen, s->packet_fin);
......@@ -2815,14 +2815,14 @@ void fattree_switch_final(switch_state * s, tw_lp * lp)
(void)lp;
int i;
for(i = 0; i < s->radix; i++) {
if(s->queued_msgs[i] != NULL) {
printf("[%llu] leftover queued messages %d %d\n", LLU(lp->gid), i,s->vc_occupancy[i]);
}
if(s->pending_msgs[i] != NULL) {
printf("[%llu] lefover pending messages %d\n", LLU(lp->gid), i);
}
}
// for(i = 0; i < s->radix; i++) {
// if(s->queued_msgs[i] != NULL) {
// printf("[%llu] leftover queued messages %d %d\n", LLU(lp->gid), i,s->vc_occupancy[i]);
// }
// if(s->pending_msgs[i] != NULL) {
// printf("[%llu] lefover pending messages %d\n", LLU(lp->gid), i);
// }
// }
rc_stack_destroy(s->st);
......
......@@ -69,8 +69,6 @@ FILE * MMS_input_file=NULL;
int csf_ratio = 1; //Constant selected to balance the ratio between minimal and indirect routes
int num_indirect_routes = 4; //Number of indirect (Valiant) routes to use in Adaptive routing methods
float adaptive_threshold = 0.1;
float pe_throughput_percent = 0.0;
float pe_throughput = 0.0;
int *X;
int *X_prime;
......@@ -82,6 +80,8 @@ static double maxd(double a, double b) { return a < b ? b : a; }
/* minimal and non-minimal packet counts for adaptive routing*/
static int minimal_count=0, nonmin_count=0;
long slimfly_packet_gen = 0, slimfly_packet_fin = 0;
typedef struct slimfly_param slimfly_param;
/* annotation-specific parameters (unannotated entry occurs at the
* last index) */
......@@ -174,6 +174,9 @@ struct terminal_state
{
uint64_t packet_counter;
int packet_gen;
int packet_fin;
int router_id;
int terminal_id;
......@@ -200,8 +203,8 @@ struct terminal_state
uint64_t rank_tbl_pop;
tw_stime total_time;
long total_msg_size;
long total_hops;
uint64_t total_msg_size;
double total_hops;
long finished_msgs;
long finished_chunks;
long finished_packets;
......@@ -593,8 +596,7 @@ static void slimfly_report_stats()
long long total_finished_msgs, final_msg_sz;
tw_stime avg_time, max_time;
int total_minimal_packets, total_nonmin_packets;
float throughput_avg = 0.0;
float throughput_avg2 = 0.0;
long total_gen, total_fin;
MPI_Reduce( &total_hops, &avg_hops, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_packets, &total_finished_packets, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
......@@ -604,8 +606,8 @@ static void slimfly_report_stats()
MPI_Reduce( &slimfly_total_time, &avg_time, 1,MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &slimfly_max_latency, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
MPI_Reduce(&pe_throughput_percent, &throughput_avg, 1, MPI_FLOAT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&pe_throughput, &throughput_avg2, 1, MPI_FLOAT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &slimfly_packet_gen, &total_gen, 1, MPI_LONG, MPI_SUM, 0, MPI_COMM_CODES);
MPI_Reduce( &slimfly_packet_fin, &total_fin, 1, MPI_LONG, MPI_SUM, 0, MPI_COMM_CODES);
MPI_Reduce(&minimal_count, &total_minimal_packets, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce(&nonmin_count, &total_nonmin_packets, 1, MPI_INT, MPI_SUM, 0, MPI_COMM_WORLD);
......@@ -613,8 +615,9 @@ static void slimfly_report_stats()
/* print statistics */
if(!g_tw_mynode)
{
printf(" Average number of hops traversed %f average chunk latency %lf us maximum chunk latency %lf us avg message size %lf bytes finished messages %lld \n", (float)avg_hops/total_finished_chunks, avg_time/(total_finished_chunks*1000), max_time/1000, (float)final_msg_sz/total_finished_msgs, total_finished_msgs);
printf(" Average number of hops traversed %f average chunk latency %lf us maximum chunk latency %lf us avg message size %lf bytes finished messages %lld finished chunks %lld \n",
(float)avg_hops/total_finished_chunks, avg_time/(total_finished_chunks*1000), max_time/1000, (float)final_msg_sz/total_finished_msgs, total_finished_msgs, total_finished_chunks);
printf(" Total packets generated %ld finished %ld \n", total_gen, total_fin);
}
#if ROUTER_OCCUPANCY_LOG
......@@ -738,6 +741,8 @@ static void slimfly_report_stats()
void slim_terminal_init( terminal_state * s,
tw_lp * lp )
{
s->packet_gen = 0;
s->packet_fin = 0;
int i;
char anno[MAX_NAME_LENGTH];
......@@ -1170,6 +1175,9 @@ void slim_router_credit_send(router_state * s, slim_terminal_message * msg, tw_l
void slim_packet_generate_rc(terminal_state * s, tw_bf * bf, slim_terminal_message * msg, tw_lp * lp)
{
s->packet_gen--;
slimfly_packet_gen--;
tw_rand_reverse_unif(lp->rng);
int num_chunks = msg->packet_size/s->params->chunk_size;
......@@ -1209,6 +1217,9 @@ void slim_packet_generate_rc(terminal_state * s, tw_bf * bf, slim_terminal_messa
/* generates packet at the current slimfly compute node */
void slim_packet_generate(terminal_state * s, tw_bf * bf, slim_terminal_message * msg, tw_lp * lp)
{
slimfly_packet_gen++;
s->packet_gen++;
tw_stime ts, nic_ts;
assert(lp->gid != msg->dest_terminal_id);
......@@ -1217,13 +1228,15 @@ void slim_packet_generate(terminal_state * s, tw_bf * bf, slim_terminal_message
uint64_t i;
int total_event_size;
uint64_t num_chunks = msg->packet_size / p->chunk_size;
if (msg->packet_size % s->params->chunk_size)
double cn_delay = s->params->cn_delay;
if (msg->packet_size < s->params->chunk_size)
num_chunks++;
if(!num_chunks)
num_chunks = 1;
if (msg->packet_size < s->params->chunk_size)
cn_delay = bytes_to_ns(msg->packet_size % s->params->chunk_size, s->params->cn_bandwidth);
nic_ts = g_tw_lookahead + (s->params->cn_delay * num_chunks) + tw_rand_unif(lp->rng);
nic_ts = g_tw_lookahead + (num_chunks * cn_delay) + tw_rand_unif(lp->rng);
msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter;
msg->my_N_hop = 0;
......@@ -1232,8 +1245,8 @@ void slim_packet_generate(terminal_state * s, tw_bf * bf, slim_terminal_message
msg->intm_group_id = -1;
msg->intm_router_id = -1;
if(msg->packet_ID == TRACK)
printf("\x1B[34m-->Packet generated at terminal %d sending to router %d \x1b[0m\n", (int)lp->gid, s->router_id);
//if(msg->packet_ID == TRACK)
// printf("%llu \x1B[34m-->Packet generated at terminal %d sending to router %d \x1b[0m\n", LLU(tw_now(lp)),(int)lp->gid, s->router_id);
for(i = 0; i < num_chunks; i++)
{
......@@ -1502,6 +1515,12 @@ void slim_packet_send(terminal_state * s, tw_bf * bf, slim_terminal_message * ms
void slim_packet_arrive_rc(terminal_state * s, tw_bf * bf, slim_terminal_message * msg, tw_lp * lp)
{
if(bf->c31)
{
s->packet_fin--;
slimfly_packet_fin--;
}
tw_rand_reverse_unif(lp->rng);
if(msg->path_type == MINIMAL)
minimal_count--;
......@@ -1647,6 +1666,13 @@ void slim_packet_arrive(terminal_state * s, tw_bf * bf, slim_terminal_message *
if(!num_chunks)
num_chunks = 1;