Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix initialization order.
[simgrid.git] / src / simix / smx_global.c
index bfed0ba..e1f793e 100644 (file)
@@ -109,6 +109,7 @@ void SIMIX_global_init(int *argc, char **argv)
   }
 
   SIMIX_HOST_LEVEL = xbt_lib_add_level(host_lib,SIMIX_host_destroy);
+  SIMIX_STORAGE_LEVEL = xbt_lib_add_level(storage_lib, SIMIX_storage_destroy);
 
   if (sg_cfg_get_boolean("clean_atexit"))
     atexit(SIMIX_clean);
@@ -125,9 +126,6 @@ void SIMIX_global_init(int *argc, char **argv)
  */
 static void SIMIX_clean(void)
 {
-#ifdef HAVE_TRACING
-  TRACE_end();
-#endif
 #ifdef TIME_BENCH_PER_SR
   smx_ctx_raw_new_sr();
 #endif
@@ -166,7 +164,7 @@ static void SIMIX_clean(void)
 
 #ifdef TIME_BENCH_AMDAHL
   xbt_os_cputimer_stop(simix_global->timer_seq);
-  XBT_INFO("Amdahl timing informations. Sequential time: %lf; Parallel time: %lf",
+  XBT_INFO("Amdahl timing informations. Sequential time: %f; Parallel time: %f",
            xbt_os_timer_elapsed(simix_global->timer_seq),
            xbt_os_timer_elapsed(simix_global->timer_par));
   xbt_os_timer_free(simix_global->timer_seq);
@@ -326,14 +324,20 @@ void SIMIX_run(void)
          ((void (*)(void*))timer->func)(timer->args);
        xbt_free(timer);
     }
+
     /* Wake up all processes waiting for a Surf action to finish */
     xbt_dynar_foreach(model_list, iter, model) {
-      set = model->states.failed_action_set;
+      set = surf_model_failed_action_set(model);
       while ((action = xbt_swag_extract(set)))
-        SIMIX_simcall_post((smx_action_t) action->data);
-      set = model->states.done_action_set;
-      while ((action = xbt_swag_extract(set)))
-        SIMIX_simcall_post((smx_action_t) action->data);
+
+      SIMIX_simcall_post((smx_action_t) surf_action_get_data(action));
+      set = surf_model_done_action_set(model);
+
+      while ((action = xbt_swag_extract(set))) 
+        if (surf_action_get_data(action) == NULL)
+          XBT_DEBUG("probably vcpu's action %p, skip", action);
+        else
+          SIMIX_simcall_post((smx_action_t) surf_action_get_data(action));
     }
 
     /* Autorestart all process */
@@ -349,6 +353,11 @@ void SIMIX_run(void)
     /* Clean processes to destroy */
     SIMIX_process_empty_trash();
 
+
+    XBT_DEBUG("### time %f, empty %d", time, xbt_dynar_is_empty(simix_global->process_to_run));
+    // !(time == -1.0 && xbt_dynar_is_empty()) 
+
+
   } while (time != -1.0 || !xbt_dynar_is_empty(simix_global->process_to_run));
 
   if (xbt_swag_size(simix_global->process_list) != 0) {
@@ -357,7 +366,7 @@ void SIMIX_run(void)
     TRACE_end();
 #endif
 
-    XBT_WARN("Oops ! Deadlock or code not perfectly clean.");
+    XBT_CRITICAL("Oops ! Deadlock or code not perfectly clean.");
     SIMIX_display_process_status();
     xbt_abort();
   }