From: Arnaud Giersch Date: Tue, 7 Feb 2012 20:47:23 +0000 (+0100) Subject: Remove global variable, and push it into lmm_system_t. X-Git-Tag: exp_20120216~47^2~1 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/0144cea50dd27aaef619a851cbebd0fe7363fb9d Remove global variable, and push it into lmm_system_t. And give surf_solve a chance to run correctly in parallel. --- diff --git a/src/surf/maxmin.c b/src/surf/maxmin.c index 3d329156f4..db76f87db8 100644 --- a/src/surf/maxmin.c +++ b/src/surf/maxmin.c @@ -25,7 +25,6 @@ static void lmm_update_modified_set(lmm_system_t sys, static void lmm_remove_all_modified_set(lmm_system_t sys); static int Global_debug_id = 1; static int Global_const_debug_id = 1; -extern xbt_swag_t keep_track; lmm_system_t lmm_system_new(int selective_update) { @@ -552,9 +551,8 @@ void lmm_solve(lmm_system_t sys) cnst->usage = elem->value / elem->variable->weight; make_elem_active(elem); - if(keep_track){ - xbt_swag_insert((elem->variable)->id, keep_track); - } + if (sys->keep_track) + xbt_swag_insert(elem->variable->id, sys->keep_track); } } XBT_DEBUG("Constraint Usage '%d' : %f", cnst->id_int, cnst->usage); diff --git a/src/surf/maxmin_private.h b/src/surf/maxmin_private.h index 4d1e379107..539b67714a 100644 --- a/src/surf/maxmin_private.h +++ b/src/surf/maxmin_private.h @@ -78,6 +78,8 @@ typedef struct lmm_system { s_xbt_swag_t saturated_variable_set; /* a list of lmm_variable_t */ s_xbt_swag_t saturated_constraint_set; /* a list of lmm_constraint_t_t */ + xbt_swag_t keep_track; + xbt_mallocator_t variable_mallocator; } s_lmm_system_t; diff --git a/src/surf/network.c b/src/surf/network.c index 0779efeadf..79331d035e 100644 --- a/src/surf/network.c +++ b/src/surf/network.c @@ -60,7 +60,6 @@ static void update_action_remaining(double now); static xbt_swag_t net_modified_set = NULL; static xbt_heap_t net_action_heap = NULL; -xbt_swag_t keep_track = NULL; /* added to manage the communication action's heap */ static void net_action_update_index_heap(void *action, int i) @@ -465,9 +464,9 @@ static double net_share_resources_lazy(double now) XBT_DEBUG("Before share resources, the size of modified actions set is %d", xbt_swag_size(net_modified_set)); update_action_remaining(now); - keep_track = net_modified_set; + network_maxmin_system->keep_track = net_modified_set; lmm_solve(network_maxmin_system); - keep_track = NULL; + network_maxmin_system->keep_track = NULL; XBT_DEBUG("After share resources, The size of modified actions set is %d", xbt_swag_size(net_modified_set));