Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
bring new network models to end users
[simgrid.git] / src / simix / smx_config.c
index b7cfd7a..6043e65 100644 (file)
@@ -15,8 +15,8 @@ int _simix_init_status = 0; /* 0: beginning of time;
                              2: inited (running) */
 xbt_cfg_t _simix_cfg_set = NULL;
 
-/* callback of the surf_workstation_model variable */
-static void _simix_cfg_cb__surf_workstation_model(const char *name, int pos) 
+/* callback of the workstation_model variable */
+static void _simix_cfg_cb__workstation_model(const char *name, int pos) 
 {
   char *val;
 
@@ -26,8 +26,41 @@ static void _simix_cfg_cb__surf_workstation_model(const char *name, int pos)
   /* New Module missing */
   xbt_assert1(!strcmp(val, "CLM03") ||
               !strcmp(val, "KCCFLN05") ||
-             !strcmp(val, "KCCFLN05_proportionnal"),
-              "Unknown workstation model: %s (either 'CLM03' or 'KCCFLN05'",val);
+             !strcmp(val, "SDP") ||
+             !strcmp(val, "Vegas") ||
+             !strcmp(val, "Reno") ||
+             !strcmp(val, "GTNets") ||
+             !strcmp(val, "compound"),
+              "Unknown workstation model: %s (choices are: 'CLM03', 'KCCFLN05', 'SDP', 'Vegas', 'Reno', 'GTNets' and 'Compound'",val);
+}
+
+/* callback of the cpu_model variable */
+static void _simix_cfg_cb__cpu_model(const char *name, int pos) 
+{
+  char *val;
+
+  xbt_assert0(_simix_init_status<2, "Cannot change the model after the initialization");
+  
+  val = xbt_cfg_get_string (_simix_cfg_set, name);
+  /* New Module missing */
+  xbt_assert1(!strcmp(val, "Cas01"),
+              "Unknown CPU model: %s (choices are: 'Cas01'",val);
+}
+/* callback of the workstation_model variable */
+static void _simix_cfg_cb__network_model(const char *name, int pos) 
+{
+  char *val;
+
+  xbt_assert0(_simix_init_status<2, "Cannot change the model after the initialization");
+  
+  val = xbt_cfg_get_string (_simix_cfg_set, name);
+  /* New Module missing */
+  xbt_assert1(!strcmp(val, "CM02") ||
+              !strcmp(val, "GTNets") ||
+             !strcmp(val, "SDP") ||
+             !strcmp(val, "Vegas") ||
+             !strcmp(val, "Reno"),
+              "Unknown workstation model: %s (choices are: 'CM02', 'GTNets', 'SDP', 'Vegas' and 'Reno'",val);
 }
 
 /* create the config set and register what should be */
@@ -41,10 +74,17 @@ void simix_config_init(void)
   _simix_cfg_set = xbt_cfg_new();
   
   xbt_cfg_register (_simix_cfg_set, 
-                    "surf_workstation_model", xbt_cfgelm_string, 1,1,
-                    &_simix_cfg_cb__surf_workstation_model,NULL);
-                    
-  xbt_cfg_set_string(_simix_cfg_set,"surf_workstation_model", "KCCFLN05");
+                    "workstation_model", xbt_cfgelm_string, 1,1,
+                    &_simix_cfg_cb__workstation_model,NULL);
+
+  xbt_cfg_register (_simix_cfg_set, 
+                    "cpu_model", xbt_cfgelm_string, 1,1,
+                    &_simix_cfg_cb__cpu_model,NULL); 
+  xbt_cfg_register (_simix_cfg_set, 
+                    "network_model", xbt_cfgelm_string, 1,1,
+                    &_simix_cfg_cb__network_model,NULL);
+                   
+  xbt_cfg_set_string(_simix_cfg_set,"workstation_model", "KCCFLN05");
 }
 
 void simix_config_finalize(void) 
@@ -60,7 +100,7 @@ void simix_config_finalize(void)
 /** \brief Set a configuration variable
  * 
  * Currently existing configuration variable:
- *   - surf_workstation_model (string): Model of workstation to use.  
+ *   - workstation_model (string): Model of workstation to use.  
  *     Possible values (defaults to "KCCFLN05"):
  *     - "CLM03": realistic TCP behavior + basic CPU model (see [CML03 at CCGrid03]) + support for parallel tasks
  *     - "KCCFLN05": realistic TCP behavior + basic CPU model (see [CML03 at CCGrid03]) + failure handling + interference between communications and computations if precised in the platform file.