Commit 0547a991 authored by Misbah Mubarak's avatar Misbah Mubarak
Browse files

updating MPI sim layer for blocking receives, updating dragonfly model for the...

updating MPI sim layer for blocking receives, updating dragonfly model for the message remainders, checking for negative byte size in dumpi traces
parent 8f702e82
...@@ -189,7 +189,7 @@ struct codes_workload_op ...@@ -189,7 +189,7 @@ struct codes_workload_op
/* TODO: not sure why source rank is here */ /* TODO: not sure why source rank is here */
int source_rank;/* source rank of MPI send message */ int source_rank;/* source rank of MPI send message */
int dest_rank; /* dest rank of MPI send message */ int dest_rank; /* dest rank of MPI send message */
int num_bytes; /* number of bytes to be transferred over the network */ int64_t num_bytes; /* number of bytes to be transferred over the network */
int16_t data_type; /* MPI data type to be matched with the recv */ int16_t data_type; /* MPI data type to be matched with the recv */
int count; /* number of elements to be received */ int count; /* number of elements to be received */
int tag; /* tag of the message */ int tag; /* tag of the message */
......
...@@ -107,7 +107,7 @@ struct mpi_msgs_queue ...@@ -107,7 +107,7 @@ struct mpi_msgs_queue
int tag; int tag;
int source_rank; int source_rank;
int dest_rank; int dest_rank;
int num_bytes; uint64_t num_bytes;
tw_stime req_init_time; tw_stime req_init_time;
dumpi_req_id req_id; dumpi_req_id req_id;
struct qlist_head ql; struct qlist_head ql;
...@@ -204,7 +204,7 @@ struct nw_message ...@@ -204,7 +204,7 @@ struct nw_message
{ {
tw_lpid src_rank; tw_lpid src_rank;
tw_lpid dest_rank; tw_lpid dest_rank;
int num_bytes; int64_t num_bytes;
int num_matched; int num_matched;
int data_type; int data_type;
double sim_start_time; double sim_start_time;
...@@ -222,7 +222,7 @@ struct nw_message ...@@ -222,7 +222,7 @@ struct nw_message
double saved_recv_time; double saved_recv_time;
double saved_wait_time; double saved_wait_time;
double saved_delay; double saved_delay;
int saved_num_bytes; int64_t saved_num_bytes;
struct codes_workload_op * saved_op; struct codes_workload_op * saved_op;
} rc; } rc;
}; };
...@@ -285,6 +285,21 @@ static void print_waiting_reqs(int32_t * reqs, int count) ...@@ -285,6 +285,21 @@ static void print_waiting_reqs(int32_t * reqs, int count)
for(i = 0; i < count; i++ ) for(i = 0; i < count; i++ )
printf(" %d ", reqs[i]); printf(" %d ", reqs[i]);
} }
static void print_msgs_queue(struct qlist_head * head, int is_send)
{
if(is_send)
printf("\n Send msgs queue: ");
else
printf("\n Recv msgs queue: ");
struct qlist_head * ent = NULL;
mpi_msgs_queue * current = NULL;
qlist_for_each(ent, head)
{
current = qlist_entry(ent, mpi_msgs_queue, ql);
printf(" \n Source %d Dest %d bytes %d tag %d ", current->source_rank, current->dest_rank, current->num_bytes, current->tag);
}
}
static void print_completed_queue(struct qlist_head * head) static void print_completed_queue(struct qlist_head * head)
{ {
printf("\n Completed queue: "); printf("\n Completed queue: ");
...@@ -370,8 +385,8 @@ static int notify_posted_wait(nw_state* s, ...@@ -370,8 +385,8 @@ static int notify_posted_wait(nw_state* s,
wait_elem->num_completed, wait_elem->num_completed,
wait_elem->count, wait_elem->count,
lp->gid); lp->gid);
if(wait_elem->num_completed > wait_elem->count) // if(wait_elem->num_completed > wait_elem->count)
tw_lp_suspend(lp, 1, 0); // tw_lp_suspend(lp, 1, 0);
if(wait_elem->num_completed == wait_elem->count) if(wait_elem->num_completed == wait_elem->count)
{ {
...@@ -522,7 +537,7 @@ static void codes_exec_mpi_wait_all( ...@@ -522,7 +537,7 @@ static void codes_exec_mpi_wait_all(
struct completed_requests* current = NULL; struct completed_requests* current = NULL;
qlist_for_each(ent, &s->completed_reqs) qlist_for_each(ent, &s->completed_reqs)
{ {
current = qlist_entry(ent, completed_requests, ql); current = qlist_entry(ent, struct completed_requests, ql);
if(current->req_id == req_id) if(current->req_id == req_id)
num_matched++; num_matched++;
} }
...@@ -590,6 +605,8 @@ static int rm_matching_rcv(nw_state * ns, ...@@ -590,6 +605,8 @@ static int rm_matching_rcv(nw_state * ns,
if(qi->op_type == CODES_WK_IRECV) if(qi->op_type == CODES_WK_IRECV)
update_completed_queue(ns, bf, m, lp, qi->req_id); update_completed_queue(ns, bf, m, lp, qi->req_id);
else if(qi->op_type == CODES_WK_RECV)
codes_issue_next_event(lp);
qlist_del(&qi->ql); qlist_del(&qi->ql);
...@@ -811,11 +828,9 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -811,11 +828,9 @@ static void codes_exec_mpi_send(nw_state* s,
m->rc.saved_num_bytes = mpi_op->u.send.num_bytes; m->rc.saved_num_bytes = mpi_op->u.send.num_bytes;
/* model-net event */ /* model-net event */
tw_lpid dest_rank; tw_lpid dest_rank;
codes_mapping_get_lp_info(lp->gid, lp_group_name, &mapping_grp_id, dest_rank = codes_mapping_get_lpid_from_relative(global_dest_rank, NULL, "nw-lp", NULL, 0);
lp_type_name, &mapping_type_id, annotation, &mapping_rep_id, &mapping_offset); // if(net_id == DRAGONFLY) /* special handling for the dragonfly case */
/* {
if(net_id == DRAGONFLY) /* special handling for the dragonfly case */
{
int num_routers, lps_per_rep, factor; int num_routers, lps_per_rep, factor;
num_routers = codes_mapping_get_lp_count(lp_group_name, 1, num_routers = codes_mapping_get_lp_count(lp_group_name, 1,
"modelnet_dragonfly_router", NULL, 1); "modelnet_dragonfly_router", NULL, 1);
...@@ -825,11 +840,11 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -825,11 +840,11 @@ static void codes_exec_mpi_send(nw_state* s,
} }
else else
{ {
/* other cases like torus/simplenet/loggp etc. */ */ /* other cases like torus/simplenet/loggp etc. */
codes_mapping_get_lp_id(lp_group_name, lp_type_name, NULL, 1, /* codes_mapping_get_lp_id(lp_group_name, lp_type_name, NULL, 1,
global_dest_rank, mapping_offset, &dest_rank); global_dest_rank, mapping_offset, &dest_rank);
} }
*/
num_bytes_sent += mpi_op->u.send.num_bytes; num_bytes_sent += mpi_op->u.send.num_bytes;
s->num_bytes_sent += mpi_op->u.send.num_bytes; s->num_bytes_sent += mpi_op->u.send.num_bytes;
...@@ -880,13 +895,13 @@ static void codes_exec_mpi_send(nw_state* s, ...@@ -880,13 +895,13 @@ static void codes_exec_mpi_send(nw_state* s,
{ {
if(mpi_op->op_type == CODES_WK_ISEND) if(mpi_op->op_type == CODES_WK_ISEND)
{ {
fprintf(workload_log, "\n (%lf) APP %d MPI ISEND SOURCE %ld DEST %ld BYTES %ld ", fprintf(workload_log, "\n (%lf) APP %d MPI ISEND SOURCE %ld DEST %ld TAG %d BYTES %ld ",
tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.num_bytes); tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.tag, mpi_op->u.send.num_bytes);
} }
else else
fprintf(workload_log, "\n (%lf) APP ID %d MPI SEND SOURCE %ld DEST %ld BYTES %ld ", fprintf(workload_log, "\n (%lf) APP ID %d MPI SEND SOURCE %ld DEST %ld TAG %d BYTES %ld ",
tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.num_bytes); tw_now(lp), s->app_id, s->nw_id, global_dest_rank, mpi_op->u.send.tag, mpi_op->u.send.num_bytes);
} }
/* isend executed, now get next MPI operation from the queue */ /* isend executed, now get next MPI operation from the queue */
if(mpi_op->op_type == CODES_WK_ISEND) if(mpi_op->op_type == CODES_WK_ISEND)
codes_issue_next_event(lp); codes_issue_next_event(lp);
...@@ -1004,6 +1019,8 @@ static void update_arrival_queue_rc(nw_state* s, ...@@ -1004,6 +1019,8 @@ static void update_arrival_queue_rc(nw_state* s,
} }
if(qi->op_type == CODES_WK_IRECV) if(qi->op_type == CODES_WK_IRECV)
update_completed_queue_rc(s, bf, m, lp); update_completed_queue_rc(s, bf, m, lp);
else if(qi->op_type == CODES_WK_RECV)
codes_issue_next_event_rc(lp);
} }
else if(m->fwd.found_match < 0) else if(m->fwd.found_match < 0)
{ {
...@@ -1125,7 +1142,6 @@ void nw_test_init(nw_state* s, tw_lp* lp) ...@@ -1125,7 +1142,6 @@ void nw_test_init(nw_state* s, tw_lp* lp)
return; return;
} }
if (strcmp(workload_type, "dumpi") == 0){ if (strcmp(workload_type, "dumpi") == 0){
strcpy(params_d.file_name, file_name_of_job[lid.job]); strcpy(params_d.file_name, file_name_of_job[lid.job]);
params_d.num_net_traces = num_traces_of_job[lid.job]; params_d.num_net_traces = num_traces_of_job[lid.job];
...@@ -1409,7 +1425,8 @@ void nw_test_finalize(nw_state* s, tw_lp* lp) ...@@ -1409,7 +1425,8 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
} }
int count_irecv = qlist_count(&s->pending_recvs_queue); int count_irecv = qlist_count(&s->pending_recvs_queue);
int count_isend = qlist_count(&s->arrival_queue); int count_isend = qlist_count(&s->arrival_queue);
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", if(count_irecv || count_isend)
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",
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); 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);
written += sprintf(s->output_buf + written, "\n %llu %llu %ld %ld %ld %ld %lf %lf %lf", lp->gid, s->nw_id, s->num_sends, s->num_recvs, s->num_bytes_sent, written += sprintf(s->output_buf + written, "\n %llu %llu %ld %ld %ld %ld %lf %lf %lf", lp->gid, s->nw_id, s->num_sends, s->num_recvs, s->num_bytes_sent,
...@@ -1422,6 +1439,11 @@ void nw_test_finalize(nw_state* s, tw_lp* lp) ...@@ -1422,6 +1439,11 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
if(s->elapsed_time > max_time ) if(s->elapsed_time > max_time )
max_time = s->elapsed_time; max_time = s->elapsed_time;
if(count_irecv || count_isend)
{
print_msgs_queue(&s->pending_recvs_queue, 0);
print_msgs_queue(&s->arrival_queue, 1);
}
if(enable_sampling) if(enable_sampling)
{ {
fseek(workload_agg_log, sample_bytes_written, SEEK_SET); fseek(workload_agg_log, sample_bytes_written, SEEK_SET);
......
...@@ -5,7 +5,7 @@ ...@@ -5,7 +5,7 @@
*/ */
// Local router ID: 0 --- total_router-1 // Local router ID: 0 --- total_router-1
// Router LP ID // Router LP ID
// Terminal LP ID // Terminal LP ID
#include <ross.h> #include <ross.h>
...@@ -60,7 +60,7 @@ static int minimal_count=0, nonmin_count=0; ...@@ -60,7 +60,7 @@ static int minimal_count=0, nonmin_count=0;
static int num_routers_per_mgrp = 0; static int num_routers_per_mgrp = 0;
typedef struct dragonfly_param dragonfly_param; typedef struct dragonfly_param dragonfly_param;
/* annotation-specific parameters (unannotated entry occurs at the /* annotation-specific parameters (unannotated entry occurs at the
* last index) */ * last index) */
static uint64_t num_params = 0; static uint64_t num_params = 0;
static dragonfly_param * all_params = NULL; static dragonfly_param * all_params = NULL;
...@@ -92,7 +92,7 @@ struct terminal_message_list { ...@@ -92,7 +92,7 @@ struct terminal_message_list {
terminal_message_list *prev; terminal_message_list *prev;
}; };
void init_terminal_message_list(terminal_message_list *this, void init_terminal_message_list(terminal_message_list *this,
terminal_message *inmsg) { terminal_message *inmsg) {
this->msg = *inmsg; this->msg = *inmsg;
this->event_data = NULL; this->event_data = NULL;
...@@ -200,13 +200,13 @@ struct terminal_state ...@@ -200,13 +200,13 @@ struct terminal_state
/* collective init time */ /* collective init time */
tw_stime collective_init_time; tw_stime collective_init_time;
/* node ID in the tree */ /* node ID in the tree */
tw_lpid node_id; tw_lpid node_id;
/* messages sent & received in collectives may get interchanged several times so we have to save the /* messages sent & received in collectives may get interchanged several times so we have to save the
origin server information in the node's state */ origin server information in the node's state */
tw_lpid origin_svr; tw_lpid origin_svr;
/* parent node ID of the current node */ /* parent node ID of the current node */
tw_lpid parent_node_id; tw_lpid parent_node_id;
/* array of children to be allocated in terminal_init*/ /* array of children to be allocated in terminal_init*/
...@@ -256,7 +256,7 @@ struct terminal_state ...@@ -256,7 +256,7 @@ struct terminal_state
struct dfly_cn_sample * sample_stat; struct dfly_cn_sample * sample_stat;
int op_arr_size; int op_arr_size;
int max_arr_size; int max_arr_size;
/* for logging forward and reverse events */ /* for logging forward and reverse events */
long fwd_events; long fwd_events;
long rev_events; long rev_events;
...@@ -311,8 +311,8 @@ struct router_state ...@@ -311,8 +311,8 @@ struct router_state
int op_arr_size; int op_arr_size;
int max_arr_size; int max_arr_size;
int* global_channel; int* global_channel;
tw_stime* next_output_available_time; tw_stime* next_output_available_time;
tw_stime* cur_hist_start_time; tw_stime* cur_hist_start_time;
tw_stime* last_buf_full; tw_stime* last_buf_full;
...@@ -327,7 +327,7 @@ struct router_state ...@@ -327,7 +327,7 @@ struct router_state
int *in_send_loop; int *in_send_loop;
int *queued_count; int *queued_count;
struct rc_stack * st; struct rc_stack * st;
int** vc_occupancy; int** vc_occupancy;
int64_t* link_traffic; int64_t* link_traffic;
int64_t * link_traffic_sample; int64_t * link_traffic_sample;
...@@ -337,12 +337,12 @@ struct router_state ...@@ -337,12 +337,12 @@ struct router_state
int* prev_hist_num; int* prev_hist_num;
int* cur_hist_num; int* cur_hist_num;
char output_buf[4096]; char output_buf[4096];
char output_buf2[4096]; char output_buf2[4096];
struct dfly_router_sample * rsamples; struct dfly_router_sample * rsamples;
long fwd_events; long fwd_events;
long rev_events; long rev_events;
}; };
...@@ -367,7 +367,7 @@ static int dragonfly_rank_hash_compare( ...@@ -367,7 +367,7 @@ static int dragonfly_rank_hash_compare(
struct dfly_qhash_entry *tmp = NULL; struct dfly_qhash_entry *tmp = NULL;
tmp = qhash_entry(link, struct dfly_qhash_entry, hash_link); tmp = qhash_entry(link, struct dfly_qhash_entry, hash_link);
if (tmp->key.message_id == message_key->message_id if (tmp->key.message_id == message_key->message_id
&& tmp->key.sender_id == message_key->sender_id) && tmp->key.sender_id == message_key->sender_id)
return 1; return 1;
...@@ -377,12 +377,12 @@ static int dragonfly_rank_hash_compare( ...@@ -377,12 +377,12 @@ static int dragonfly_rank_hash_compare(
static int dragonfly_hash_func(void *k, int table_size) static int dragonfly_hash_func(void *k, int table_size)
{ {
struct dfly_hash_key *tmp = (struct dfly_hash_key *)k; struct dfly_hash_key *tmp = (struct dfly_hash_key *)k;
//uint32_t pc = 0, pb = 0; //uint32_t pc = 0, pb = 0;
//bj_hashlittle2(tmp, sizeof(*tmp), &pc, &pb); //bj_hashlittle2(tmp, sizeof(*tmp), &pc, &pb);
uint64_t key = (~tmp->message_id) + (tmp->message_id << 18); uint64_t key = (~tmp->message_id) + (tmp->message_id << 18);
key = key * 21; key = key * 21;
key = ~key ^ (tmp->sender_id >> 4); key = ~key ^ (tmp->sender_id >> 4);
key = key * tmp->sender_id; key = key * tmp->sender_id;
return (int)(key & (table_size - 1)); return (int)(key & (table_size - 1));
//return (int)(pc % (table_size - 1)); //return (int)(pc % (table_size - 1));
} }
...@@ -410,35 +410,35 @@ static int dragonfly_get_msg_sz(void) ...@@ -410,35 +410,35 @@ static int dragonfly_get_msg_sz(void)
static void free_tmp(void * ptr) static void free_tmp(void * ptr)
{ {
struct dfly_qhash_entry * dfly = ptr; struct dfly_qhash_entry * dfly = ptr;
free(dfly->remote_event_data); free(dfly->remote_event_data);
free(dfly); free(dfly);
} }
static void append_to_terminal_message_list( static void append_to_terminal_message_list(
terminal_message_list ** thisq, terminal_message_list ** thisq,
terminal_message_list ** thistail, terminal_message_list ** thistail,
int index, int index,
terminal_message_list *msg) { terminal_message_list *msg) {
if(thisq[index] == NULL) { if(thisq[index] == NULL) {
thisq[index] = msg; thisq[index] = msg;
} else { } else {
thistail[index]->next = msg; thistail[index]->next = msg;
msg->prev = thistail[index]; msg->prev = thistail[index];
} }
thistail[index] = msg; thistail[index] = msg;
} }
static void prepend_to_terminal_message_list( static void prepend_to_terminal_message_list(
terminal_message_list ** thisq, terminal_message_list ** thisq,
terminal_message_list ** thistail, terminal_message_list ** thistail,
int index, int index,
terminal_message_list *msg) { terminal_message_list *msg) {
if(thisq[index] == NULL) { if(thisq[index] == NULL) {
thistail[index] = msg; thistail[index] = msg;
} else { } else {
thisq[index]->prev = msg; thisq[index]->prev = msg;
msg->next = thisq[index]; msg->next = thisq[index];
} }
thisq[index] = msg; thisq[index] = msg;
} }
...@@ -540,13 +540,13 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){ ...@@ -540,13 +540,13 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){
MAX_NAME_LENGTH); MAX_NAME_LENGTH);
configuration_get_value(&config, "PARAMS", "rt_sample_file", anno, router_sample_file, configuration_get_value(&config, "PARAMS", "rt_sample_file", anno, router_sample_file,
MAX_NAME_LENGTH); MAX_NAME_LENGTH);
char routing_str[MAX_NAME_LENGTH]; char routing_str[MAX_NAME_LENGTH];
configuration_get_value(&config, "PARAMS", "routing", anno, routing_str, configuration_get_value(&config, "PARAMS", "routing", anno, routing_str,
MAX_NAME_LENGTH); MAX_NAME_LENGTH);
if(strcmp(routing_str, "minimal") == 0) if(strcmp(routing_str, "minimal") == 0)
routing = MINIMAL; routing = MINIMAL;
else if(strcmp(routing_str, "nonminimal")==0 || else if(strcmp(routing_str, "nonminimal")==0 ||
strcmp(routing_str,"non-minimal")==0) strcmp(routing_str,"non-minimal")==0)
routing = NON_MINIMAL; routing = NON_MINIMAL;
else if (strcmp(routing_str, "adaptive") == 0) else if (strcmp(routing_str, "adaptive") == 0)
...@@ -555,7 +555,7 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){ ...@@ -555,7 +555,7 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){
routing = PROG_ADAPTIVE; routing = PROG_ADAPTIVE;
else else
{ {
fprintf(stderr, fprintf(stderr,
"No routing protocol specified, setting to minimal routing\n"); "No routing protocol specified, setting to minimal routing\n");
routing = -1; routing = -1;
} }
...@@ -574,7 +574,7 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){ ...@@ -574,7 +574,7 @@ static void dragonfly_read_config(const char * anno, dragonfly_param *params){
p->num_cn * p->total_routers, p->total_routers, p->num_groups, p->num_cn * p->total_routers, p->total_routers, p->num_groups,
p->radix); p->radix);
} }
p->cn_delay = bytes_to_ns(p->chunk_size, p->cn_bandwidth); p->cn_delay = bytes_to_ns(p->chunk_size, p->cn_bandwidth);
p->local_delay = bytes_to_ns(p->chunk_size, p->local_bandwidth); p->local_delay = bytes_to_ns(p->chunk_size, p->local_bandwidth);
p->global_delay = bytes_to_ns(p->chunk_size, p->global_bandwidth); p->global_delay = bytes_to_ns(p->chunk_size, p->global_bandwidth);
...@@ -612,7 +612,7 @@ static void dragonfly_report_stats() ...@@ -612,7 +612,7 @@ static void dragonfly_report_stats()
MPI_Reduce( &total_msg_sz, &final_msg_sz, 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( &dragonfly_total_time, &avg_time, 1,MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD); MPI_Reduce( &dragonfly_total_time, &avg_time, 1,MPI_DOUBLE, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &dragonfly_max_latency, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD); MPI_Reduce( &dragonfly_max_latency, &max_time, 1, MPI_DOUBLE, MPI_MAX, 0, MPI_COMM_WORLD);
MPI_Reduce( &packet_gen, &total_gen, 1, MPI_LONG, MPI_SUM, 0, MPI_COMM_WORLD); MPI_Reduce( &packet_gen, &total_gen, 1, MPI_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
MPI_Reduce( &packet_fin, &total_fin, 1, MPI_LONG, MPI_SUM, 0, MPI_COMM_WORLD); MPI_Reduce( &packet_fin, &total_fin, 1, MPI_LONG, MPI_SUM, 0, MPI_COMM_WORLD);
if(routing == ADAPTIVE || routing == PROG_ADAPTIVE) if(routing == ADAPTIVE || routing == PROG_ADAPTIVE)
...@@ -623,13 +623,13 @@ static void dragonfly_report_stats() ...@@ -623,13 +623,13 @@ static void dragonfly_report_stats()
/* print statistics */ /* print statistics */
if(!g_tw_mynode) 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 finished chunks %lld \n", 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); (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);
if(routing == ADAPTIVE || routing == PROG_ADAPTIVE) if(routing == ADAPTIVE || routing == PROG_ADAPTIVE)
printf("\n ADAPTIVE ROUTING STATS: %d chunks routed minimally %d chunks routed non-minimally completed packets %lld \n", printf("\n ADAPTIVE ROUTING STATS: %d chunks routed minimally %d chunks routed non-minimally completed packets %lld \n",
total_minimal_packets, total_nonmin_packets, total_finished_chunks); total_minimal_packets, total_nonmin_packets, total_finished_chunks);
printf("\n Total packets generated %ld finished %ld \n", total_gen, total_fin); printf("\n Total packets generated %ld finished %ld \n", total_gen, total_fin);
} }
return; return;
...@@ -694,17 +694,17 @@ void dragonfly_collective_init(terminal_state * s, ...@@ -694,17 +694,17 @@ void dragonfly_collective_init(terminal_state * s,
} }
/* initialize a dragonfly compute node terminal */ /* initialize a dragonfly compute node terminal */
void void
terminal_init( terminal_state * s, terminal_init( terminal_state * s,
tw_lp * lp ) tw_lp * lp )
{ {
s->packet_gen = 0; s->packet_gen = 0;
s->packet_fin = 0; s->packet_fin = 0;
uint32_t h1 = 0, h2 = 0; uint32_t h1 = 0, h2 = 0;
bj_hashlittle2(LP_METHOD_NM_TERM, strlen(LP_METHOD_NM_TERM), &h1, &h2); bj_hashlittle2(LP_METHOD_NM_TERM, strlen(LP_METHOD_NM_TERM), &h1, &h2);
terminal_magic_num = h1 + h2; terminal_magic_num = h1 + h2;
int i; int i;
char anno[MAX_NAME_LENGTH]; char anno[MAX_NAME_LENGTH];
...@@ -725,12 +725,12 @@ terminal_init( terminal_state * s, ...@@ -725,12 +725,12 @@ terminal_init( terminal_state * s,
int num_lps = codes_mapping_get_lp_count(lp_group_name, 1, LP_CONFIG_NM_TERM, int num_lps = codes_mapping_get_lp_count(lp_group_name, 1, LP_CONFIG_NM_TERM,
s->anno, 0); s->anno, 0);
s->terminal_id = (mapping_rep_id * num_lps) + mapping_offset; s->terminal_id = (mapping_rep_id * num_lps) + mapping_offset;
s->router_id=(int)s->terminal_id / (s->params->num_routers/2); s->router_id=(int)s->terminal_id / (s->params->num_routers/2);
s->terminal_available_time = 0.0; s->terminal_available_time = 0.0;
s->packet_counter = 0; s->packet_counter = 0;