Commit 1247e65a authored by Noah Wolfe's avatar Noah Wolfe Committed by Nikhil

More Fixes. Segfault at very end of simulation

- Cleaned up handle_kickoff_event()
- UR traffic no longer generates messages with destination to self
- Added num_chunks config param (fixes segfault in hash chunk tracking)
parent 040378d3
......@@ -11,8 +11,9 @@ LPGROUPS
PARAMS
{
ft_type="1";
packet_size="32";
packet_size="512";
message_size="512";
chunk_size="32";
modelnet_scheduler="fcfs";
#modelnet_scheduler="round-robin";
modelnet_order=( "fattree" );
......
......@@ -180,8 +180,6 @@ static void handle_kickoff_event(
memcpy(m_remote, m_local, sizeof(svr_msg));
m_remote->svr_event_type = REMOTE;
// assert(net_id == FATTREE); /* only supported for fat tree model right now. */
ns->start_ts = tw_now(lp);
codes_mapping_get_lp_info(lp->gid, group_name, &group_index, lp_type_name, &lp_type_index, anno, &rep_id, &offset);
......@@ -189,30 +187,34 @@ static void handle_kickoff_event(
if(traffic == UNIFORM)
{
local_dest = tw_rand_integer(lp->rng, 0, num_nodes - 1);
// printf("\n LP %ld sending to %d ", lp->gid, local_dest);
}
/* else if(traffic == NEAREST_GROUP)
{
local_dest = (rep_id * 2 + offset + num_nodes_per_grp) % num_nodes;
// printf("\n LP %ld sending to %ld num nodes %d ", rep_id * 2 + offset, local_dest, num_nodes);
}
else if(traffic == NEAREST_NEIGHBOR)
assert(local_dest < num_nodes);
global_dest = codes_mapping_get_lpid_from_relative(local_dest, group_name, lp_type_name, NULL, 0);
// If Destination is self, then generate new destination
if((int)global_dest == (int)lp->gid)
{
local_dest = (rep_id * 2 + offset + 2) % num_nodes;
// printf("\n LP %ld sending to %ld num nodes %d ", rep_id * 2 + offset, local_dest, num_nodes);
local_dest = (local_dest+1) % (num_nodes-1);
global_dest = codes_mapping_get_lpid_from_relative(local_dest, group_name, lp_type_name, NULL, 0);
}
*/
assert(local_dest < num_nodes);
// codes_mapping_get_lp_id(group_name, lp_type_name, anno, 1, local_dest / num_servers_per_rep, local_dest % num_servers_per_rep, &global_dest);
global_dest = codes_mapping_get_lpid_from_relative(local_dest, group_name, lp_type_name, NULL, 0);
//printf("localGID:%d global_dest:%d local_dest:%d\n",(int)lp->gid,(int)global_dest,(int)local_dest);
//printf("global_src,%d, local_src, %d, global_dest,%d, local_dest,%d,\n",(int)lp->gid,floor((int)lp->gid/11)*4 + (int)lp->gid % 11, (int)global_dest,(int)local_dest);
int div1 = floor((int)lp->gid/11);
int mult1 = div1 * 4;
int mod1 = (int)lp->gid % 11;
int sum1 = mult1 + mod1;
// if((int)lp->gid == 3)
if((int)global_dest == (int)lp->gid)
printf("global_src:%d, local_src:%d, global_dest:%d, local_dest:%d\n",(int)lp->gid, sum1, (int)global_dest,(int)local_dest);
ns->msg_sent_count++;
model_net_event(net_id, "test", global_dest, PAYLOAD_SZ, 0.0, sizeof(svr_msg), (const void*)m_remote, sizeof(svr_msg), (const void*)m_local, lp);
//printf("LP:%d localID:%d Here\n",(int)lp->gid, (int)local_dest);
//printf("LP:%d localID:%d Here\n",(int)lp->gid, (int)local_dest);
issue_event(ns, lp);
//printf("Just Checking net_id:%d\n",net_id);
//printf("Just Checking net_id:%d\n",net_id);
return;
}
......@@ -306,6 +308,7 @@ static void svr_event(
switch (m->svr_event_type)
{
case REMOTE:
printf("\n LP: %d has received remote message from src lpID: %d\n",(int)lp->gid, (int)m->src);
handle_remote_event(ns, b, m, lp);
break;
case LOCAL:
......
......@@ -16,7 +16,7 @@
#define FTREE_HASH_TABLE_SIZE 262144
// debugging parameters
#define TRACK_PKT 5
#define TRACK_PKT 2820
#define FATTREE_HELLO 0
#define FATTREE_DEBUG 0
#define FATTREE_CONNECTIONS 0
......@@ -25,6 +25,21 @@
#define LP_CONFIG_NM (model_net_lp_config_names[FATTREE])
#define LP_METHOD_NM (model_net_method_names[FATTREE])
//Delete the following enum and struct after getting fattree up and running
enum svr_tmp_event
{
KICKOFF, /* kickoff event */
REMOTE, /* remote event */
LOCAL /* local event */
};
typedef struct tmp_svr tmp_svr;
struct tmp_svr
{
enum svr_tmp_event svr_event_type;
tw_lpid src; /* source of this request or ack */
int incremented_flag; /* helper for reverse computation */
};
long fattree_packet_gen = 0, fattree_packet_fin = 0;
static double maxd(double a, double b) { return a < b ? b : a; }
......@@ -519,6 +534,12 @@ static void fattree_read_config(char * anno, fattree_param *p){
"setting to %d\n", p->cn_vc_size);
}
rc = configuration_get_value_int(&config, "PARAMS", "chunk_size", anno, &p->chunk_size);
if(rc) {
p->chunk_size = 512;
fprintf(stderr, "Chunk size for packets is specified, setting to %d\n", p->chunk_size);
}
configuration_get_value_double(&config, "PARAMS", "link_bandwidth", anno,
&p->link_bandwidth);
if(!p->link_bandwidth) {
......@@ -1233,10 +1254,17 @@ if(msg->packet_ID == LLU(TRACK_PKT))
fattree_message_list * cur_chunk = (fattree_message_list *)malloc(
sizeof(fattree_message_list));
init_fattree_message_list(cur_chunk, msg);
if(msg->remote_event_size_bytes > 0) {
void *m_data_src = model_net_method_get_edata(FATTREE, msg);
cur_chunk->event_data = (char*)malloc(msg->remote_event_size_bytes);
memcpy(cur_chunk->event_data, m_data_src,
if(msg->remote_event_size_bytes > 0)
{
void *m_data_src = model_net_method_get_edata(FATTREE, msg);
tmp_svr my_temp_svr;
memcpy(&my_temp_svr,m_data_src,msg->remote_event_size_bytes);
if((int)my_temp_svr.src == 0 && (int)lp->gid == 136)
printf("3--Handling Remote Event Data--- msg->packet_id:%llu LP-GID:%d event_type:%d event_src:%d event_flag:%d msg->final_dest_gid:%d\n",msg->packet_ID,(int)lp->gid,(int)my_temp_svr.svr_event_type, (int)my_temp_svr.src, my_temp_svr.incremented_flag,msg->final_dest_gid);
cur_chunk->event_data = (char*)malloc(msg->remote_event_size_bytes);
memcpy(cur_chunk->event_data, m_data_src,
msg->remote_event_size_bytes);
}
......@@ -1483,6 +1511,20 @@ void switch_buf_update(switch_state * s, tw_bf * bf, fattree_message * msg,
void ft_send_remote_event(ft_terminal_state * s, fattree_message * msg, tw_lp * lp, tw_bf * bf, char * event_data, int remote_event_size)
{
void * tmp_ptr = model_net_method_get_edata(FATTREE, msg);
tmp_svr my_temp_svr;
memcpy(&my_temp_svr,event_data,remote_event_size);
// printf("rm_event_size:%d\n",msg->remote_event_size_bytes);
// printf("size of tmp_svr:%d\n",sizeof(tmp_svr));
// memcpy(my_temp_svr,event_data,sizeof(msg->remote_event_size_bytes));
// if((int)my_temp_svr.src == 0 && (int)lp->gid == 136 )
// if(msg->packet_ID == LLU(TRACK_PKT))
if((int)lp->gid == 136)
{
printf("2--Handling Remote Event Data--- msg->packet_id:%llu LP-GID:%d event_type:%d event_src:%d event_flag:%d msg->final_dest_gid:%d\n",msg->packet_ID,(int)lp->gid,(int)my_temp_svr.svr_event_type, (int)my_temp_svr.src, my_temp_svr.incremented_flag,msg->final_dest_gid);
}
tw_stime ts = g_tw_lookahead + bytes_to_ns(msg->remote_event_size_bytes, (1/s->params->cn_bandwidth));
if (msg->is_pull){
......@@ -1675,6 +1717,7 @@ if(msg->packet_ID == LLU(TRACK_PKT))
assert(tmp);
tmp->num_chunks++;
// If it's the last chunk of the packet then collect statistics
if(msg->chunk_id == num_chunks - 1)
{
bf->c1 = 1;
......@@ -1684,7 +1727,7 @@ if(msg->packet_ID == LLU(TRACK_PKT))
N_finished_packets++;
s->finished_packets++;
}
/* if its the last chunk of the packet then handle the remote event data */
// If it's the main chunk of the packet then handle the remote event data
if(msg->remote_event_size_bytes > 0 && !tmp->remote_event_data)
{
/* Retreive the remote event entry */
......@@ -1692,13 +1735,27 @@ if(msg->packet_ID == LLU(TRACK_PKT))
assert(tmp->remote_event_data);
tmp->remote_event_size = msg->remote_event_size_bytes;
memcpy(tmp->remote_event_data, m_data_src, msg->remote_event_size_bytes);
tmp_svr my_temp_svr;
memcpy(&my_temp_svr,tmp->remote_event_data,msg->remote_event_size_bytes);
// printf("rm_event_size:%d\n",msg->remote_event_size_bytes);
// printf("size of tmp_svr:%d\n",sizeof(tmp_svr));
// memcpy(my_temp_svr,event_data,sizeof(msg->remote_event_size_bytes));
// if((int)my_temp_svr.src == 0 && (int)lp->gid == 136 )
// if(msg->packet_ID == LLU(TRACK_PKT))
if((int)lp->gid == 136)
{
printf("1--Handling Remote Event Data--- msg->packet_id:%llu LP-GID:%d event_type:%d event_src:%d event_flag:%d msg->final_dest_gid:%d",msg->packet_ID,(int)lp->gid,(int)my_temp_svr.svr_event_type, (int)my_temp_svr.src, my_temp_svr.incremented_flag,msg->final_dest_gid);
printf(" tmp->num_chunks:%d\n",tmp->num_chunks);
}
}
if (fattree_max_latency < tw_now( lp ) - msg->travel_start_time)
{
bf->c3 = 1;
msg->saved_available_time = fattree_max_latency;
fattree_max_latency = tw_now( lp ) - msg->travel_start_time;
}
if (fattree_max_latency < tw_now( lp ) - msg->travel_start_time)
{
bf->c3 = 1;
msg->saved_available_time = fattree_max_latency;
fattree_max_latency = tw_now( lp ) - msg->travel_start_time;
}
/* If all chunks of a message have arrived then send a remote event to the
* callee*/
/*if(tmp->num_chunks >= total_chunks || tmp->num_chunks < 0)
......@@ -1708,6 +1765,10 @@ if(msg->packet_ID == LLU(TRACK_PKT))
return;
}*/
if((int)lp->gid == 136)
{
printf("tmp->num_chunks:%d total_chunks:%d \n",tmp->num_chunks,total_chunks);
}
if(tmp->num_chunks >= total_chunks)
{
bf->c7 = 1;
......@@ -1717,7 +1778,8 @@ if(msg->packet_ID == LLU(TRACK_PKT))
s->total_msg_size += msg->total_size;
s->finished_msgs++;
if(msg->packet_ID == LLU(TRACK_PKT))
if(msg->packet_ID == LLU(TRACK_PKT))
printf("\n Packet %llu has been sent from lp %llu\n", msg->packet_ID, LLU(lp->gid));
//assert(tmp->remote_event_data && tmp->remote_event_size > 0);
......
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