Commit 0f6e417d authored by Misbah Mubarak's avatar Misbah Mubarak
Browse files

Updates to model-net test program based on the new config file format. We can...

Updates to model-net test program based on the new config file format. We can now configure all network parameters from the config file
parent ce8094b9
......@@ -9,6 +9,9 @@
#include "ross.h"
#include "codes/lp-type-lookup.h"
#include "codes/configuration.h"
#define MAX_NAME_LENGTH 256
typedef struct simplenet_param simplenet_param;
typedef struct dragonfly_param dragonfly_param;
......@@ -49,34 +52,16 @@ struct torus_param
* 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.
#if 0
/* returns a pointer to the lptype struct to use for simplenet LPs */
const tw_lptype* sn_get_lp_type(void);
/* set model parameters:
* - net_startup_ns: network startup cost in ns.
* - net_bs_mbs: network bandwidth in MiB/s (megabytes per second).
void sn_set_params(double net_startup_ns, double net_bw_mbs);
/* retrieve the size of the portion of the event struct that is consumed by
* the simplenet module. The caller should add this value to the size of
* its own event structure to get the maximum total size of a message.
int sn_get_msg_sz(void);
/* retrieve the minimum timestamp offset that simplenet will use */
tw_stime sn_get_min_ts(void);
/*Initialize the network by specifying the network parameters. The
* underlying model-net.c function call will set the network parameters
* according to the network name specified*/
// return an integer being the identifier for the type of network
// call modelnet setup 1 time for a torus and retur value is 0 for e.g.
// call modelnet setup second time for a simplenet
/* call set params for configuring the network parameters from the config file*/
int model_net_set_params();
// setup the modelnet parameters
int model_net_setup(char* net_name, int packet_size, const void* net_params);
/* allocate and transmit a new event that will pass through model_net to
* arrive at its destination:
......@@ -91,7 +91,45 @@ void model_net_event(
int model_net_set_params()
char mn_name[MAX_NAME_LENGTH];
int packet_size = 0;
int net_id;
config_lpgroups_t paramconf;
configuration_get_lpgroups(&config, "PARAMS", &paramconf);
configuration_get_value(&config, "PARAMS", "modelnet", mn_name, MAX_NAME_LENGTH);
configuration_get_value_int(&config, "PARAMS", "packet_size", &packet_size);
packet_size = 512;
printf("\n Warning, no packet size specified, setting packet size to %d ", packet_size);
double net_startup_ns, net_bw_mbps;
simplenet_param net_params;
configuration_get_value_double(&config, "PARAMS", "net_startup_ns", &net_startup_ns);
configuration_get_value_double(&config, "PARAMS", "net_bw_mbps", &net_bw_mbps);
net_params.net_startup_ns = 1.5;
net_params.net_bw_mbps = 20000;
net_id = model_net_setup("simplenet", packet_size, (const void*)&net_params); /* Sets the network as simplenet and packet size 512 */
else if(strcmp("dragonfly", mn_name)==0)
printf("\n dragonfly not supported yet ");
else if(strcmp("torus", mn_name)==0)
printf("\n not supported yet ");
printf("\n Invalid network argument %s ", mn_name);
return net_id;
void model_net_event_rc(
int net_id,
tw_lp *sender,
......@@ -146,6 +146,7 @@ int main(
int rank;
int ret;
lp_io_handle handle;
int message_size=0;
//printf("\n Config count %d ",(int) config.lpgroups_count);
g_tw_ts_end = s_to_ns(60*60*24*365); /* one year, in nsecs */
......@@ -161,24 +162,26 @@ int main(
MPI_Comm_rank(MPI_COMM_WORLD, &rank);
MPI_Comm_size(MPI_COMM_WORLD, &nprocs);
simplenet_param net_params;
net_params.net_startup_ns = 1.5;
net_params.net_bw_mbps = 20000;
net_params.num_nics = NUM_SERVERS;
net_id = model_net_setup("simplenet", 512, (const void*)&net_params); /* Sets the network as simplenet and packet size 512 */
configuration_load(argv[2], MPI_COMM_WORLD, &config);
configuration_get_value_int(&config, "PARAMS", "message_size", &message_size);
configuration_load(argv[2], MPI_COMM_WORLD, &config);
message_size = 256;
printf("\n Warning: ross message size not defined, resetting it to %d", message_size);
//printf("\n Initializing %d lps on %d ", get_lps_for_pe(), g_tw_mynode);
tw_define_lps(codes_mapping_get_lps_for_pe(), 2* sizeof(struct svr_msg) +model_net_get_msg_sz(0) , 0 );
tw_define_lps(codes_mapping_get_lps_for_pe(), message_size, 0 );
/* NOTE: the message size defined here has to be able to handle two
* svr_msg structs and a simplenet message joined together. This allows
* the model to send a single simplenet even that will handle a)
......@@ -7,3 +7,10 @@ LPGROUPS
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