From: Augustin Degomme Date: Tue, 24 Sep 2013 11:36:37 +0000 (+0200) Subject: Power state list was shared between hosts of a cabinet (but not for cluster) X-Git-Tag: v3_9_90~101 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/d7c8447cfe6ab5412697230d54f483d92e297074?ds=sidebyside Power state list was shared between hosts of a cabinet (but not for cluster) This lead to issues when trying to free the memory at the end. Either we had to implement a reference counter to dynars, or have one copy for each host. As it was already done for clusters, let's do it the second way. --- diff --git a/src/surf/cpu_cas01.c b/src/surf/cpu_cas01.c index 9090cb437d..04d91eaa0e 100644 --- a/src/surf/cpu_cas01.c +++ b/src/surf/cpu_cas01.c @@ -24,7 +24,7 @@ static xbt_swag_t /* Additionnal callback function to cleanup some data, called from surf_resource_free */ -static void cpu_cas1_cleanup(void* r){ +static void cpu_cas01_cleanup(void* r){ cpu_Cas01_t cpu = (cpu_Cas01_t)r; unsigned int iter; xbt_dynar_t power_tuple = NULL; @@ -53,7 +53,7 @@ static void *cpu_create_resource(const char *name, xbt_dynar_t power_peak, name); cpu = (cpu_Cas01_t) surf_resource_new(sizeof(s_cpu_Cas01_t), surf_cpu_model, name, - cpu_properties, &cpu_cas1_cleanup); + cpu_properties, &cpu_cas01_cleanup); cpu->power_peak = xbt_dynar_get_as(power_peak, pstate, double); cpu->power_peak_list = power_peak; cpu->pstate = pstate; diff --git a/src/surf/surf_routing.c b/src/surf/surf_routing.c index 53a519b376..ae8e115f5a 100644 --- a/src/surf/surf_routing.c +++ b/src/surf/surf_routing.c @@ -746,9 +746,6 @@ static void routing_parse_cabinet(sg_platf_cabinet_cbarg_t cabinet) s_sg_platf_host_cbarg_t host; memset(&host, 0, sizeof(host)); host.initial_state = SURF_RESOURCE_ON; - xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL); - xbt_dynar_push(power_state_list,&cabinet->power); - host.power_peak = power_state_list; host.pstate = 0; host.power_scale = 1.0; host.core_amount = 1; @@ -768,6 +765,9 @@ static void routing_parse_cabinet(sg_platf_cabinet_cbarg_t cabinet) link_id = bprintf("link_%s%d%s",cabinet->prefix,i,cabinet->suffix); host.id = host_id; link.id = link_id; + xbt_dynar_t power_state_list = xbt_dynar_new(sizeof(double), NULL); + xbt_dynar_push(power_state_list,&cabinet->power); + host.power_peak = power_state_list; sg_platf_new_host(&host); sg_platf_new_link(&link);