Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Remove global variable, and push it into lmm_system_t.
authorArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 7 Feb 2012 20:47:23 +0000 (21:47 +0100)
committerArnaud Giersch <arnaud.giersch@iut-bm.univ-fcomte.fr>
Tue, 7 Feb 2012 21:58:20 +0000 (22:58 +0100)
And give surf_solve a chance to run correctly in parallel.

src/surf/maxmin.c
src/surf/maxmin_private.h
src/surf/network.c

index 3d32915..db76f87 100644 (file)
@@ -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);
index 4d1e379..539b677 100644 (file)
@@ -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;
 
index 0779efe..79331d0 100644 (file)
@@ -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));