Commit dd369556 authored by Jonathan Jenkins's avatar Jonathan Jenkins

Packet-ordering fix - packets had essentially random order

parent 8a4cd871
...@@ -65,7 +65,7 @@ static tw_lpid dragonfly_find_local_device(tw_lp *sender); ...@@ -65,7 +65,7 @@ static tw_lpid dragonfly_find_local_device(tw_lp *sender);
/* dragonfly packet event method called by modelnet, this method triggers the packet /* dragonfly packet event method called by modelnet, this method triggers the packet
* generate event of dragonfly and attached remote and local events to the last packet * generate event of dragonfly and attached remote and local events to the last packet
* of the message */ * of the message */
static void dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int packet_size, int remote_event_size, const void* remote_event, int self_event_size, const void* self_event, tw_lp *sender, int is_last_pckt); static tw_stime dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int packet_size, tw_stime offset, int remote_event_size, const void* remote_event, int self_event_size, const void* self_event, tw_lp *sender, int is_last_pckt);
/* returns dragonfly message size */ /* returns dragonfly message size */
static int dragonfly_get_msg_sz(void); static int dragonfly_get_msg_sz(void);
......
...@@ -14,10 +14,11 @@ struct model_net_method ...@@ -14,10 +14,11 @@ struct model_net_method
char* method_name; /* example: "dragonfly" */ char* method_name; /* example: "dragonfly" */
int packet_size; /* packet size */ int packet_size; /* packet size */
void (*mn_setup)(const void* net_params); /* For initializing the network */ void (*mn_setup)(const void* net_params); /* For initializing the network */
void (*model_net_method_packet_event)( tw_stime (*model_net_method_packet_event)(
char* category, char* category,
tw_lpid final_dest_lp, tw_lpid final_dest_lp,
int packet_size, int packet_size,
tw_stime offset,
int remote_event_size, /* 0 means don't deliver remote event */ int remote_event_size, /* 0 means don't deliver remote event */
const void* remote_event, const void* remote_event,
int self_event_size, /* 0 means don't deliver self event */ int self_event_size, /* 0 means don't deliver self event */
......
...@@ -59,10 +59,11 @@ typedef struct nodes_state nodes_state; ...@@ -59,10 +59,11 @@ typedef struct nodes_state nodes_state;
typedef struct nodes_message nodes_message; typedef struct nodes_message nodes_message;
/* Issues a torus packet event call */ /* Issues a torus packet event call */
static void torus_packet_event( static tw_stime torus_packet_event(
char* category, char* category,
tw_lpid final_dest_lp, tw_lpid final_dest_lp,
int packet_size, int packet_size,
tw_stime offset,
int remote_event_size, int remote_event_size,
const void* remote_event, const void* remote_event,
int self_event_size, int self_event_size,
......
...@@ -56,7 +56,7 @@ static void dragonfly_report_stats() ...@@ -56,7 +56,7 @@ static void dragonfly_report_stats()
return; return;
} }
/* dragonfly packet event , generates a dragonfly packet on the compute node */ /* dragonfly packet event , generates a dragonfly packet on the compute node */
static void dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int packet_size, int remote_event_size, const void* remote_event, int self_event_size, const void* self_event, tw_lp *sender, int is_last_pckt) static tw_stime dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int packet_size, tw_stime offset, int remote_event_size, const void* remote_event, int self_event_size, const void* self_event, tw_lp *sender, int is_last_pckt)
{ {
tw_event * e_new; tw_event * e_new;
tw_stime xfer_to_nic_time; tw_stime xfer_to_nic_time;
...@@ -73,7 +73,7 @@ static void dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int pa ...@@ -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); 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*/ 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 = tw_event_new(local_nic_id, xfer_to_nic_time, sender); e_new = tw_event_new(local_nic_id, xfer_to_nic_time+offset, sender);
msg = tw_event_data(e_new); msg = tw_event_data(e_new);
strcpy(msg->category, category); strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp; msg->final_dest_gid = final_dest_lp;
...@@ -103,7 +103,7 @@ static void dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int pa ...@@ -103,7 +103,7 @@ static void dragonfly_packet_event(char* category, tw_lpid final_dest_lp, int pa
} }
//printf("\n torus remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time); //printf("\n torus remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time);
tw_event_send(e_new); tw_event_send(e_new);
return; return xfer_to_nic_time;
} }
/* returns the torus message size */ /* returns the torus message size */
......
...@@ -105,10 +105,11 @@ static int loggp_get_magic(); ...@@ -105,10 +105,11 @@ static int loggp_get_magic();
static void loggp_setup(const void* net_params); static void loggp_setup(const void* net_params);
/* Issues a loggp packet event call */ /* Issues a loggp packet event call */
static void loggp_packet_event( static tw_stime loggp_packet_event(
char* category, char* category,
tw_lpid final_dest_lp, tw_lpid final_dest_lp,
int packet_size, int packet_size,
tw_stime offset,
int remote_event_size, int remote_event_size,
const void* remote_event, const void* remote_event,
int self_event_size, int self_event_size,
...@@ -480,10 +481,11 @@ static void handle_msg_start_event( ...@@ -480,10 +481,11 @@ static void handle_msg_start_event(
/*This method will serve as an intermediate layer between loggp and modelnet. /*This method will serve as an intermediate layer between loggp and modelnet.
* It takes the packets from modelnet layer and calls underlying loggp methods*/ * It takes the packets from modelnet layer and calls underlying loggp methods*/
static void loggp_packet_event( static tw_stime loggp_packet_event(
char* category, char* category,
tw_lpid final_dest_lp, tw_lpid final_dest_lp,
int packet_size, int packet_size,
tw_stime offset,
int remote_event_size, int remote_event_size,
const void* remote_event, const void* remote_event,
int self_event_size, int self_event_size,
...@@ -503,7 +505,7 @@ static void loggp_packet_event( ...@@ -503,7 +505,7 @@ static void loggp_packet_event(
codes_mapping_get_lp_id(lp_group_name, "modelnet_loggp", mapping_rep_id, mapping_offset, &dest_id); 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); xfer_to_nic_time = codes_local_latency(sender);
e_new = tw_event_new(dest_id, xfer_to_nic_time, sender); e_new = tw_event_new(dest_id, xfer_to_nic_time+offset, sender);
msg = tw_event_data(e_new); msg = tw_event_data(e_new);
strcpy(msg->category, category); strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp; msg->final_dest_gid = final_dest_lp;
...@@ -536,6 +538,7 @@ static void loggp_packet_event( ...@@ -536,6 +538,7 @@ static void loggp_packet_event(
// printf("\n Last packet size: %d ", loggp_get_msg_sz() + remote_event_size + self_event_size); // printf("\n Last packet size: %d ", loggp_get_msg_sz() + remote_event_size + self_event_size);
} }
tw_event_send(e_new); tw_event_send(e_new);
return xfer_to_nic_time;
} }
static void loggp_setup(const void* net_params) static void loggp_setup(const void* net_params)
......
...@@ -14,13 +14,14 @@ ...@@ -14,13 +14,14 @@
#define PROC_TIME 10.0 #define PROC_TIME 10.0
extern struct model_net_method simplenet_method; extern struct model_net_method simplenet_method;
extern struct model_net_method simplewan_method;
extern struct model_net_method torus_method; extern struct model_net_method torus_method;
extern struct model_net_method dragonfly_method; extern struct model_net_method dragonfly_method;
extern struct model_net_method loggp_method; extern struct model_net_method loggp_method;
/* Global array initialization, terminated with a NULL entry */ /* Global array initialization, terminated with a NULL entry */
static struct model_net_method* method_array[] = static struct model_net_method* method_array[] =
{&simplenet_method, &torus_method, &dragonfly_method, &loggp_method, NULL}; {&simplenet_method, &simplewan_method, &torus_method, &dragonfly_method, &loggp_method, NULL};
static int model_net_get_msg_sz(int net_id); static int model_net_get_msg_sz(int net_id);
...@@ -174,6 +175,7 @@ void model_net_event( ...@@ -174,6 +175,7 @@ void model_net_event(
* passed along through network hops and delivered to final_dest_lp * passed along through network hops and delivered to final_dest_lp
*/ */
tw_stime offset = 0.0;
for( i = 0; i < num_packets; i++ ) for( i = 0; i < num_packets; i++ )
{ {
/*Mark the last packet to the net method API*/ /*Mark the last packet to the net method API*/
...@@ -184,7 +186,9 @@ void model_net_event( ...@@ -184,7 +186,9 @@ void model_net_event(
packet_size = message_size - ((num_packets-1)*packet_size); packet_size = message_size - ((num_packets-1)*packet_size);
} }
/* Number of packets and packet ID is passed to the underlying network to mark the final packet for local event completion*/ /* Number of packets and packet ID is passed to the underlying network to mark the final packet for local event completion*/
method_array[net_id]->model_net_method_packet_event(category, final_dest_lp, packet_size, remote_event_size, remote_event, self_event_size, self_event, sender, last); offset += method_array[net_id]->model_net_method_packet_event(category,
final_dest_lp, packet_size, offset, remote_event_size, remote_event,
self_event_size, self_event, sender, last);
} }
return; return;
} }
...@@ -216,6 +220,12 @@ int model_net_set_params() ...@@ -216,6 +220,12 @@ int model_net_set_params()
net_params.net_bw_mbps = net_bw_mbps; net_params.net_bw_mbps = net_bw_mbps;
net_id = model_net_setup("simplenet", packet_size, (const void*)&net_params); /* Sets the network as simplenet and packet size 512 */ net_id = model_net_setup("simplenet", packet_size, (const void*)&net_params); /* Sets the network as simplenet and packet size 512 */
} }
else if (strcmp("simplewan",mn_name)==0){
simplewan_param net_params;
configuration_get_value_relpath(&config, "PARAMS", "net_startup_ns_file", net_params.startup_filename, MAX_NAME_LENGTH);
configuration_get_value_relpath(&config, "PARAMS", "net_bw_mbps_file", net_params.bw_filename, MAX_NAME_LENGTH);
net_id = model_net_setup("simplewan", packet_size, (const void*)&net_params);
}
else if(strcmp("loggp",mn_name)==0) else if(strcmp("loggp",mn_name)==0)
{ {
char net_config_file[256]; char net_config_file[256];
...@@ -462,7 +472,9 @@ void model_net_add_lp_type(int net_id) ...@@ -462,7 +472,9 @@ void model_net_add_lp_type(int net_id)
case SIMPLENET: case SIMPLENET:
lp_type_register("modelnet_simplenet", model_net_get_lp_type(net_id)); lp_type_register("modelnet_simplenet", model_net_get_lp_type(net_id));
break; break;
case SIMPLEWAN:
lp_type_register("modelnet_simplewan", model_net_get_lp_type(net_id));
break;
case TORUS: case TORUS:
lp_type_register("modelnet_torus", model_net_get_lp_type(net_id)); lp_type_register("modelnet_torus", model_net_get_lp_type(net_id));
break; break;
......
...@@ -98,10 +98,11 @@ static int sn_get_magic(); ...@@ -98,10 +98,11 @@ static int sn_get_magic();
static void sn_setup(const void* net_params); static void sn_setup(const void* net_params);
/* Issues a simplenet packet event call */ /* Issues a simplenet packet event call */
static void simplenet_packet_event( static tw_stime simplenet_packet_event(
char* category, char* category,
tw_lpid final_dest_lp, tw_lpid final_dest_lp,
int packet_size, int packet_size,
tw_stime offset,
int remote_event_size, int remote_event_size,
const void* remote_event, const void* remote_event,
int self_event_size, int self_event_size,
...@@ -476,10 +477,11 @@ static void handle_msg_start_event( ...@@ -476,10 +477,11 @@ static void handle_msg_start_event(
/*This method will serve as an intermediate layer between simplenet and modelnet. /*This method will serve as an intermediate layer between simplenet and modelnet.
* It takes the packets from modelnet layer and calls underlying simplenet methods*/ * It takes the packets from modelnet layer and calls underlying simplenet methods*/
static void simplenet_packet_event( static tw_stime simplenet_packet_event(
char* category, char* category,
tw_lpid final_dest_lp, tw_lpid final_dest_lp,
int packet_size, int packet_size,
tw_stime offset,
int remote_event_size, int remote_event_size,
const void* remote_event, const void* remote_event,
int self_event_size, int self_event_size,
...@@ -499,7 +501,7 @@ static void simplenet_packet_event( ...@@ -499,7 +501,7 @@ static void simplenet_packet_event(
codes_mapping_get_lp_id(lp_group_name, "modelnet_simplenet", mapping_rep_id, mapping_offset, &dest_id); 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); xfer_to_nic_time = codes_local_latency(sender);
e_new = tw_event_new(dest_id, xfer_to_nic_time, sender); e_new = tw_event_new(dest_id, xfer_to_nic_time+offset, sender);
msg = tw_event_data(e_new); msg = tw_event_data(e_new);
strcpy(msg->category, category); strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp; msg->final_dest_gid = final_dest_lp;
...@@ -532,6 +534,7 @@ static void simplenet_packet_event( ...@@ -532,6 +534,7 @@ static void simplenet_packet_event(
// printf("\n Last packet size: %d ", sn_get_msg_sz() + remote_event_size + self_event_size); // printf("\n Last packet size: %d ", sn_get_msg_sz() + remote_event_size + self_event_size);
} }
tw_event_send(e_new); tw_event_send(e_new);
return xfer_to_nic_time;
} }
static void sn_setup(const void* net_params) static void sn_setup(const void* net_params)
......
...@@ -38,7 +38,7 @@ static void torus_packet_event_rc(tw_lp *sender) ...@@ -38,7 +38,7 @@ static void torus_packet_event_rc(tw_lp *sender)
} }
/* torus packet event , generates a torus packet on the compute node */ /* torus packet event , generates a torus packet on the compute node */
static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet_size, int remote_event_size, const void* remote_event, int self_event_size, const void* self_event, tw_lp *sender, int is_last_pckt) static tw_stime torus_packet_event(char* category, tw_lpid final_dest_lp, int packet_size, tw_stime offset, int remote_event_size, const void* remote_event, int self_event_size, const void* self_event, tw_lp *sender, int is_last_pckt)
{ {
tw_event * e_new; tw_event * e_new;
tw_stime xfer_to_nic_time; tw_stime xfer_to_nic_time;
...@@ -56,7 +56,7 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet ...@@ -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. */ /* 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 */ xfer_to_nic_time = 0.01 + codes_local_latency(sender); /* Throws an error of found last KP time > current event time otherwise */
e_new = tw_event_new(local_nic_id, xfer_to_nic_time, sender); e_new = tw_event_new(local_nic_id, xfer_to_nic_time+offset, sender);
msg = tw_event_data(e_new); msg = tw_event_data(e_new);
strcpy(msg->category, category); strcpy(msg->category, category);
msg->final_dest_gid = final_dest_lp; msg->final_dest_gid = final_dest_lp;
...@@ -93,6 +93,7 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet ...@@ -93,6 +93,7 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet
// printf("\n torus remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time); // printf("\n torus remote event %d local event %d last packet %d %lf ", msg->remote_event_size_bytes, msg->local_event_size_bytes, is_last_pckt, xfer_to_nic_time);
} }
tw_event_send(e_new); tw_event_send(e_new);
return xfer_to_nic_time;
} }
/*Initialize the torus model, this initialization part is borrowed from Ning's torus model */ /*Initialize the torus model, this initialization part is borrowed from Ning's torus model */
......
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