From a251a46feac3eac126243e066a947e153464a29e Mon Sep 17 00:00:00 2001 From: quasar Date: Tue, 11 Dec 2007 09:19:59 +0000 Subject: [PATCH] eliminating KCCFLN05 model git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@5116 48e7efb5-ca39-0410-a469-dd3cf9ba447f --- src/Makefile.in | 12 ++---------- src/include/surf/surf.h | 5 ++++- src/simix/smx_config.c | 2 +- src/simix/smx_environment.c | 4 +++- src/surf/cpu.c | 4 ++-- src/surf/network.c | 12 +++++++++++- src/surf/surf.c | 7 +++---- src/surf/surfxml_parse.c | 5 +++-- src/surf/workstation.c | 7 +++++-- 9 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/Makefile.in b/src/Makefile.in index d32041ac84..1e81ed6661 100644 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -132,7 +132,6 @@ am__libsimgrid_la_SOURCES_DIST = xbt/snprintf.c xbt/xbt_str.c \ surf/fair_bottleneck.c surf/lagrange.c surf/trace_mgr.c \ surf/random_mgr.c surf/surf.c surf/surfxml_parse.c surf/cpu.c \ surf/network.c surf/workstation.c surf/surf_timer.c \ - surf/workstation_KCCFLN05.c surf/workstation_ptask_L07.c \ xbt/xbt_sg_stubs.c xbt/xbt_os_thread.c \ xbt/xbt_thread_context.c xbt/xbt_ucontext.c \ surf/gtnets/gtnets_simulator.cc surf/gtnets/gtnets_topology.cc \ @@ -170,7 +169,7 @@ am__libsimgrid_la_SOURCES_DIST = xbt/snprintf.c xbt/xbt_str.c \ @CONTEXT_THREADS_FALSE@am__objects_7 = xbt_ucontext.lo am__objects_8 = maxmin.lo fair_bottleneck.lo lagrange.lo trace_mgr.lo \ random_mgr.lo surf.lo surfxml_parse.lo cpu.lo network.lo \ - workstation.lo surf_timer.lo workstation_KCCFLN05.lo \ + workstation.lo surf_timer.lo \ workstation_ptask_L07.lo xbt_sg_stubs.lo $(am__objects_6) \ $(am__objects_7) am__objects_9 = gtnets_simulator.lo gtnets_topology.lo \ @@ -501,7 +500,7 @@ SURF_SRC = surf/maxmin.c surf/fair_bottleneck.c surf/lagrange.c \ surf/trace_mgr.c surf/random_mgr.c surf/surf.c \ surf/surfxml_parse.c surf/cpu.c surf/network.c \ surf/workstation.c surf/surf_timer.c \ - surf/workstation_KCCFLN05.c surf/workstation_ptask_L07.c \ + surf/workstation_ptask_L07.c \ xbt/xbt_sg_stubs.c $(am__append_1) $(am__append_2) GTNETS_SRC = \ surf/gtnets/gtnets_simulator.cc \ @@ -1427,13 +1426,6 @@ surf_timer.lo: surf/surf_timer.c @AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ @am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o surf_timer.lo `test -f 'surf/surf_timer.c' || echo '$(srcdir)/'`surf/surf_timer.c -workstation_KCCFLN05.lo: surf/workstation_KCCFLN05.c -@am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT workstation_KCCFLN05.lo -MD -MP -MF $(DEPDIR)/workstation_KCCFLN05.Tpo -c -o workstation_KCCFLN05.lo `test -f 'surf/workstation_KCCFLN05.c' || echo '$(srcdir)/'`surf/workstation_KCCFLN05.c -@am__fastdepCC_TRUE@ mv -f $(DEPDIR)/workstation_KCCFLN05.Tpo $(DEPDIR)/workstation_KCCFLN05.Plo -@AMDEP_TRUE@@am__fastdepCC_FALSE@ source='surf/workstation_KCCFLN05.c' object='workstation_KCCFLN05.lo' libtool=yes @AMDEPBACKSLASH@ -@AMDEP_TRUE@@am__fastdepCC_FALSE@ DEPDIR=$(DEPDIR) $(CCDEPMODE) $(depcomp) @AMDEPBACKSLASH@ -@am__fastdepCC_FALSE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o workstation_KCCFLN05.lo `test -f 'surf/workstation_KCCFLN05.c' || echo '$(srcdir)/'`surf/workstation_KCCFLN05.c - workstation_ptask_L07.lo: surf/workstation_ptask_L07.c @am__fastdepCC_TRUE@ $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -MT workstation_ptask_L07.lo -MD -MP -MF $(DEPDIR)/workstation_ptask_L07.Tpo -c -o workstation_ptask_L07.lo `test -f 'surf/workstation_ptask_L07.c' || echo '$(srcdir)/'`surf/workstation_ptask_L07.c @am__fastdepCC_TRUE@ mv -f $(DEPDIR)/workstation_ptask_L07.Tpo $(DEPDIR)/workstation_ptask_L07.Plo diff --git a/src/include/surf/surf.h b/src/include/surf/surf.h index a4623ed4fa..f401c3617e 100644 --- a/src/include/surf/surf.h +++ b/src/include/surf/surf.h @@ -44,6 +44,7 @@ typedef struct surf_model_description { const char *name; surf_model_t model; void (* model_init) (const char *filename); + void (* create_ws) (void); } s_surf_model_description_t, *surf_model_description_t; XBT_PUBLIC(void) update_model_description(s_surf_model_description_t *table, @@ -277,6 +278,8 @@ typedef struct surf_network_model { surf_network_model_extension_public_t extension_public; } s_surf_network_model_t, *surf_network_model_t; +XBT_PUBLIC(void) create_workstations(void); + /** \brief The network model * \ingroup SURF_models * @@ -490,7 +493,7 @@ XBT_PUBLIC_DATA(xbt_dict_t) link_set; * \see link_set */ XBT_PUBLIC_DATA(xbt_dict_t) workstation_set; - +XBT_PUBLIC_DATA(xbt_dict_t) cpu_set; /** \brief List of initialized models * \ingroup SURF_models */ diff --git a/src/simix/smx_config.c b/src/simix/smx_config.c index 8ca058bb14..044e2b6fc7 100644 --- a/src/simix/smx_config.c +++ b/src/simix/smx_config.c @@ -80,7 +80,7 @@ void simix_config_init(void) "network_model", xbt_cfgelm_string, 1, 1, &_simix_cfg_cb__network_model, NULL); - xbt_cfg_set_string(_simix_cfg_set, "workstation_model", "KCCFLN05"); + xbt_cfg_set_string(_simix_cfg_set, "workstation_model", "CLM03"); } void simix_config_finalize(void) diff --git a/src/simix/smx_environment.c b/src/simix/smx_environment.c index eb7782f505..89f865de7d 100644 --- a/src/simix/smx_environment.c +++ b/src/simix/smx_environment.c @@ -112,8 +112,10 @@ void SIMIX_create_environment(const char *file) double e ; double s = xbt_os_time(); parse_platform_file(file); + if (surf_workstation_model_description[workstation_id].create_ws != NULL) + surf_workstation_model_description[workstation_id].create_ws(); e = xbt_os_time(); - DEBUG1("PARSE TIME: %lg", (e-s)); + INFO1("PARSE TIME: %lg", (e-s)); } _simix_init_status = 2; /* inited; don't change settings now */ diff --git a/src/surf/cpu.c b/src/surf/cpu.c index 5abfc22153..d7162775f9 100644 --- a/src/surf/cpu.c +++ b/src/surf/cpu.c @@ -90,7 +90,7 @@ static void parse_cpu_init(void) static int called = 0; -static void add_traces(void) +static void add_traces_cpu(void) { xbt_dynar_t trace_connect = NULL; unsigned int cpt; @@ -127,7 +127,7 @@ static void define_callbacks(const char *file) surf_parse_reset_parser(); surfxml_add_callback(STag_surfxml_host_cb_list, parse_cpu_init); surfxml_add_callback(STag_surfxml_prop_cb_list, parse_properties); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces); +// surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces_cpu); surfxml_add_callback(STag_surfxml_random_cb_list, &init_randomness); surfxml_add_callback(ETag_surfxml_random_cb_list, &add_randomness); } diff --git a/src/surf/network.c b/src/surf/network.c index 42f6aae03f..948a55ca24 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -6,6 +6,7 @@ * under the terms of the license (GNU LGPL) which comes with this package. */ #include "network_private.h" +#include "cpu_private.h" #include "xbt/log.h" XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_network, surf, @@ -247,6 +248,7 @@ static void add_traces(void) int connect_element, connect_kind; char *value, *trace_id, *connector_id; link_CM02_t link; + cpu_Cas01_t host = NULL; tmgr_trace_t trace; if (called) return; @@ -262,6 +264,14 @@ static void add_traces(void) xbt_assert1((trace = xbt_dict_get_or_null(traces_set_list, trace_id)), "Trace %s undefined", trace_id); + if (connect_element == A_surfxml_trace_c_connect_element_HOST) { + xbt_assert1((host = xbt_dict_get_or_null(cpu_set, connector_id)), "Host %s undefined", connector_id); + switch (connect_kind) { + case A_surfxml_trace_c_connect_kind_AVAILABILITY: host->state_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); break; + case A_surfxml_trace_c_connect_kind_POWER: host->power_event = tmgr_history_add_trace(history, trace, 0.0, 0, host); break; + } + } + if (connect_element == A_surfxml_trace_c_connect_element_LINK) { xbt_assert1((link = xbt_dict_get_or_null(link_set, connector_id)), "Link %s undefined", connector_id); switch (connect_kind) { @@ -287,9 +297,9 @@ static void define_callbacks(const char *file) surfxml_add_callback(ETag_surfxml_link_c_ctn_cb_list, &parse_route_elem); surfxml_add_callback(ETag_surfxml_route_cb_list, &parse_route_set_route); surfxml_add_callback(STag_surfxml_platform_cb_list, &init_data); + surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces); surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_route); surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_loopback); - surfxml_add_callback(ETag_surfxml_platform_cb_list, &add_traces); surfxml_add_callback(STag_surfxml_set_cb_list, &parse_sets); surfxml_add_callback(STag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_endpoints); surfxml_add_callback(ETag_surfxml_route_c_multi_cb_list, &parse_route_multi_set_route); diff --git a/src/surf/surf.c b/src/surf/surf.c index 84ccf39437..a87fa278ff 100644 --- a/src/surf/surf.c +++ b/src/surf/surf.c @@ -152,10 +152,9 @@ s_surf_model_description_t surf_cpu_model_description[] = { int surf_workstation_model_description_size = 4; s_surf_model_description_t surf_workstation_model_description[] = { - {"CLM03", NULL, surf_workstation_model_init_CLM03}, - {"KCCFLN05", NULL, surf_workstation_model_init_KCCFLN05}, - {"compound", NULL, surf_workstation_model_init_compound}, - {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07} + {"CLM03", NULL, surf_workstation_model_init_CLM03, create_workstations}, + {"compound", NULL, surf_workstation_model_init_compound, NULL}, + {"ptask_L07", NULL, surf_workstation_model_init_ptask_L07, NULL} }; void update_model_description(s_surf_model_description_t * table, diff --git a/src/surf/surfxml_parse.c b/src/surf/surfxml_parse.c index 3c4d46d531..7e08deb708 100644 --- a/src/surf/surfxml_parse.c +++ b/src/surf/surfxml_parse.c @@ -887,14 +887,14 @@ static void convert_route_multi_to_routes(void) xbt_dynar_foreach(dst_names, cpt2, dst_host_name) { /* If dst is $* then set this route to have its dst point to all hosts */ if (strcmp(src_host_name,"$*") != 0 && strcmp(dst_host_name,"$*") == 0){ - xbt_dict_foreach(workstation_set, cursor_w, key_w, data_w) { + xbt_dict_foreach(cpu_set, cursor_w, key_w, data_w) { //int n = xbt_dynar_member(src_names, (char*)key_w); add_multi_links(src, dst, links, src_host_name, key_w); } } /* If src is $* then set this route to have its dst point to all hosts */ if (strcmp(src_host_name,"$*") == 0 && strcmp(dst_host_name,"$*") != 0){ - xbt_dict_foreach(workstation_set, cursor_w, key_w, data_w) { + xbt_dict_foreach(cpu_set, cursor_w, key_w, data_w) { // if (!symmetric || (symmetric && !contains(dst_names, key_w))) add_multi_links(src, dst, links, key_w, dst_host_name); } @@ -1091,3 +1091,4 @@ void add_randomness(void) random_data_t random = random_new(random_generator, random_min, random_max, random_mean, random_std_deviation); xbt_dict_set(random_data_list, random_id, (void *)random, NULL); } + diff --git a/src/surf/workstation.c b/src/surf/workstation.c index 4afd973c9e..8229535614 100644 --- a/src/surf/workstation.c +++ b/src/surf/workstation.c @@ -12,6 +12,9 @@ #include "cpu_private.h" #include "network_private.h" +XBT_LOG_NEW_DEFAULT_SUBCATEGORY(surf_workstation, surf, + "Logging specific to the SURF workstation module"); + surf_workstation_model_t surf_workstation_model = NULL; xbt_dict_t workstation_set = NULL; @@ -34,7 +37,7 @@ static void workstation_free(void *workstation) free(workstation); } -static void create_workstations(void) +void create_workstations(void) { xbt_dict_cursor_t cursor = NULL; char *name = NULL; @@ -424,7 +427,7 @@ void surf_workstation_model_init_CLM03(const char *filename) surf_workstation_model_init_internal(); surf_cpu_model_init_Cas01(filename); surf_network_model_init_CM02(filename); - create_workstations(); +// create_workstations(); update_model_description(surf_workstation_model_description, surf_workstation_model_description_size, "CLM03", -- 2.20.1