Commit d4a1ac9a authored by Misbah Mubarak's avatar Misbah Mubarak
Browse files

Merge branch 'slimfly-tomacs' into 'master'

Slim fly updates and fixes

See merge request !17
parents 30c16180 5aa9a9e8
......@@ -52,7 +52,7 @@ struct slim_terminal_message
/* For routing */
int intm_group_id;
int intm_router_id;
int chunk_id;
uint64_t chunk_id;
uint64_t packet_size;
uint64_t message_id;
uint64_t total_size;
......@@ -73,8 +73,11 @@ struct slim_terminal_message
short path_type;
tw_stime saved_available_time;
tw_stime saved_avg_time;
tw_stime saved_credit_time;
tw_stime saved_collective_init_time;
tw_stime saved_rcv_time;
tw_stime saved_busy_time;
tw_stime saved_total_time;
// tw_stime saved_credit_time;
// tw_stime saved_collective_init_time;
tw_stime saved_hist_start_time;
tw_stime msg_start_time;
......
......@@ -230,11 +230,11 @@ static void issue_event(
}
if(load != 0)
{
MEAN_INTERVAL = bytes_to_ns(this_packet_size, load*this_global_bandwidth) + this_link_delay;
MEAN_INTERVAL = bytes_to_ns(this_packet_size, load*this_global_bandwidth);
}
/* skew each kickoff event slightly to help avoid event ties later on */
kickoff_time = g_tw_lookahead + MEAN_INTERVAL + tw_rand_exponential(lp->rng, (double)MEAN_INTERVAL/100);
kickoff_time = g_tw_lookahead + tw_rand_exponential(lp->rng, MEAN_INTERVAL);
e = tw_event_new(lp->gid, kickoff_time, lp);
m = tw_event_data(e);
......@@ -256,8 +256,13 @@ static void handle_kickoff_rev_event(
svr_msg * m,
tw_lp * lp)
{
if(b->c1)
tw_rand_reverse_unif(lp->rng);
ns->msg_sent_count--;
model_net_event_rc(net_id, lp, PAYLOAD_SZ);
tw_rand_reverse_unif(lp->rng);
}
static void handle_kickoff_event(
svr_state * ns,
......@@ -284,6 +289,7 @@ static void handle_kickoff_event(
/* in case of uniform random traffic, send to a random destination. */
if(traffic == UNIFORM)
{
b->c1 = 1;
local_dest = tw_rand_integer(lp->rng, 0, num_nodes - 1);
// printf("\n LP %ld sending to %d ", lp->gid, local_dest);
}
......
......@@ -25,7 +25,7 @@
#define MEAN_PROCESS 1.0
/* collective specific parameters */
#define SFLY_HASH_TABLE_SIZE 4999
#define DFLY_HASH_TABLE_SIZE 65536
// debugging parameters
#define TRACK 4
......@@ -49,12 +49,12 @@
#define N_COLLECT_POINTS 100
/*unsigned long terminal_sends[TEMP_NUM_TERMINALS][N_COLLECT_POINTS];
unsigned long terminal_recvs[TEMP_NUM_TERMINALS][N_COLLECT_POINTS];
unsigned long router_sends[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
unsigned long router_recvs[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
int vc_occupancy_storage_router[TEMP_NUM_ROUTERS][TEMP_RADIX][TEMP_NUM_VC][N_COLLECT_POINTS];
int vc_occupancy_storage_terminal[TEMP_NUM_TERMINALS][TEMP_NUM_VC][N_COLLECT_POINTS];
*/FILE * slimfly_terminal_sends_recvs_log = NULL;
unsigned long terminal_recvs[TEMP_NUM_TERMINALS][N_COLLECT_POINTS];
unsigned long router_sends[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
unsigned long router_recvs[TEMP_NUM_ROUTERS][N_COLLECT_POINTS];
int vc_occupancy_storage_router[TEMP_NUM_ROUTERS][TEMP_RADIX][TEMP_NUM_VC][N_COLLECT_POINTS];
int vc_occupancy_storage_terminal[TEMP_NUM_TERMINALS][TEMP_NUM_VC][N_COLLECT_POINTS];
*/FILE * slimfly_terminal_sends_recvs_log = NULL;
FILE * slimfly_router_sends_recvs_log = NULL;
FILE * slimfly_router_occupancy_log=NULL;
FILE * slimfly_terminal_occupancy_log=NULL;
......@@ -109,7 +109,7 @@ struct slim_terminal_message_list {
};
void slim_init_terminal_message_list(slim_terminal_message_list *this,
slim_terminal_message *inmsg) {
slim_terminal_message *inmsg) {
this->msg = *inmsg;
this->event_data = NULL;
this->next = NULL;
......@@ -144,10 +144,10 @@ struct slimfly_param
double local_delay;
double global_delay;
double credit_delay;
//slimfly added
double router_delay; /*Router processing delay moving packet from input port to output port*/
double link_delay; /*Network link latency. Currently encorporated into the arrival time*/
int num_local_channels;
//slimfly added
double router_delay; /*Router processing delay moving packet from input port to output port*/
double link_delay; /*Network link latency. Currently encorporated into the arrival time*/
int num_local_channels;
};
struct sfly_hash_key
......@@ -158,11 +158,11 @@ struct sfly_hash_key
struct sfly_qhash_entry
{
struct sfly_hash_key key;
char * remote_event_data;
int num_chunks;
int remote_event_size;
struct qhash_head hash_link;
struct sfly_hash_key key;
char * remote_event_data;
int num_chunks;
int remote_event_size;
struct qhash_head hash_link;
};
/* handles terminal and router events like packet generate/send/receive/buffer */
......@@ -173,70 +173,73 @@ typedef struct router_state router_state;
/* slimfly compute node data structure */
struct terminal_state
{
uint64_t packet_counter;
// Dragonfly specific parameters
int router_id;
int terminal_id;
// Each terminal will have an input and output channel with the router
int* vc_occupancy; // NUM_VC
int num_vcs;
tw_stime terminal_available_time;
slim_terminal_message_list **terminal_msgs;
slim_terminal_message_list **terminal_msgs_tail;
int in_send_loop;
// Terminal generate, sends and arrival T_SEND, T_ARRIVAL, T_GENERATE
// Router-Router Intra-group sends and receives RR_LSEND, RR_LARRIVE
// Router-Router Inter-group sends and receives RR_GSEND, RR_GARRIVE
struct mn_stats slimfly_stats_array[CATEGORY_MAX];
struct rc_stack * st;
int issueIdle;
int terminal_length;
const char * anno;
const slimfly_param *params;
struct qhash_table *rank_tbl;
uint64_t rank_tbl_pop;
tw_stime total_time;
long total_msg_size;
long total_hops;
long finished_msgs;
long finished_chunks;
long finished_packets;
char output_buf[512];
uint64_t packet_counter;
// Dragonfly specific parameters
int router_id;
int terminal_id;
// Each terminal will have an input and output channel with the router
int* vc_occupancy; // NUM_VC
int num_vcs;
tw_stime terminal_available_time;
slim_terminal_message_list **terminal_msgs;
slim_terminal_message_list **terminal_msgs_tail;
int in_send_loop;
// Terminal generate, sends and arrival T_SEND, T_ARRIVAL, T_GENERATE
// Router-Router Intra-group sends and receives RR_LSEND, RR_LARRIVE
// Router-Router Inter-group sends and receives RR_GSEND, RR_GARRIVE
struct mn_stats slimfly_stats_array[CATEGORY_MAX];
struct rc_stack * st;
int issueIdle;
int terminal_length;
const char * anno;
const slimfly_param *params;
struct qhash_table *rank_tbl;
uint64_t rank_tbl_pop;
tw_stime total_time;
long total_msg_size;
long total_hops;
long finished_msgs;
long finished_chunks;
long finished_packets;
tw_stime last_buf_full;
tw_stime busy_time;
char output_buf[512];
};
/* terminal event type (1-4) */
enum event_t
{
T_GENERATE=1,
T_ARRIVE,
T_SEND,
T_BUFFER,
R_SEND,
R_ARRIVE,
R_BUFFER
T_GENERATE=1,
T_ARRIVE,
T_SEND,
T_BUFFER,
R_SEND,
R_ARRIVE,
R_BUFFER
};
/* status of a virtual channel can be idle, active, allocated or wait for credit */
enum vc_status
{
VC_IDLE,
VC_ACTIVE,
VC_ALLOC,
VC_CREDIT
VC_IDLE,
VC_ACTIVE,
VC_ALLOC,
VC_CREDIT
};
/* whether the last hop of a packet was global, local or a terminal */
enum last_hop
{
GLOBAL,
LOCAL,
TERMINAL
GLOBAL,
LOCAL,
TERMINAL
};
/* three forms of routing algorithms available, adaptive routing is not
......@@ -251,27 +254,35 @@ enum ROUTING_ALGO
struct router_state
{
int router_id;
int group_id;
int router_id;
int group_id;
int* global_channel;
int* local_channel;
int* global_channel;
int* local_channel;
tw_stime* next_output_available_time;
slim_terminal_message_list ***pending_msgs;
slim_terminal_message_list ***pending_msgs_tail;
slim_terminal_message_list ***queued_msgs;
slim_terminal_message_list ***queued_msgs_tail;
int *in_send_loop;
tw_stime* next_output_available_time;
slim_terminal_message_list ***pending_msgs;
slim_terminal_message_list ***pending_msgs_tail;
slim_terminal_message_list ***queued_msgs;
slim_terminal_message_list ***queued_msgs_tail;
int *in_send_loop;
struct rc_stack * st;
int** vc_occupancy;
int* link_traffic; //Aren't used
tw_stime* last_buf_full;
tw_stime* busy_time;
tw_stime* busy_time_sample;
const char * anno;
const slimfly_param *params;
char output_buf[4096];
char output_buf2[4096];
int* prev_hist_num; //Aren't used
int* cur_hist_num; //Aren't used
int** vc_occupancy;
int* link_traffic; //Aren't used
const char * anno;
const slimfly_param *params;
int* prev_hist_num; //Aren't used
int* cur_hist_num; //Aren't used
};
static short routing = MINIMAL;
......@@ -289,7 +300,7 @@ static int slimfly_rank_hash_compare(
void *key, struct qhash_head *link)
{
struct sfly_hash_key *message_key = (struct sfly_hash_key *)key;
struct sfly_qhash_entry *tmp;
struct sfly_qhash_entry *tmp = NULL;
tmp = qhash_entry(link, struct sfly_qhash_entry, hash_link);
......@@ -301,12 +312,12 @@ static int slimfly_rank_hash_compare(
}
static int slimfly_hash_func(void *k, int table_size)
{
struct sfly_hash_key *tmp = (struct sfly_hash_key *)k;
uint64_t key = (~tmp->message_id) + (tmp->message_id << 18);
key = key * 21;
key = ~key ^ (tmp->sender_id >> 4);
key = key * tmp->sender_id;
return (int)(key % table_size);
struct sfly_hash_key *tmp = (struct sfly_hash_key *)k;
uint64_t key = (~tmp->message_id) + (tmp->message_id << 18);
key = key * 21;
key = ~key ^ (tmp->sender_id >> 4);
key = key * tmp->sender_id;
return (int)(key & (table_size - 1));
}
/* convert GiB/s and bytes to ns */
......@@ -327,15 +338,17 @@ static tw_stime bytes_to_ns(uint64_t bytes, double GB_p_s)
/* returns the slimfly message size */
static int slimfly_get_msg_sz(void)
{
return sizeof(slim_terminal_message);
return sizeof(slim_terminal_message);
}
/*static void free_tmp(void * ptr)
static void free_tmp(void * ptr)
{
struct sfly_qhash_entry * sfly = ptr;
free(sfly->remote_event_data);
free(sfly);
}*/
if(sfly->remote_event_data)
free(sfly->remote_event_data);
if(sfly)
free(sfly);
}
static void append_to_terminal_message_list(
slim_terminal_message_list ** thisq,
......@@ -365,23 +378,6 @@ static void prepend_to_terminal_message_list(
thisq[index] = msg;
}
static void create_prepend_to_terminal_message_list(
slim_terminal_message_list ** thisq,
slim_terminal_message_list ** thistail,
int index,
slim_terminal_message *msg) {
slim_terminal_message_list* new_entry = (slim_terminal_message_list*)malloc(
sizeof(slim_terminal_message_list));
slim_init_terminal_message_list(new_entry, msg);
if(msg->remote_event_size_bytes) {
void *m_data = model_net_method_get_edata(SLIMFLY, msg);
size_t s = msg->remote_event_size_bytes + msg->local_event_size_bytes;
new_entry->event_data = (void*)malloc(s);
memcpy(new_entry->event_data, m_data, s);
}
prepend_to_terminal_message_list( thisq, thistail, index, new_entry);
}
static slim_terminal_message_list* return_head(
slim_terminal_message_list ** thisq,
slim_terminal_message_list ** thistail,
......@@ -404,6 +400,7 @@ static slim_terminal_message_list* return_tail(
slim_terminal_message_list ** thistail,
int index) {
slim_terminal_message_list *tail = thistail[index];
assert(tail);
if(tail->prev != NULL) {
tail->prev->next = NULL;
thistail[index] = tail->prev;
......@@ -415,50 +412,6 @@ static slim_terminal_message_list* return_tail(
return tail;
}
static void copy_terminal_list_entry( slim_terminal_message_list *cur_entry,
slim_terminal_message *msg) {
slim_terminal_message *cur_msg = &cur_entry->msg;
msg->travel_start_time = cur_msg->travel_start_time;
msg->packet_ID = cur_msg->packet_ID;
strcpy(msg->category, cur_msg->category);
msg->final_dest_gid = cur_msg->final_dest_gid;
msg->msg_start_time = msg->msg_start_time;
msg->sender_lp = cur_msg->sender_lp;
msg->dest_terminal_id = cur_msg->dest_terminal_id;
msg->src_terminal_id = cur_msg->src_terminal_id;
msg->local_id = cur_msg->local_id;
msg->origin_router_id = cur_msg->origin_router_id;
msg->my_N_hop = cur_msg->my_N_hop;
msg->my_l_hop = cur_msg->my_l_hop;
msg->my_g_hop = cur_msg->my_g_hop;
msg->intm_lp_id = cur_msg->intm_lp_id;
msg->saved_channel = cur_msg->saved_channel;
msg->saved_vc = cur_msg->saved_vc;
msg->last_hop = cur_msg->last_hop;
msg->path_type = cur_msg->path_type;
msg->vc_index = cur_msg->vc_index;
msg->output_chan = cur_msg->output_chan;
msg->is_pull = cur_msg->is_pull;
msg->pull_size = cur_msg->pull_size;
msg->intm_group_id = cur_msg->intm_group_id;
msg->intm_router_id = cur_msg->intm_router_id;
msg->chunk_id = cur_msg->chunk_id;
msg->sender_mn_lp = cur_msg->sender_mn_lp;
msg->total_size = cur_msg->total_size;
msg->packet_size = cur_msg->packet_size;
msg->message_id = cur_msg->message_id;
msg->local_event_size_bytes = cur_msg->local_event_size_bytes;
msg->remote_event_size_bytes = cur_msg->remote_event_size_bytes;
msg->sender_node = cur_msg->sender_node;
msg->next_stop = cur_msg->next_stop;
msg->magic = cur_msg->magic;
if(msg->local_event_size_bytes + msg->remote_event_size_bytes > 0) {
void *m_data = model_net_method_get_edata(SLIMFLY, msg);
memcpy(m_data, cur_entry->event_data,
msg->local_event_size_bytes + msg->remote_event_size_bytes);
}
}
static void slimfly_read_config(const char * anno, slimfly_param *params){
// shorthand
slimfly_param *p = params;
......@@ -471,7 +424,7 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
p->num_routers);
}
configuration_get_value_int(&config, "PARAMS", "num_vcs", anno, &p->num_vcs);
configuration_get_value_int(&config, "PARAMS", "num_vcs", anno, &p->num_vcs);
if(!p->num_vcs) {
p->num_vcs = 4;
fprintf(stderr, "Virtual channel size not specified, setting to %d\n", p->num_vcs);
......@@ -537,20 +490,20 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
fprintf(stderr, "Number of terminals not specified, setting to %d\n", p->num_cn);
}
p->router_delay = -1;
p->router_delay = -1;
configuration_get_value_double(&config, "PARAMS", "router_delay", anno, &p->router_delay);
if(p->router_delay < 0) {
p->router_delay = 0;
fprintf(stderr, "Router delay not specified, setting to %lf\n", p->router_delay);
}
char **values;
char **values;
size_t length;
int ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X", anno, &values, &length);
int ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X", anno, &values, &length);
if (ret != 1)
tw_error(TW_LOC, "unable to read PARAMS:generator_set_X\n");
if (length < 2)
fprintf(stderr, "generator set X less than 2 elements\n");
if (length < 2)
fprintf(stderr, "generator set X less than 2 elements\n");
X = (int*)malloc(sizeof(int)*length);
for (size_t i = 0; i < length; i++)
......@@ -559,13 +512,13 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
}
free(values);
ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X_prime", anno, &values, &length);
ret = configuration_get_multivalue(&config, "PARAMS", "generator_set_X_prime", anno, &values, &length);
if (ret != 1)
tw_error(TW_LOC, "unable to read PARAMS:generator_set_X_prime\n");
if (length < 2)
fprintf(stderr, "generator set X_prime less than 2 elements\n");
if (length < 2)
fprintf(stderr, "generator set X_prime less than 2 elements\n");
X_size = length;
X_size = length;
X_prime = (int*)malloc(sizeof(int)*length);
for (size_t i = 0; i < length; i++)
{
......@@ -590,16 +543,16 @@ static void slimfly_read_config(const char * anno, slimfly_param *params){
routing = -1;
}
TEMP_RADIX = p->num_local_channels + p->num_global_channels + p->num_cn;
TEMP_NUM_VC = p->num_vcs;
TEMP_RADIX = p->num_local_channels + p->num_global_channels + p->num_cn;
TEMP_NUM_VC = p->num_vcs;
// set the derived parameters
p->num_groups = p->num_routers * 2;
p->radix = (p->num_cn + p->num_global_channels + p->num_local_channels);
p->slim_total_routers = p->num_groups * p->num_routers;
p->slim_total_terminals = p->slim_total_routers * p->num_cn;
slim_total_routers_noah = p->num_groups * p->num_routers;
slim_total_terminals_noah = p->slim_total_routers * p->num_cn;
slim_total_routers_noah = p->num_groups * p->num_routers;
slim_total_terminals_noah = p->slim_total_routers * p->num_cn;
int rank;
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
if(!rank) {
......@@ -633,168 +586,168 @@ static void slimfly_configure(){
/* report slimfly statistics like average and maximum packet latency, average number of hops traversed */
static void slimfly_report_stats()
{
long long avg_hops, total_finished_packets, total_finished_chunks;
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;
char log[300];
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);
MPI_Reduce( &N_finished_msgs, &total_finished_msgs, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_chunks, &total_finished_chunks, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &total_msg_sz, &final_msg_sz, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
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(&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);
/* 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);
long long avg_hops, total_finished_packets, total_finished_chunks;
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;
char log[300];
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);
MPI_Reduce( &N_finished_msgs, &total_finished_msgs, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &N_finished_chunks, &total_finished_chunks, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &total_msg_sz, &final_msg_sz, 1, MPI_LONG_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
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(&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);
/* 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);
#if PARAMS_LOG
throughput_avg = throughput_avg / (float)slim_total_terminals_noah;
throughput_avg2 = throughput_avg2 / (float)slim_total_terminals_noah;
//Open file to append simulation results
sprintf( log, "slimfly-results-log.txt");
slimfly_results_log=fopen(log, "a");
if(slimfly_results_log == 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,"%10.3lf, %15.3lf, %11.3lf, %13.3d, %16.3d, %16.3lld, %25.5f, %14.5f, ", (float)avg_hops/total_finished_packets, avg_time/(total_finished_packets),max_time,total_minimal_packets,total_nonmin_packets,total_finished_chunks,throughput_avg*100,throughput_avg2);
fclose(slimfly_results_log);
throughput_avg = throughput_avg / (float)slim_total_terminals_noah;
throughput_avg2 = throughput_avg2 / (float)slim_total_terminals_noah;
//Open file to append simulation results
sprintf( log, "slimfly-results-log.txt");
slimfly_results_log=fopen(log, "a");
if(slimfly_results_log == 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,"%10.3lf, %15.3lf, %11.3lf, %13.3d, %16.3d, %16.3lld, %25.5f, %14.5f, ", (float)avg_hops/total_finished_packets, avg_time/(total_finished_packets),max_time,total_minimal_packets,total_nonmin_packets,total_finished_chunks,throughput_avg*100,throughput_avg2);
fclose(slimfly_results_log);
#endif
}
}
#if ROUTER_OCCUPANCY_LOG
if(tw_ismaster())
{
printf("Printing Realtime Router Occupancy Log Files\n");
for(k=0; k<slim_total_routers_noah; k++)
{
sprintf( log, "vc-occupancy/routers/slimfly_router_occupancy_log.%d.txt", k );
slimfly_router_occupancy_log=fopen(log, "w+");
if(slimfly_router_occupancy_log == NULL)
tw_error(TW_LOC, "\n Failed to open slimfly router occupancy log file \n");
for( t=0; t<N_COLLECT_POINTS; t++ )
{
if(t == 0)
{
fprintf(slimfly_router_occupancy_log, "%d, ",t*100/N_COLLECT_POINTS);
}
else
{
fprintf(slimfly_router_occupancy_log