val = xbt_cfg_get_string (_simix_cfg_set, name);
/* New Module missing */
- xbt_assert1(!strcmp(val, "CLM03") ||
- !strcmp(val, "KCCFLN05") ||
- !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);
+
+ find_resource_description(surf_workstation_resource_description,
+ surf_workstation_resource_description_size,
+ val);
}
/* callback of the cpu_model variable */
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);
+ 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)
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);
+ find_resource_description(surf_network_resource_description,
+ surf_network_resource_description_size,
+ val);
}
/* create the config set and register what should be */
/** \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
*/
char *name = NULL;
void *workstation = NULL;
char *workstation_model_name;
+ int workstation_id = -1;
simix_config_init(); /* make sure that our configuration set is created */
surf_timer_resource_init(file);
workstation_model_name = xbt_cfg_get_string (_simix_cfg_set, "workstation_model");
DEBUG1("Model : %s", workstation_model_name);
- if (!strcmp(workstation_model_name,"KCCFLN05")) {
- surf_workstation_resource_init_KCCFLN05(file);
-#ifdef HAVE_SDP
- } else if (!strcmp(workstation_model_name,"SDP")) {
- surf_workstation_resource_init_KCCFLN05_proportional(file);
-#endif
- } else if (!strcmp(workstation_model_name,"Vegas")) {
- surf_workstation_resource_init_KCCFLN05_Vegas(file);
- } else if (!strcmp(workstation_model_name,"Reno")) {
- surf_workstation_resource_init_KCCFLN05_Reno(file);
- } else if (!strcmp(workstation_model_name,"CLM03")) {
- surf_workstation_resource_init_CLM03(file);
-#ifdef HAVE_GTNETS
- } else if (!strcmp(workstation_model_name,"GTNets")) {
- surf_workstation_resource_init_GTNETS(file);
-#endif
- } else if (!strcmp(workstation_model_name,"compound")) {
- char *network_model_name = xbt_cfg_get_string (_simix_cfg_set, "network_model");
- char *cpu_model_name = xbt_cfg_get_string (_simix_cfg_set, "cpu_model");
-
- if(!strcmp(cpu_model_name,"Cas01")) {
- surf_cpu_resource_init_Cas01(file);
- } else DIE_IMPOSSIBLE;
-
- if(!strcmp(network_model_name,"CM02")) {
- surf_network_resource_init_CM02(file);
-#ifdef HAVE_GTNETS
- } else if(!strcmp(network_model_name,"GTNets")) {
- surf_network_resource_init_GTNETS(file);
-#endif
- } else if(!strcmp(network_model_name,"Reno")) {
- surf_network_resource_init_Reno(file);
- } else if(!strcmp(network_model_name,"Vegas")) {
- surf_network_resource_init_Vegas(file);
-#ifdef HAVE_SDP
- } else if(!strcmp(network_model_name,"SDP")) {
- surf_network_resource_init_SDP(file);
-#endif
- } else
- DIE_IMPOSSIBLE;
-
- surf_workstation_resource_init_compound(file);
- } else {
- DIE_IMPOSSIBLE;
+ workstation_id = find_resource_description(surf_workstation_resource_description,
+ surf_workstation_resource_description_size,
+ workstation_model_name);
+ if(!strcmp(workstation_model_name,"compound")) {
+ xbt_ex_t e;
+ char *network_model_name = NULL;
+ char *cpu_model_name = NULL;
+ int network_id = -1;
+ int cpu_id = -1;
+
+ TRY {
+ cpu_model_name = xbt_cfg_get_string (_simix_cfg_set, "cpu_model");
+ } CATCH(e) {
+ if (e.category == bound_error) {
+ xbt_assert0(0,"Set a cpu model to use with the 'compound' workstation model");
+ xbt_ex_free(e);
+ } else {
+ RETHROW;
+ }
+ }
+
+ TRY {
+ network_model_name=xbt_cfg_get_string (_simix_cfg_set, "network_model");
+ } CATCH(e) {
+ if (e.category == bound_error) {
+ xbt_assert0(0,"Set a network model to use with the 'compound' workstation model");
+ xbt_ex_free(e);
+ } else {
+ RETHROW;
+ }
+ }
+
+ network_id = find_resource_description(surf_network_resource_description,
+ surf_network_resource_description_size,
+ network_model_name);
+ cpu_id = find_resource_description(surf_cpu_resource_description,
+ surf_cpu_resource_description_size,
+ cpu_model_name);
+
+ surf_cpu_resource_description[cpu_id].resource_init(file);
+ surf_network_resource_description[network_id].resource_init(file);
}
+
+ surf_workstation_resource_description[workstation_id].resource_init(file);
+
_simix_init_status = 2; /* inited; don't change settings now */
xbt_dict_foreach(workstation_set, cursor, name, workstation) {