Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Keeping up with the new surf model description.
[simgrid.git] / src / simix / smx_config.c
index aab10e1..e6cc7be 100644 (file)
@@ -24,13 +24,37 @@ static void _simix_cfg_cb__workstation_model(const char *name, int pos)
   
   val = xbt_cfg_get_string (_simix_cfg_set, name);
   /* New Module missing */
-  xbt_assert1(!strcmp(val, "CLM03") ||
-              !strcmp(val, "KCCFLN05") ||
-             !strcmp(val, "KCCFLN05_proportional") ||
-             !strcmp(val, "KCCFLN05_Vegas") ||
-             !strcmp(val, "KCCFLN05_Reno") ||
-              !strcmp(val, "GTNETS"),
-              "Unknown workstation model: %s (choices are: 'CLM03', 'KCCFLN05', 'KCCFLN05_proportional', 'KCCFLN05_Vegas', 'KCCFLN05_Reno' and 'GTNETS'",val);
+  
+  find_resource_description(surf_workstation_resource_description,
+                           surf_workstation_resource_description_size,
+                           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 */
+  find_resource_description(surf_cpu_resource_description,
+                           surf_cpu_resource_description_size,
+                           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 */
+  find_resource_description(surf_network_resource_description,
+                           surf_network_resource_description_size,
+                           val);
 }
 
 /* create the config set and register what should be */
@@ -46,7 +70,14 @@ void simix_config_init(void)
   xbt_cfg_register (_simix_cfg_set, 
                     "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");
 }
 
@@ -62,12 +93,14 @@ void simix_config_finalize(void)
 
 /** \brief Set a configuration variable
  * 
+ * FIXME
+
  * Currently existing configuration variable:
  *   - 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.
- * 
+ *     - compound 
  *     \param name Configuration variable name that will change.
  *     \param pa A va_list with the others parameters
  */