Commit eeb658fd authored by Misbah Mubarak's avatar Misbah Mubarak

pushing to the right repo--> Fixing dragonfly/MPI Sim layer output format warnings

parent 118ad27b
......@@ -234,12 +234,13 @@ static void update_message_time_rc(
/* conversion from seconds to eanaoseconds */
static tw_stime s_to_ns(tw_stime ns);
/* Debugging functions, may generate unused function warning */
static void print_waiting_reqs(int32_t * reqs, int count)
{
printf("\n Waiting reqs: ");
int i;
for(i = 0; i < count; i++ )
printf(" %ld ", reqs[i]);
printf(" %d ", reqs[i]);
}
static void print_completed_queue(struct qlist_head * head)
{
......@@ -249,7 +250,7 @@ static void print_completed_queue(struct qlist_head * head)
qlist_for_each(ent, head)
{
current = qlist_entry(ent, completed_requests, ql);
printf(" %ld ", current->req_id);
printf(" %d ", current->req_id);
}
}
static int clear_completed_reqs(nw_state * s,
......@@ -321,7 +322,7 @@ static int notify_posted_wait(nw_state* s,
{
wait_elem->num_completed++;
if(wait_elem->num_completed > wait_elem->count)
printf("\n Num completed %ld count %ld LP %llu ",
printf("\n Num completed %d count %d LP %llu ",
wait_elem->num_completed,
wait_elem->count,
lp->gid);
......@@ -897,7 +898,7 @@ static void update_arrival_queue(nw_state* s, tw_bf * bf, nw_message * m, tw_lp
arrived_op->tag = m->fwd.tag;
if(s->nw_id == TRACK_LP)
printf("\n Send op arrived source rank %ld num bytes %d ", arrived_op->source_rank,
printf("\n Send op arrived source rank %d num bytes %d ", arrived_op->source_rank,
arrived_op->num_bytes);
int found_matching_recv = rm_matching_rcv(s, bf, m, lp, arrived_op);
......@@ -1182,10 +1183,10 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
{
int count_irecv = qlist_count(&s->pending_recvs_queue);
int count_isend = qlist_count(&s->arrival_queue);
printf("\n LP %ld 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",
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);
written += sprintf(s->output_buf + written, "\n %lu %lu %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,
s->num_bytes_recvd, s->send_time, s->elapsed_time - s->compute_time, s->compute_time);
lp_io_write(lp->gid, "mpi-replay-stats", written, s->output_buf);
......
......@@ -1237,7 +1237,7 @@ static void get_next_mpi_operation(nw_state* s, tw_bf * bf, nw_message * m, tw_l
s->num_completed++;
if(s->nw_id == TRACK && s->num_completed % 10000 == 0)
printf("\n Status: LP %llu completed %ld MPI operations ",
printf("\n Status: LP %llu completed %lld MPI operations ",
s->nw_id, s->num_completed);
m->saved_op = mpi_op;
......@@ -1329,7 +1329,7 @@ void nw_test_finalize(nw_state* s, tw_lp* lp)
printQueue(lp->gid, s->arrival_queue, "isend");
}
written += sprintf(s->output_buf + written, "\n %lu %lu %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,
s->num_bytes_recvd, s->send_time, s->elapsed_time - s->compute_time, s->compute_time);
lp_io_write(lp->gid, "mpi-replay-stats", written, s->output_buf);
......
......@@ -36,8 +36,8 @@
#define DFLY_HASH_TABLE_SIZE 262144
// debugging parameters
#define TRACK LLU(-1)
#define TRACK_PKT LLU(-1)
#define TRACK -1
#define TRACK_PKT -1
#define TRACK_MSG -1
#define PRINT_ROUTER_TABLE 1
#define DEBUG 0
......@@ -52,7 +52,7 @@ long packet_gen = 0, packet_fin = 0;
static double maxd(double a, double b) { return a < b ? b : a; }
/* minimal and non-minimal packet counts for adaptive routing*/
static unsigned int minimal_count=0, nonmin_count=0;
static int minimal_count=0, nonmin_count=0;
typedef struct dragonfly_param dragonfly_param;
/* annotation-specific parameters (unannotated entry occurs at the
......@@ -108,7 +108,7 @@ struct dragonfly_param
int chunk_size; /* full-sized packets are broken into smaller chunks.*/
// derived parameters
int num_cn;
unsigned int num_groups;
int num_groups;
int radix;
int total_routers;
int total_terminals;
......@@ -349,6 +349,12 @@ static int dragonfly_get_msg_sz(void)
return sizeof(terminal_message);
}
static void free_tmp(void * ptr)
{
struct dfly_qhash_entry * dfly = ptr;
free(dfly->remote_event_data);
free(dfly);
}
static void append_to_terminal_message_list(
terminal_message_list ** thisq,
terminal_message_list ** thistail,
......@@ -377,26 +383,6 @@ static void prepend_to_terminal_message_list(
thisq[index] = msg;
}
#if 0
// calls commented out - remove entirely?
static void create_prepend_to_terminal_message_list(
terminal_message_list ** thisq,
terminal_message_list ** thistail,
int index,
terminal_message * msg) {
terminal_message_list* new_entry = (terminal_message_list*)malloc(
sizeof(terminal_message_list));
init_terminal_message_list(new_entry, msg);
if(msg->remote_event_size_bytes) {
void *m_data = model_net_method_get_edata(DRAGONFLY, 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);
}
#endif
static terminal_message_list* return_head(
terminal_message_list ** thisq,
terminal_message_list ** thistail,
......@@ -538,7 +524,7 @@ static void dragonfly_configure(){
num_params = anno_map->num_annos + (anno_map->has_unanno_lp > 0);
all_params = malloc(num_params * sizeof(*all_params));
for (int i = 0; i < anno_map->num_annos; i++){
for (uint64_t i = 0; i < anno_map->num_annos; i++){
const char * anno = anno_map->annotations[i].ptr;
dragonfly_read_config(anno, &all_params[i]);
}
......@@ -618,11 +604,10 @@ void dragonfly_collective_init(terminal_state * s,
/* calculate the children of the current node. If its a leaf, no need to set children,
only set isleaf and break the loop*/
tw_lpid total_lps = (tw_lpid)num_lps * (tw_lpid)num_reps;
for( i = 0; i < TREE_DEGREE; i++ )
{
tw_lpid next_child = (TREE_DEGREE * s->node_id) + i + 1;
if(next_child < total_lps)
if(next_child < (num_lps * num_reps))
{
s->num_children++;
s->is_leaf = 0;
......@@ -803,14 +788,14 @@ void router_setup(router_state * r, tw_lp * lp)
#endif
//round the number of global channels to the nearest even number
#if USE_DIRECT_SCHEME
unsigned int first = r->router_id % p->num_routers;
int first = r->router_id % p->num_routers;
for(int i=0; i < p->num_global_channels; i++)
{
unsigned int target_grp = first;
int target_grp = first;
if(target_grp == r->group_id) {
target_grp = p->num_groups - 1;
}
unsigned int my_pos = r->group_id % p->num_routers;
int my_pos = r->group_id % p->num_routers;
if(r->group_id == p->num_groups - 1) {
my_pos = target_grp % p->num_routers;
}
......@@ -860,8 +845,6 @@ static tw_stime dragonfly_packet_event(
tw_lp *sender,
int is_last_pckt)
{
(void)message_offset;
(void)sched_params;
tw_event * e_new;
tw_stime xfer_to_nic_time;
terminal_message * msg;
......@@ -954,7 +937,7 @@ tw_lpid getRouterFromGroupID(int dest_gid,
}
/*When a packet is sent from the current router and a buffer slot becomes available, a credit is sent back to schedule another packet event*/
void router_credit_send(router_state * s, terminal_message * msg,
void router_credit_send(router_state * s, tw_bf * bf, terminal_message * msg,
tw_lp * lp, int sq) {
tw_event * buf_e;
tw_stime ts;
......@@ -1069,8 +1052,8 @@ void packet_generate(terminal_state * s, tw_bf * bf, terminal_message * msg,
//if(msg->dest_terminal_id == TRACK)
if(msg->packet_ID == TRACK_PKT)
printf("\n Packet %llu generated at terminal %d dest %llu size %llu num chunks %d ",
msg->packet_ID, s->terminal_id, LLU(msg->dest_terminal_id),
LLU(msg->packet_size), num_chunks);
msg->packet_ID, s->terminal_id, msg->dest_terminal_id,
msg->packet_size, num_chunks);
for(i = 0; i < num_chunks; i++)
{
......@@ -1224,7 +1207,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
m->local_event_size_bytes = 0;
tw_event_send(e);
uint64_t num_chunks = cur_entry->msg.packet_size/s->params->chunk_size;
int num_chunks = cur_entry->msg.packet_size/s->params->chunk_size;
if(cur_entry->msg.packet_size % s->params->chunk_size)
num_chunks++;
......@@ -1254,8 +1237,9 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg,
if(cur_entry != NULL &&
s->vc_occupancy[0] + s->params->chunk_size <= s->params->cn_vc_size) {
bf->c3 = 1;
terminal_message *m;
ts = g_tw_lookahead + s->params->cn_delay + tw_rand_unif(lp->rng);
e = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY,
tw_event* e = model_net_method_event_new(lp->gid, ts, lp, DRAGONFLY,
(void**)&m, NULL);
m->type = T_SEND;
m->magic = terminal_magic_num;
......@@ -1415,7 +1399,7 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
assert(lp->gid == msg->dest_terminal_id);
if(msg->packet_ID == TRACK_PKT)
printf("\n Packet %llu arrived at lp %llu hops %hd", msg->packet_ID, LLU(lp->gid), msg->my_N_hop);
printf("\n Packet %llu arrived at lp %llu hops %d", msg->packet_ID, lp->gid, msg->my_N_hop);
tw_stime ts = g_tw_lookahead + s->params->credit_delay + tw_rand_unif(lp->rng);
......@@ -1441,7 +1425,7 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
/* WE do not allow self messages through dragonfly */
assert(lp->gid != msg->src_terminal_id);
uint64_t num_chunks = msg->packet_size / s->params->chunk_size;
int num_chunks = msg->packet_size / s->params->chunk_size;
if (msg->packet_size % s->params->chunk_size)
num_chunks++;
......@@ -1553,7 +1537,7 @@ void packet_arrive(terminal_state * s, tw_bf * bf, terminal_message * msg,
send_remote_event(s, msg, lp, bf, tmp->remote_event_data, tmp->remote_event_size);
/* Remove the hash entry */
qhash_del(hash_link);
rc_stack_push(lp, tmp, free, s->st);
rc_stack_push(lp, tmp, free_tmp, s->st);
s->rank_tbl_pop--;
}
return;
......@@ -1598,12 +1582,12 @@ void dragonfly_collective(char const * category, int message_size, int remote_ev
/* reverse for collective operation of the dragonfly network */
void dragonfly_collective_rc(int message_size, tw_lp* sender)
{
(void)message_size;
codes_local_latency_reverse(sender);
return;
}
static void send_collective_remote_event(terminal_state * s,
tw_bf * bf,
terminal_message * msg,
tw_lp * lp)
{
......@@ -1614,7 +1598,7 @@ static void send_collective_remote_event(terminal_state * s,
tw_stime ts;
terminal_message * m;
ts = (1/s->params->cn_bandwidth) * msg->remote_event_size_bytes;
e = tw_event_new(s->origin_svr, ts, lp);
e = codes_event_new(s->origin_svr, ts, lp);
m = tw_event_data(e);
char* tmp_ptr = (char*)msg;
tmp_ptr += dragonfly_get_msg_sz();
......@@ -1624,6 +1608,7 @@ static void send_collective_remote_event(terminal_state * s,
}
static void node_collective_init(terminal_state * s,
tw_bf * bf,
terminal_message * msg,
tw_lp * lp)
{
......@@ -1732,7 +1717,7 @@ static void node_collective_fan_in(terminal_state * s,
bf->c2 = 1;
msg->saved_fan_nodes = s->num_fan_nodes-1;
s->num_fan_nodes = 0;
send_collective_remote_event(s, msg, lp);
send_collective_remote_event(s, bf, msg, lp);
for( i = 0; i < s->num_children; i++ )
{
......@@ -1758,7 +1743,7 @@ static void node_collective_fan_in(terminal_state * s,
msg->remote_event_size_bytes);
}
msg_new->type = (enum event_t) D_COLLECTIVE_FAN_OUT;
msg_new->type = D_COLLECTIVE_FAN_OUT;
msg_new->sender_node = s->node_id;
tw_event_send(e_new);
......@@ -1777,7 +1762,7 @@ static void node_collective_fan_out(terminal_state * s,
bf->c1 = 0;
bf->c2 = 0;
send_collective_remote_event(s, msg, lp);
send_collective_remote_event(s, bf, msg, lp);
if(!s->is_leaf)
{
......@@ -1812,7 +1797,7 @@ static void node_collective_fan_out(terminal_state * s,
}
msg_new->type = (nodes_event_t) D_COLLECTIVE_FAN_OUT;
msg_new->type = D_COLLECTIVE_FAN_OUT;
msg_new->sender_node = s->node_id;
tw_event_send(e_new);
}
......@@ -1916,7 +1901,7 @@ terminal_event( terminal_state * s,
break;
case D_COLLECTIVE_INIT:
node_collective_init(s, msg, lp);
node_collective_init(s, bf, msg, lp);
break;
case D_COLLECTIVE_FAN_IN:
......@@ -1941,10 +1926,10 @@ dragonfly_terminal_final( terminal_state * s,
int written = 0;
if(!s->terminal_id)
written = sprintf(s->output_buf, "# Format <LP id> <Terminal ID> <Total Data Size> <Total Time Spent> <# Packets finished> <Avg hops> <Busy Time>");
written = sprintf(s->output_buf, "# Format <LP id> <Terminal ID> <Total Data Size> <Total Time Spent> <# Packets finished> <Avg hops> <Busy Time>\n");
written += sprintf(s->output_buf + written, "%llu %u %ld %lf %ld %lf %lf\n",
LLU(lp->gid), s->terminal_id, s->total_msg_size, s->total_time,
lp->gid, s->terminal_id, s->total_msg_size, s->total_time,
s->finished_packets, (double)s->total_hops/s->finished_chunks,
s->busy_time);
......@@ -1962,7 +1947,7 @@ dragonfly_terminal_final( terminal_state * s,
fclose(dragonfly_log);
*/
if(s->terminal_msgs[0] != NULL)
printf("[%llu] leftover terminal messages \n", LLU(lp->gid));
printf("[%llu] leftover terminal messages \n", lp->gid);
//if(s->packet_gen != s->packet_fin)
......@@ -1984,11 +1969,11 @@ void dragonfly_router_final(router_state * s,
for(i = 0; i < s->params->radix; i++) {
for(j = 0; j < 3; j++) {
if(s->queued_msgs[i][j] != NULL) {
printf("[%llu] leftover queued messages %d %d %d\n", LLU(lp->gid), i, j,
printf("[%llu] leftover queued messages %d %d %d\n", 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);
printf("[%llu] lefover pending messages %d %d\n", lp->gid, i, j);
}
}
}
......@@ -2004,7 +1989,7 @@ void dragonfly_router_final(router_state * s,
p->num_routers, p->num_global_channels);
}
written += sprintf(s->output_buf + written, "\n %llu %d %d ",
LLU(lp->gid),
lp->gid,
s->router_id / p->num_routers,
s->router_id % p->num_routers);
for(int d = 0; d < p->num_routers + p->num_global_channels; d++)
......@@ -2021,12 +2006,12 @@ void dragonfly_router_final(router_state * s,
p->num_routers, p->num_global_channels);
}
written += sprintf(s->output_buf2 + written, "\n %llu %d %d",
LLU(lp->gid),
lp->gid,
s->router_id / p->num_routers,
s->router_id % p->num_routers);
for(int d = 0; d < p->num_routers + p->num_global_channels; d++)
written += sprintf(s->output_buf2 + written, " %lld", LLD(s->link_traffic[d]));
written += sprintf(s->output_buf2 + written, " %lld", s->link_traffic[d]);
sprintf(s->output_buf2 + written, "\n");
lp_io_write(lp->gid, "dragonfly-router-traffic", written, s->output_buf2);
......@@ -2036,7 +2021,8 @@ void dragonfly_router_final(router_state * s,
int get_num_hops(int local_router_id,
int dest_router_id,
int num_routers,
int total_groups)
int non_min,
int total_groups)
{
int local_grp_id = local_router_id / num_routers;
int dest_group_id = dest_router_id / num_routers;
......@@ -2056,13 +2042,13 @@ int get_num_hops(int local_router_id,
tw_lpid src_connecting_router = getRouterFromGroupID(dest_group_id,
local_grp_id, num_routers, total_groups);
if(src_connecting_router == (tw_lpid)local_router_id)
if(src_connecting_router == local_router_id)
num_hops--;
tw_lpid dest_connecting_router = getRouterFromGroupID(local_grp_id,
dest_group_id, num_routers, total_groups);
if(dest_connecting_router == (tw_lpid)dest_router_id)
if(dest_connecting_router == dest_router_id)
num_hops--;
return num_hops;
......@@ -2073,17 +2059,19 @@ int get_num_hops(int local_router_id,
* or the destination terminal */
tw_lpid
get_next_stop(router_state * s,
tw_bf * bf,
terminal_message * msg,
tw_lp * lp,
int path,
int dest_router_id,
int intm_id)
{
int dest_lp;
tw_lpid router_dest_id;
unsigned int dest_group_id;
int dest_group_id;
int local_router_id = s->router_id;
unsigned int origin_grp_id = msg->origin_router_id / s->params->num_routers;
int origin_grp_id = msg->origin_router_id / s->params->num_routers;
dest_group_id = dest_router_id / s->params->num_routers;
......@@ -2144,8 +2132,10 @@ get_next_stop(router_state * s,
/* gets the output port corresponding to the next stop of the message */
int
get_output_port( router_state * s,
tw_bf * bf,
terminal_message * msg,
tw_lpid next_stop )
tw_lp * lp,
int next_stop )
{
int output_port = -1, terminal_id;
codes_mapping_get_lp_info(msg->dest_terminal_id, lp_group_name,
......@@ -2163,13 +2153,13 @@ get_output_port( router_state * s,
{
codes_mapping_get_lp_info(next_stop, lp_group_name, &mapping_grp_id,
NULL, &mapping_type_id, NULL, &mapping_rep_id, &mapping_offset);
unsigned int local_router_id = mapping_rep_id + mapping_offset;
unsigned int intm_grp_id = local_router_id / s->params->num_routers;
int local_router_id = mapping_rep_id + mapping_offset;
int intm_grp_id = local_router_id / s->params->num_routers;
if(intm_grp_id != s->group_id)
{
#if USE_DIRECT_SCHEME
unsigned int target_grp = intm_grp_id;
int target_grp = intm_grp_id;
if(target_grp == s->params->num_groups - 1) {
target_grp = s->group_id;
}
......@@ -2194,20 +2184,20 @@ get_output_port( router_state * s,
/* UGAL (first condition is from booksim), output port equality check comes from Dally dragonfly'09*/
static int do_adaptive_routing( router_state * s,
tw_bf * bf,
terminal_message * msg,
tw_lp * lp,
int dest_router_id,
int intm_id) {
int next_stop;
int minimal_out_port = -1, nonmin_out_port = -1;
// decide which routing to take
// get the queue occupancy of both the minimal and non-minimal output ports
tw_lpid minimal_next_stop=get_next_stop(s, msg, MINIMAL, dest_router_id, -1);
minimal_out_port = get_output_port(s, msg, minimal_next_stop);
tw_lpid nonmin_next_stop = get_next_stop(s, msg, NON_MINIMAL, dest_router_id, intm_id);
nonmin_out_port = get_output_port(s, msg, nonmin_next_stop);
int minimal_next_stop=get_next_stop(s, bf, msg, lp, MINIMAL, dest_router_id, -1);
minimal_out_port = get_output_port(s, bf, msg, lp, minimal_next_stop);
int nonmin_next_stop = get_next_stop(s, bf, msg, lp, NON_MINIMAL, dest_router_id, intm_id);
nonmin_out_port = get_output_port(s, bf, msg, lp, nonmin_next_stop);
#if 0
NOTE: VCs are set but not used... disabling for now
int nomin_vc = 0;
if(nonmin_out_port < s->params->num_routers) {
nomin_vc = msg->my_l_hop;
......@@ -2222,7 +2212,6 @@ static int do_adaptive_routing( router_state * s,
s->params->num_global_channels)) {
min_vc = msg->my_g_hop;
}
#endif
int min_port_count = s->vc_occupancy[minimal_out_port][0] +
s->vc_occupancy[minimal_out_port][1] + s->vc_occupancy[minimal_out_port][2]
+ s->queued_count[minimal_out_port];
......@@ -2240,8 +2229,8 @@ static int do_adaptive_routing( router_state * s,
if(msg->intm_group_id >= 0)
{
num_nonmin_hops = get_num_hops(s->router_id, intm_router_id,
s->params->num_routers, s->params->num_groups) +
get_num_hops(intm_router_id, dest_router_id, s->params->num_routers,
s->params->num_routers, 1, s->params->num_groups) +
get_num_hops(intm_router_id, dest_router_id, s->params->num_routers, 1,
s->params->num_groups);
}
assert(num_nonmin_hops <= 6);
......@@ -2257,16 +2246,16 @@ static int do_adaptive_routing( router_state * s,
}
q_avg = q_avg / (s->params->radix - 1);
// int min_out_chan = minimal_out_port;
// int nonmin_out_chan = nonmin_out_port;
//int min_out_chan = minimal_out_port;
//int nonmin_out_chan = nonmin_out_port;
/* Adding history window approach, not taking the queue status at every
* simulation time thats why, we are maintaining the current history
* window number and an average of the previous history window number. */
//int min_hist_count = s->cur_hist_num[min_out_chan] +
//(s->prev_hist_num[min_out_chan]/2);
// (s->prev_hist_num[min_out_chan]/2);
//int nonmin_hist_count = s->cur_hist_num[nonmin_out_chan] +
//(s->prev_hist_num[min_out_chan]/2);
// (s->prev_hist_num[min_out_chan]/2);
int nonmin_port_count = s->vc_occupancy[nonmin_out_port][0] +
s->vc_occupancy[nonmin_out_port][1] + s->vc_occupancy[nonmin_out_port][2]
......@@ -2342,9 +2331,9 @@ router_packet_receive( router_state * s,
s->anno, 0);
int dest_router_id = (mapping_offset + (mapping_rep_id * num_lps)) /
s->params->num_cn;
unsigned int local_grp_id = s->router_id / s->params->num_routers;
int local_grp_id = s->router_id / s->params->num_routers;
unsigned int intm_id = tw_rand_integer(lp->rng, 0, s->params->num_groups - 1);
int intm_id = tw_rand_integer(lp->rng, 0, s->params->num_groups - 1);
if(intm_id == s->group_id)
intm_id = (s->group_id + 2) % s->params->num_groups;
/* progressive adaptive routing makes a check at every node/router at the
......@@ -2356,15 +2345,15 @@ router_packet_receive( router_state * s,
if(routing == PROG_ADAPTIVE
&& msg->path_type != NON_MINIMAL
&& local_grp_id == ( msg->origin_router_id / s->params->num_routers)) {
next_stop = do_adaptive_routing(s, &(cur_chunk->msg), dest_router_id, intm_id);
next_stop = do_adaptive_routing(s, bf, &(cur_chunk->msg), lp, dest_router_id, intm_id);
} else if(msg->last_hop == TERMINAL && routing == ADAPTIVE) {
next_stop = do_adaptive_routing(s, &(cur_chunk->msg), dest_router_id, intm_id);
next_stop = do_adaptive_routing(s, bf, &(cur_chunk->msg), lp, dest_router_id, intm_id);
} else {
if(routing == MINIMAL || routing == NON_MINIMAL)
cur_chunk->msg.path_type = routing; /*defaults to the routing algorithm if we
don't have adaptive routing here*/
assert(cur_chunk->msg.path_type == MINIMAL || cur_chunk->msg.path_type == NON_MINIMAL);
next_stop = get_next_stop(s, &(cur_chunk->msg), cur_chunk->msg.path_type, dest_router_id, intm_id);
next_stop = get_next_stop(s, bf, &(cur_chunk->msg), lp, cur_chunk->msg.path_type, dest_router_id, intm_id);
}
if(msg->remote_event_size_bytes > 0) {
......@@ -2372,7 +2361,7 @@ router_packet_receive( router_state * s,
cur_chunk->event_data = (char*)malloc(msg->remote_event_size_bytes);
memcpy(cur_chunk->event_data, m_data_src, msg->remote_event_size_bytes);
}
output_port = get_output_port(s, &(cur_chunk->msg), next_stop);
output_port = get_output_port(s, bf, &(cur_chunk->msg), lp, next_stop);
assert(output_port >= 0);
output_chan = 0;
int max_vc_size = s->params->cn_vc_size;
......@@ -2381,7 +2370,7 @@ router_packet_receive( router_state * s,
cur_chunk->msg.next_stop = next_stop;
if(msg->packet_ID == TRACK_PKT)
printf("\n Router packet %llu arrived lp id %llu final dest %llu output port %d ", msg->packet_ID, LLU(lp->gid), LLU(msg->dest_terminal_id), output_port);
printf("\n Router packet %llu arrived lp id %llu final dest %llu output port %d ", msg->packet_ID, lp->gid, msg->dest_terminal_id, output_port);
if(output_port < s->params->num_routers) {
output_chan = msg->my_l_hop;
......@@ -2405,7 +2394,7 @@ router_packet_receive( router_state * s,
if(s->vc_occupancy[output_port][output_chan] + s->params->chunk_size
<= max_vc_size) {
bf->c2 = 1;
router_credit_send(s, msg, lp, -1);
router_credit_send(s, bf, msg, lp, -1);
append_to_terminal_message_list( s->pending_msgs[output_port],
s->pending_msgs_tail[output_port], output_chan, cur_chunk);
s->vc_occupancy[output_port][output_chan] += s->params->chunk_size;
......@@ -2530,7 +2519,7 @@ router_packet_send( router_state * s,
delay = s->params->global_delay;
}
uint64_t num_chunks = cur_entry->msg.packet_size / s->params->chunk_size;
int num_chunks = cur_entry->msg.packet_size / s->params->chunk_size;
if(msg->packet_size % s->params->chunk_size)
num_chunks++;
if(!num_chunks)
......@@ -2623,8 +2612,9 @@ router_packet_send( router_state * s,
if(cur_entry == NULL) cur_entry = s->pending_msgs[output_port][0];
if(cur_entry != NULL) {
bf->c3 = 1;
terminal_message *m;
ts = g_tw_lookahead + delay + tw_rand_unif(lp->rng);
e = tw_event_new(lp->gid, ts, lp);
tw_event *e = tw_event_new(lp->gid, ts, lp);
m = tw_event_data(e);
m->type = R_SEND;
m->magic = router_magic_num;
......@@ -2683,7 +2673,7 @@ void router_buf_update(router_state * s, tw_bf * bf, terminal_message * msg, tw_
bf->c1 = 1;
terminal_message_list *head = return_head(s->queued_msgs[indx],
s->queued_msgs_tail[indx], output_chan);
router_credit_send(s, &head->msg, lp, 1);
router_credit_send(s, bf, &head->msg, lp, 1);
append_to_terminal_message_list(s->pending_msgs[indx],
s->pending_msgs_tail[indx], output_chan, head);
s->vc_occupancy[indx][output_chan] += s->params->chunk_size;
......@@ -2825,7 +2815,7 @@ tw_lptype dragonfly_lps[] =
(map_f) codes_mapping,
sizeof(router_state),
},
{NULL, NULL, NULL, NULL, NULL, NULL, 0},
{0},
};
/* returns the dragonfly lp type for lp registration */
......@@ -2852,10 +2842,6 @@ struct model_net_method dragonfly_method =
.mn_get_msg_sz = dragonfly_get_msg_sz,
.mn_report_stats = dragonfly_report_stats,
.mn_collective_call = dragonfly_collective,
.mn_collective_call_rc = dragonfly_collective_rc,
.mn_sample_fn = NULL,
.mn_sample_rc_fn = NULL,
.mn_sample_init_fn = NULL,
.mn_sample_fini_fn = NULL
.mn_collective_call_rc = dragonfly_collective_rc
};
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