From db54ce3874b561d61cd3d25d82f4bd2d9f426ab3 Mon Sep 17 00:00:00 2001 From: alegrand Date: Thu, 2 Aug 2007 12:51:24 +0000 Subject: [PATCH 1/1] Keeping up with the new surf model description. git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@3938 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/simix/smx_config.c | 30 ++++++------- src/simix/smx_environment.c | 89 +++++++++++++++++++------------------ 2 files changed, 58 insertions(+), 61 deletions(-) diff --git a/src/simix/smx_config.c b/src/simix/smx_config.c index 6043e65538..e6cc7becf8 100644 --- a/src/simix/smx_config.c +++ b/src/simix/smx_config.c @@ -24,14 +24,10 @@ 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, "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 */ @@ -43,8 +39,9 @@ static void _simix_cfg_cb__cpu_model(const char *name, int pos) 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) @@ -55,12 +52,9 @@ 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 */ @@ -99,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 */ diff --git a/src/simix/smx_environment.c b/src/simix/smx_environment.c index b80f238c7c..db9c81b381 100644 --- a/src/simix/smx_environment.c +++ b/src/simix/smx_environment.c @@ -35,6 +35,7 @@ void SIMIX_create_environment(const char *file) 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); @@ -43,51 +44,51 @@ void SIMIX_create_environment(const char *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) { -- 2.20.1