Commit cfe5c8b6 authored by Misbah Mubarak's avatar Misbah Mubarak
Browse files

minor changes to model-net plug-in: (1) making the torus network's chunk size...

minor changes to model-net plug-in: (1) making the torus network's chunk size configurable (2) handling some edge cases which we haven't encountered so far but its good to have them for future
parent ff521b63
...@@ -79,6 +79,7 @@ struct torus_param ...@@ -79,6 +79,7 @@ struct torus_param
int buffer_size; /* number of buffer slots for each vc in flits*/ int buffer_size; /* number of buffer slots for each vc in flits*/
int num_vc; /* number of virtual channels for each torus link */ int num_vc; /* number of virtual channels for each torus link */
float mean_process;/* mean process time for each flit */ float mean_process;/* mean process time for each flit */
int chunk_size; /* chunk is the smallest unit--default set to 32 */
}; };
/* In general we need to figure out how to pass configuration information to /* In general we need to figure out how to pass configuration information to
* the methods and we need to be able to calculate ross event message size. * the methods and we need to be able to calculate ross event message size.
......
...@@ -43,6 +43,8 @@ int * dim_length; ...@@ -43,6 +43,8 @@ int * dim_length;
int * factor; int * factor;
/* half length of each dimension, used in torus coordinates calculation */ /* half length of each dimension, used in torus coordinates calculation */
int * half_length; int * half_length;
/* size of each torus chunk, by default it is set to 32 */
int chunk_size;
/* codes mapping group name, lp type name */ /* codes mapping group name, lp type name */
char grp_name[MAX_NAME_LENGTH], type_name[MAX_NAME_LENGTH]; char grp_name[MAX_NAME_LENGTH], type_name[MAX_NAME_LENGTH];
......
...@@ -143,6 +143,7 @@ void model_net_event( ...@@ -143,6 +143,7 @@ void model_net_event(
int i; int i;
int last = 0; int last = 0;
//printf("\n number of packets %d message size %d ", num_packets, message_size);
if((remote_event_size + self_event_size + model_net_get_msg_sz(net_id)) if((remote_event_size + self_event_size + model_net_get_msg_sz(net_id))
> g_tw_msg_sz) > g_tw_msg_sz)
{ {
...@@ -155,6 +156,9 @@ void model_net_event( ...@@ -155,6 +156,9 @@ void model_net_event(
if(message_size % packet_size) if(message_size % packet_size)
num_packets++; /* Handle the left out data if message size is not exactly divisible by packet size */ num_packets++; /* Handle the left out data if message size is not exactly divisible by packet size */
if(message_size < packet_size)
num_packets = 1;
/*Determine the network name*/ /*Determine the network name*/
if(net_id < 0 || net_id >= MAX_NETS) if(net_id < 0 || net_id >= MAX_NETS)
{ {
...@@ -309,7 +313,7 @@ int model_net_set_params() ...@@ -309,7 +313,7 @@ int model_net_set_params()
{ {
torus_param net_params; torus_param net_params;
char dim_length[MAX_NAME_LENGTH]; char dim_length[MAX_NAME_LENGTH];
int n_dims=0, buffer_size=0, num_vc=0, i=0; int n_dims=0, buffer_size=0, num_vc=0, i=0, chunk_size = 0;
double link_bandwidth=0; double link_bandwidth=0;
configuration_get_value_int(&config, "PARAMS", "n_dims", &n_dims); configuration_get_value_int(&config, "PARAMS", "n_dims", &n_dims);
...@@ -333,6 +337,12 @@ int model_net_set_params() ...@@ -333,6 +337,12 @@ int model_net_set_params()
printf("\n Buffer size not specified, setting to %d ",buffer_size); printf("\n Buffer size not specified, setting to %d ",buffer_size);
} }
configuration_get_value_int(&config, "PARAMS", "chunk_size", &chunk_size);
if(!chunk_size)
{
chunk_size = 32;
printf("\n Chunk size not specified, setting to %d ", chunk_size);
}
configuration_get_value_int(&config, "PARAMS", "num_vc", &num_vc); configuration_get_value_int(&config, "PARAMS", "num_vc", &num_vc);
if(!num_vc) if(!num_vc)
{ {
...@@ -345,6 +355,7 @@ int model_net_set_params() ...@@ -345,6 +355,7 @@ int model_net_set_params()
net_params.n_dims=n_dims; net_params.n_dims=n_dims;
net_params.num_vc=num_vc; net_params.num_vc=num_vc;
net_params.buffer_size=buffer_size; net_params.buffer_size=buffer_size;
net_params.chunk_size = chunk_size;
net_params.link_bandwidth=link_bandwidth; net_params.link_bandwidth=link_bandwidth;
net_params.dim_length=malloc(n_dims*sizeof(int)); net_params.dim_length=malloc(n_dims*sizeof(int));
token = strtok(dim_length, ","); token = strtok(dim_length, ",");
......
...@@ -15,14 +15,19 @@ static void torus_setup(const void* net_params) ...@@ -15,14 +15,19 @@ static void torus_setup(const void* net_params)
link_bandwidth = t_param->link_bandwidth; link_bandwidth = t_param->link_bandwidth;
buffer_size = t_param->buffer_size; buffer_size = t_param->buffer_size;
num_vc = t_param->num_vc; num_vc = t_param->num_vc;
chunk_size = t_param->chunk_size;
head_delay = (1 / link_bandwidth) * CHUNK_SIZE; head_delay = (1 / link_bandwidth) * chunk_size;
credit_delay = (1 / link_bandwidth) * 8; credit_delay = (1 / link_bandwidth) * 8;
dim_length = malloc(n_dims * sizeof(int)); dim_length = malloc(n_dims * sizeof(int));
factor = malloc(n_dims * sizeof(int)); factor = malloc(n_dims * sizeof(int));
half_length = malloc(n_dims * sizeof(int)); half_length = malloc(n_dims * sizeof(int));
for(i = 0; i < n_dims; i++) for(i = 0; i < n_dims; i++)
dim_length[i] = t_param->dim_length[i]; /* TODO, read comma separated values from files */ {
dim_length[i] = t_param->dim_length[i];
if(!dim_length[i])
dim_length[i] = 8;
}
} }
/* torus packet reverse event */ /* torus packet reverse event */
...@@ -61,6 +66,13 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet ...@@ -61,6 +66,13 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet
msg->remote_event_size_bytes = 0; msg->remote_event_size_bytes = 0;
msg->local_event_size_bytes = 0; msg->local_event_size_bytes = 0;
msg->type = GENERATE; msg->type = GENERATE;
num_chunks = msg->packet_size/chunk_size;
if(msg->packet_size % chunk_size)
{
num_chunks++;
}
if(is_last_pckt) /* Its the last packet so pass in remote event information*/ if(is_last_pckt) /* Its the last packet so pass in remote event information*/
{ {
...@@ -78,8 +90,8 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet ...@@ -78,8 +90,8 @@ static void torus_packet_event(char* category, tw_lpid final_dest_lp, int packet
memcpy(tmp_ptr, self_event, self_event_size); memcpy(tmp_ptr, self_event, self_event_size);
tmp_ptr += self_event_size; tmp_ptr += self_event_size;
} }
// 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);
} }
...@@ -268,7 +280,7 @@ static void packet_generate( nodes_state * s, ...@@ -268,7 +280,7 @@ static void packet_generate( nodes_state * s,
msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter; msg->packet_ID = lp->gid + g_tw_nlp * s->packet_counter;
msg->my_N_hop = 0; msg->my_N_hop = 0;
num_chunks = msg->packet_size/CHUNK_SIZE;
s->packet_counter++; s->packet_counter++;
if(msg->packet_ID == TRACE) if(msg->packet_ID == TRACE)
...@@ -462,8 +474,6 @@ static void packet_arrive( nodes_state * s, ...@@ -462,8 +474,6 @@ static void packet_arrive( nodes_state * s,
if(msg->remote_event_size_bytes) if(msg->remote_event_size_bytes)
{ {
ts = (1/link_bandwidth) * msg->remote_event_size_bytes; ts = (1/link_bandwidth) * msg->remote_event_size_bytes;
if(msg->packet_ID == TRACE)
printf("\n lp %d Sending final message after %lf ",(int)lp->gid, ts);
e = codes_event_new(msg->final_dest_gid, ts, lp); e = codes_event_new(msg->final_dest_gid, ts, lp);
m = tw_event_data(e); m = tw_event_data(e);
char* tmp_ptr = (char*)msg; char* tmp_ptr = (char*)msg;
......
...@@ -11,10 +11,11 @@ PARAMS ...@@ -11,10 +11,11 @@ PARAMS
{ {
packet_size="512"; packet_size="512";
modelnet="torus"; modelnet="torus";
message_size="512"; message_size="2048";
n_dims="4"; n_dims="4";
dim_length="4,2,2,2"; dim_length="4,2,2,2";
link_bandwidth="2.0"; link_bandwidth="2.0";
buffer_size="256"; buffer_size="16384";
num_vc="1"; num_vc="1";
chunk_size="32";
} }
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