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;
......@@ -186,9 +186,9 @@ struct terminal_state
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
// 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;
......@@ -208,6 +208,9 @@ struct terminal_state
long finished_chunks;
long finished_packets;
tw_stime last_buf_full;
tw_stime busy_time;
char output_buf[512];
};
......@@ -263,6 +266,14 @@ struct router_state
slim_terminal_message_list ***queued_msgs;
slim_terminal_message_list ***queued_msgs_tail;
int *in_send_loop;
struct rc_stack * st;
tw_stime* last_buf_full;
tw_stime* busy_time;
tw_stime* busy_time_sample;
char output_buf[4096];
char output_buf2[4096];
int** vc_occupancy;
int* link_traffic; //Aren't used
......@@ -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);
......@@ -306,7 +317,7 @@ static int slimfly_hash_func(void *k, int table_size)
key = key * 21;
key = ~key ^ (tmp->sender_id >> 4);
key = key * tmp->sender_id;
return (int)(key % table_size);
return (int)(key & (table_size - 1));
}
/* convert GiB/s and bytes to ns */
......@@ -330,12 +341,14 @@ static int slimfly_get_msg_sz(void)
return sizeof(slim_terminal_message);
}
/*static void free_tmp(void * ptr)
static void free_tmp(void * ptr)
{
struct sfly_qhash_entry * sfly = ptr;
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;
......@@ -831,6 +784,9 @@ void slim_terminal_init( terminal_state * s,
s->total_time = 0.0;
s->total_msg_size = 0;
s->last_buf_full = 0;
s->busy_time = 0;
rc_stack_create(&s->st);
s->num_vcs = 1;
s->vc_occupancy = (int*)malloc(s->num_vcs * sizeof(int));
......@@ -840,9 +796,10 @@ void slim_terminal_init( terminal_state * s,
s->vc_occupancy[i]=0;
}
s->rank_tbl = NULL;
// if(!s->rank_tbl)
// tw_error(TW_LOC, "\n Hash table not initialized! ");
s->rank_tbl = qhash_init(slimfly_rank_hash_compare, slimfly_hash_func, DFLY_HASH_TABLE_SIZE);
if(!s->rank_tbl)
tw_error(TW_LOC, "\n Hash table not initialized! ");
s->terminal_msgs =
(slim_terminal_message_list**)malloc(1*sizeof(slim_terminal_message_list*));
......@@ -903,6 +860,11 @@ void slim_router_setup(router_state * r, tw_lp * lp)
r->queued_msgs_tail =
(slim_terminal_message_list***)malloc(p->radix * sizeof(slim_terminal_message_list**));
r->last_buf_full = (tw_stime*)malloc(p->radix * sizeof(tw_stime));
r->busy_time = (tw_stime*)malloc(p->radix * sizeof(tw_stime));
rc_stack_create(&r->st);
for(int i=0; i < p->radix; i++)
{
// Set credit & router occupancy
......@@ -911,6 +873,9 @@ void slim_router_setup(router_state * r, tw_lp * lp)
r->cur_hist_num[i] = 0;
r->prev_hist_num[i] = 0;
r->last_buf_full[i] = 0.0;
r->busy_time[i] = 0.0;
r->in_send_loop[i] = 0;
r->vc_occupancy[i] = (int*)malloc(p->num_vcs * sizeof(int));
r->pending_msgs[i] = (slim_terminal_message_list**)malloc(p->num_vcs *
......@@ -1160,48 +1125,9 @@ static void slimfly_packet_event_rc(tw_lp *sender)
return;
}
/* given two group IDs, find the router of the src_gid that connects to the dest_gid*/
tw_lpid slim_getRouterFromGroupID(int dest_gid,
int src_gid,
int num_routers,
int total_groups)
{
#if USE_DIRECT_SCHEME
int dest = dest_gid;
if(dest == total_groups - 1) {
dest = src_gid;
}
return src_gid * num_routers + (dest % num_routers);
#else
int group_begin = src_gid * num_routers;
int group_end = (src_gid * num_routers) + num_routers-1;
int offset = (dest_gid * num_routers - group_begin) / num_routers;
if((dest_gid * num_routers) < group_begin)
offset = (group_begin - dest_gid * num_routers) / num_routers; // take absolute value
int half_channel = num_routers / 4;
int index = (offset - 1)/(half_channel * num_routers);
offset=(offset - 1) % (half_channel * num_routers);
// If the destination router is in the same group
tw_lpid router_id;
if(index % 2 != 0)
router_id = group_end - (offset / half_channel); // start from the end
else
router_id = group_begin + (offset / half_channel);
return router_id;
#endif
}
/*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 slim_router_credit_send(router_state * s, tw_bf * bf, slim_terminal_message * msg, tw_lp * lp, int sq)
void slim_router_credit_send(router_state * s, slim_terminal_message * msg, tw_lp * lp, int sq)
{
(void)bf;
tw_event * buf_e;
tw_stime ts;
slim_terminal_message * buf_msg;
......@@ -1282,6 +1208,7 @@ void slim_packet_generate_rc(terminal_state * s, tw_bf * bf, slim_terminal_messa
if(bf->c11)
{
s->issueIdle = 0;
s->last_buf_full = msg->saved_busy_time;
}
struct mn_stats* stat;
stat = model_net_find_stats(msg->category, s->slimfly_stats_array);
......@@ -1298,15 +1225,15 @@ void slim_packet_generate(terminal_state * s, tw_bf * bf, slim_terminal_message
assert(lp->gid != msg->dest_terminal_id);
const slimfly_param *p = s->params;
int i, total_event_size;
int num_chunks = msg->packet_size / p->chunk_size;
int total_event_size;
uint64_t num_chunks = msg->packet_size / p->chunk_size;
if (msg->packet_size % s->params->chunk_size)
num_chunks++;
if(!num_chunks)
num_chunks = 1;
nic_ts = g_tw_lookahead + s->params->cn_delay * msg->packet_size + tw_rand_unif(lp->rng);
nic_ts = g_tw_lookahead + (s->params->cn_delay * num_chunks) + tw_rand_unif(lp->rng);
msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter;
msg->my_N_hop = 0;
......@@ -1318,7 +1245,7 @@ void slim_packet_generate(terminal_state * s, tw_bf * bf, slim_terminal_message
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);
for(i = 0; i < num_chunks; i++)
for(uint64_t i = 0; i < num_chunks; i++)
{
slim_terminal_message_list *cur_chunk = (slim_terminal_message_list*)malloc(
sizeof(slim_terminal_message_list));
......@@ -1356,6 +1283,8 @@ void slim_packet_generate(terminal_state * s, tw_bf * bf, slim_terminal_message
{
bf->c11 = 1;
s->issueIdle = 1;
msg->saved_busy_time = s->last_buf_full;
s->last_buf_full = tw_now(lp);
}
if(s->in_send_loop == 0)
......@@ -1388,6 +1317,7 @@ void slim_packet_send_rc(terminal_state * s, tw_bf * bf, slim_terminal_message *
{
if(bf->c1) {
s->in_send_loop = 1;
s->last_buf_full = msg->saved_busy_time;
return;
}
......@@ -1401,8 +1331,10 @@ void slim_packet_send_rc(terminal_state * s, tw_bf * bf, slim_terminal_message *
s->packet_counter--;
s->vc_occupancy[0] -= s->params->chunk_size;
create_prepend_to_terminal_message_list(s->terminal_msgs,
s->terminal_msgs_tail, 0, msg);
slim_terminal_message_list* cur_entry = rc_stack_pop(s->st);
prepend_to_terminal_message_list(s->terminal_msgs,
s->terminal_msgs_tail, 0, cur_entry);
if(bf->c3) {
tw_rand_reverse_unif(lp->rng);
}
......@@ -1411,8 +1343,13 @@ void slim_packet_send_rc(terminal_state * s, tw_bf * bf, slim_terminal_message *
}
if(bf->c5)
{
codes_local_latency_reverse(lp);
tw_rand_reverse_unif(lp->rng);
s->issueIdle = 1;
if(bf->c6)
{
s->busy_time = msg->saved_total_time;
s->last_buf_full = msg->saved_busy_time;
}
}
return;
}
......@@ -1433,14 +1370,28 @@ void slim_packet_send(terminal_state * s, tw_bf * bf, slim_terminal_message * ms
{
bf->c1 = 1;
s->in_send_loop = 0;
msg->saved_busy_time = s->last_buf_full;
s->last_buf_full = tw_now(lp);
return;
}
uint64_t num_chunks = cur_entry->msg.packet_size/s->params->chunk_size;
if(cur_entry->msg.packet_size % s->params->chunk_size)
num_chunks++;
if(!num_chunks)
num_chunks = 1;
tw_stime delay = s->params->cn_delay;
if((cur_entry->msg.packet_size % s->params->chunk_size) && (cur_entry->msg.chunk_id == num_chunks - 1))
delay = bytes_to_ns(cur_entry->msg.packet_size % s->params->chunk_size, s->params->cn_bandwidth);
msg->saved_available_time = s->terminal_available_time;
ts = g_tw_lookahead + s->params->cn_delay + tw_rand_unif(lp->rng);
ts = g_tw_lookahead + delay + tw_rand_unif(lp->rng);
s->terminal_available_time = maxd(s->terminal_available_time, tw_now(lp));
s->terminal_available_time += ts;
ts = s->terminal_available_time - tw_now(lp);
//TODO: be annotation-aware
codes_mapping_get_lp_info(lp->gid, lp_group_name, &mapping_grp_id, NULL,
&mapping_type_id, NULL, &mapping_rep_id, &mapping_offset);
......@@ -1486,18 +1437,11 @@ void slim_packet_send(terminal_state * s, tw_bf * bf, slim_terminal_message * ms
terminal_sends[s->terminal_id][index]++;
#endif
int num_chunks = cur_entry->msg.packet_size/s->params->chunk_size;
if(cur_entry->msg.packet_size % s->params->chunk_size)
num_chunks++;
if(!num_chunks)
num_chunks = 1;
if(cur_entry->msg.chunk_id == num_chunks - 1 && (cur_entry->msg.local_event_size_bytes > 0))
{
bf->c2 = 1;
ts = codes_local_latency(lp);
tw_event *e_new = tw_event_new(cur_entry->msg.sender_lp, ts, lp);
tw_stime local_ts = codes_local_latency(lp);
tw_event *e_new = tw_event_new(cur_entry->msg.sender_lp, local_ts, lp);
slim_terminal_message* m_new = tw_event_data(e_new);
void *local_event = (char*)cur_entry->event_data +
cur_entry->msg.remote_event_size_bytes;
......@@ -1510,8 +1454,7 @@ void slim_packet_send(terminal_state * s, tw_bf * bf, slim_terminal_message * ms
vc_occupancy_storage_terminal[s->terminal_id][0][index] = s->vc_occupancy[0]/s->params->chunk_size;
#endif
cur_entry = return_head(s->terminal_msgs, s->terminal_msgs_tail, 0);
copy_terminal_list_entry(cur_entry, msg);
slim_delete_terminal_message_list(cur_entry);
rc_stack_push(lp, cur_entry, slim_delete_terminal_message_list, s->st);
s->terminal_length -= s->params->chunk_size;
cur_entry = s->terminal_msgs[0];
......@@ -1520,7 +1463,7 @@ void slim_packet_send(terminal_state * s, tw_bf * bf, slim_terminal_message * ms
{
bf->c3 = 1;
slim_terminal_message *m_new;
ts = g_tw_lookahead + s->params->cn_delay + tw_rand_unif(lp->rng);
ts += tw_rand_unif(lp->rng);
tw_event* e_new = model_net_method_event_new(lp->gid, ts, lp, SLIMFLY,
(void**)&m_new, NULL);
m_new->type = T_SEND;
......@@ -1536,7 +1479,18 @@ void slim_packet_send(terminal_state * s, tw_bf * bf, slim_terminal_message * ms
{
bf->c5 = 1;
s->issueIdle = 0;
model_net_method_idle_event(codes_local_latency(lp), 0, lp);
ts += tw_rand_unif(lp->rng);
model_net_method_idle_event(ts, 0, lp);
if(s->last_buf_full > 0.0)
{
bf->c6 = 1;
msg->saved_total_time = s->busy_time;
msg->saved_busy_time = s->last_buf_full;
s->busy_time += (tw_now(lp) - s->last_buf_full);
s->last_buf_full = 0.0;
}
}
return;
}
......@@ -1557,29 +1511,6 @@ void slim_packet_arrive_rc(terminal_state * s, tw_bf * bf, slim_terminal_message
slimfly_total_time -= (tw_now(lp) - msg->travel_start_time);
s->total_time = msg->saved_avg_time;
/*if(msg->chunk_id == num_chunks - 1)
{
mn_stats* stat;
stat = model_net_find_stats(msg->category, s->slimfly_stats_array);
stat->recv_count--;
stat->recv_bytes -= msg->packet_size;
stat->recv_time -= tw_now(lp) - msg->travel_start_time;
N_finished_packets--;
slimfly_total_time -= (tw_now(lp) - msg->travel_start_time);
if(bf->c3)
slimfly_max_latency = msg->saved_available_time;
}
if (msg->chunk_id == num_chunks-1 &&
msg->remote_event_size_bytes &&
msg->is_pull)
{
int net_id = model_net_get_id(LP_METHOD_NM);
model_net_event_rc(net_id, lp, msg->pull_size);
}*/
struct qhash_head * hash_link = NULL;
struct sfly_qhash_entry * tmp = NULL;
......@@ -1606,21 +1537,20 @@ void slim_packet_arrive_rc(terminal_state * s, tw_bf * bf, slim_terminal_message
if(bf->c7)
{
if(bf->c8)
tw_rand_reverse_unif(lp->rng);
s->finished_msgs--;
total_msg_sz -= msg->total_size;
N_finished_msgs--;
s->total_msg_size -= msg->total_size;
// struct sfly_qhash_entry * d_entry_pop = (struct sfly_qhash_entry*)rc_stack_pop(s->st);
struct sfly_qhash_entry * d_entry_pop = msg->saved_hash;
struct sfly_qhash_entry * d_entry_pop = rc_stack_pop(s->st);
qhash_add(s->rank_tbl, &key, &(d_entry_pop->hash_link));
s->rank_tbl_pop++;
if(s->rank_tbl_pop >= SFLY_HASH_TABLE_SIZE)
tw_error(TW_LOC, "\n Exceeded allocated qhash size, increase hash size in slim fly model");
hash_link = qhash_search(s->rank_tbl, &key);
tmp = qhash_entry(hash_link, struct sfly_qhash_entry, hash_link);
hash_link = &(d_entry_pop->hash_link);
tmp = d_entry_pop;
if(bf->c4)
......@@ -1634,8 +1564,9 @@ void slim_packet_arrive_rc(terminal_state * s, tw_bf * bf, slim_terminal_message
}
void slim_send_remote_event(terminal_state * s, slim_terminal_message * msg, tw_lp * lp, tw_bf * bf, char * event_data, int remote_event_size)
{
(void)s;
void * tmp_ptr = model_net_method_get_edata(SLIMFLY, msg);
tw_stime ts = g_tw_lookahead + bytes_to_ns(msg->remote_event_size_bytes, (1/s->params->cn_bandwidth));
tw_stime ts = g_tw_lookahead + tw_rand_unif(lp->rng);
if (msg->is_pull){
bf->c4 = 1;
......@@ -1666,13 +1597,27 @@ void slim_packet_arrive(terminal_state * s, tw_bf * bf, slim_terminal_message *
// NIC aggregation - should this be a separate function?
// Trigger an event on receiving server
struct sfly_hash_key key;
key.message_id = msg->message_id;
key.sender_id = msg->sender_lp;
if(!s->rank_tbl)
s->rank_tbl = qhash_init(slimfly_rank_hash_compare, slimfly_hash_func, SFLY_HASH_TABLE_SIZE);
tw_stime ts = g_tw_lookahead + s->params->credit_delay + tw_rand_unif(lp->rng);
struct qhash_head *hash_link = NULL;
struct sfly_qhash_entry * tmp = NULL;
if(msg->packet_ID == TRACK)
printf("\n terminal sending credit at chan %d \n", msg->saved_vc);
hash_link = qhash_search(s->rank_tbl, &key);
if(hash_link)
tmp = qhash_entry(hash_link, struct sfly_qhash_entry, hash_link);
uint64_t total_chunks = msg->total_size / s->params->chunk_size;
if(msg->total_size % s->params->chunk_size)
total_chunks++;
if(!total_chunks)
total_chunks = 1;
tw_stime ts = g_tw_lookahead + s->params->credit_delay + tw_rand_unif(lp->rng);
// no method_event here - message going to router
tw_event * buf_e;
......@@ -1696,15 +1641,7 @@ void slim_packet_arrive(terminal_state * s, tw_bf * bf, slim_terminal_message *
/* WE do not allow self messages through slimfly */
assert(lp->gid != msg->src_terminal_id);
int num_chunks = msg->packet_size / s->params->chunk_size;
uint64_t total_chunks = msg->total_size / s->params->chunk_size;
if(msg->total_size % s->params->chunk_size)
total_chunks++;
if(!total_chunks)
total_chunks = 1;
uint64_t num_chunks = msg->packet_size / s->params->chunk_size;