Commit abdd1078 authored by Shane Snyder's avatar Shane Snyder

Update network models to use tw_event_new

This prevents simulations that run for a certain duration from
crashing rather than ending when simulation time is reached.
parent 59985d6d
......@@ -73,7 +73,7 @@ static void dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int pa
codes_mapping_get_lp_id(lp_group_name, "modelnet_dragonfly", mapping_rep_id, mapping_offset, &dest_nic_id);
xfer_to_nic_time = 0.01 + codes_local_latency(sender); /* Throws an error of found last KP time > current event time otherwise when LPs of one type are placed together*/
e_new = codes_event_new(local_nic_id, xfer_to_nic_time, sender);
e_new = tw_event_new(local_nic_id, xfer_to_nic_time, sender);
msg = tw_event_data(e_new);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
......@@ -300,7 +300,7 @@ void packet_send(terminal_state * s, tw_bf * bf, terminal_message * msg, tw_lp *
terminal_message* m_new;
char* local_event;
ts = (1/cn_bandwidth) * msg->local_event_size_bytes;
e_new = codes_event_new(msg->sender_lp, ts, lp);
e_new = tw_event_new(msg->sender_lp, ts, lp);
m_new = tw_event_data(e_new);
local_event = (char*)msg;
local_event += dragonfly_get_msg_sz() + msg->remote_event_size_bytes;
......@@ -364,7 +364,7 @@ if( msg->packet_ID == TRACK && msg->chunk_id == num_chunks-1)
if(msg->remote_event_size_bytes)
{
ts = (1/cn_bandwidth) * msg->remote_event_size_bytes;
e = codes_event_new(msg->final_dest_gid, ts, lp);
e = tw_event_new(msg->final_dest_gid, ts, lp);
m = tw_event_data(e);
char* tmp_ptr = (char*)msg;
tmp_ptr += dragonfly_get_msg_sz();
......
......@@ -349,7 +349,7 @@ static void handle_msg_ready_event(
/* schedule event to final destination for when the recv is complete */
// printf("\n Remote message to LP %d ", m->final_dest_gid);
e_new = codes_event_new(m->final_dest_gid, recv_queue_time, lp);
e_new = tw_event_new(m->final_dest_gid, recv_queue_time, lp);
m_new = tw_event_data(e_new);
char* tmp_ptr = (char*)m;
tmp_ptr += loggp_get_msg_sz();
......@@ -446,7 +446,7 @@ static void handle_msg_start_event(
codes_mapping_get_lp_id(lp_group_name, "modelnet_loggp", mapping_rep_id , mapping_offset, &dest_id);
// printf("\n msg start sending to %d ", dest_id);
e_new = codes_event_new(dest_id, send_queue_time, lp);
e_new = tw_event_new(dest_id, send_queue_time, lp);
m_new = tw_event_data(e_new);
/* copy entire previous message over, including payload from user of
......@@ -464,7 +464,7 @@ static void handle_msg_start_event(
{
char* local_event;
e_new = codes_event_new(m->src_gid, send_queue_time+codes_local_latency(lp), lp);
e_new = tw_event_new(m->src_gid, send_queue_time+codes_local_latency(lp), lp);
m_new = tw_event_data(e_new);
local_event = (char*)m;
......@@ -503,7 +503,7 @@ static void loggp_packet_event(
codes_mapping_get_lp_id(lp_group_name, "modelnet_loggp", mapping_rep_id, mapping_offset, &dest_id);
xfer_to_nic_time = codes_local_latency(sender);
e_new = codes_event_new(dest_id, xfer_to_nic_time, sender);
e_new = tw_event_new(dest_id, xfer_to_nic_time, sender);
msg = tw_event_data(e_new);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
......
......@@ -359,7 +359,7 @@ static void handle_msg_ready_event(
/* schedule event to final destination for when the recv is complete */
// printf("\n Remote message to LP %d ", m->final_dest_gid);
e_new = codes_event_new(m->final_dest_gid, recv_queue_time, lp);
e_new = tw_event_new(m->final_dest_gid, recv_queue_time, lp);
m_new = tw_event_data(e_new);
char* tmp_ptr = (char*)m;
tmp_ptr += sn_get_msg_sz();
......@@ -442,7 +442,7 @@ static void handle_msg_start_event(
codes_mapping_get_lp_id(lp_group_name, "modelnet_simplenet", mapping_rep_id , mapping_offset, &dest_id);
// printf("\n msg start sending to %d ", dest_id);
e_new = codes_event_new(dest_id, send_queue_time, lp);
e_new = tw_event_new(dest_id, send_queue_time, lp);
m_new = tw_event_data(e_new);
/* copy entire previous message over, including payload from user of
......@@ -460,7 +460,7 @@ static void handle_msg_start_event(
{
char* local_event;
e_new = codes_event_new(m->src_gid, send_queue_time+codes_local_latency(lp), lp);
e_new = tw_event_new(m->src_gid, send_queue_time+codes_local_latency(lp), lp);
m_new = tw_event_data(e_new);
local_event = (char*)m;
......@@ -499,7 +499,7 @@ static void simplenet_packet_event(
codes_mapping_get_lp_id(lp_group_name, "modelnet_simplenet", mapping_rep_id, mapping_offset, &dest_id);
xfer_to_nic_time = codes_local_latency(sender);
e_new = codes_event_new(dest_id, xfer_to_nic_time, sender);
e_new = tw_event_new(dest_id, xfer_to_nic_time, sender);
msg = tw_event_data(e_new);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
......
......@@ -56,7 +56,7 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet
/* TODO: Should send the packets in correct sequence. Currently the last packet is being sent first due to codes_local_latency offset. */
xfer_to_nic_time = 0.01 + codes_local_latency(sender); /* Throws an error of found last KP time > current event time otherwise */
e_new = codes_event_new(local_nic_id, xfer_to_nic_time, sender);
e_new = tw_event_new(local_nic_id, xfer_to_nic_time, sender);
msg = tw_event_data(e_new);
strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp;
......@@ -413,7 +413,7 @@ static void packet_send( nodes_state * s,
nodes_message* m_new;
char* local_event;
ts = (1/link_bandwidth) * msg->local_event_size_bytes;
e_new = codes_event_new(msg->sender_lp, ts, lp);
e_new = tw_event_new(msg->sender_lp, ts, lp);
m_new = tw_event_data(e_new);
local_event = (char*)msg;
local_event += torus_get_msg_sz() + msg->remote_event_size_bytes;
......@@ -474,7 +474,7 @@ static void packet_arrive( nodes_state * s,
if(msg->remote_event_size_bytes)
{
ts = (1/link_bandwidth) * msg->remote_event_size_bytes;
e = codes_event_new(msg->final_dest_gid, ts, lp);
e = tw_event_new(msg->final_dest_gid, ts, lp);
m = tw_event_data(e);
char* tmp_ptr = (char*)msg;
tmp_ptr += torus_get_msg_sz();
......
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