Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix errors with relative includes with smpicc
[simgrid.git] / src / smpi / smpi_global.c
index 62f27d8..e242d92 100644 (file)
@@ -153,6 +153,10 @@ void smpi_global_init()
 
   smpi_global = xbt_new(s_smpi_global_t, 1);
 
+  // config vars
+  smpi_global->reference_speed =
+    xbt_cfg_get_double(_surf_cfg_set, "reference_speed");
+
   // mallocators
   smpi_global->request_mallocator =
     xbt_mallocator_new(SMPI_REQUEST_MALLOCATOR_SIZE, smpi_request_new,
@@ -309,17 +313,15 @@ smx_cond_t smpi_process_cond()
 
 static void smpi_cfg_cb_host_speed(const char *name, int pos)
 {
-  smpi_global->reference_speed =
-    xbt_cfg_get_double_at(_surf_cfg_set, name, pos);
+  if(smpi_global)
+  {
+    smpi_global->reference_speed =
+      xbt_cfg_get_double_at(_surf_cfg_set, name, pos);
+  }
 }
 
 int smpi_run_simulation(int *argc, char **argv)
 {
-  smx_action_t action = NULL;
-
-  xbt_fifo_t actions_failed = xbt_fifo_new();
-  xbt_fifo_t actions_done = xbt_fifo_new();
-
   srand(SMPI_RAND_SEED);
 
   double default_reference_speed = 20000.0;
@@ -350,21 +352,9 @@ int smpi_run_simulation(int *argc, char **argv)
   fflush(stderr);
   SIMIX_init();
 
-  while (SIMIX_solve(actions_done, actions_failed) != -1.0) {
-    while ((action = xbt_fifo_pop(actions_failed))) {
-      DEBUG1("** %s failed **", SIMIX_action_get_name(action));
-      SIMIX_action_signal_all(action);
-    }
-    while ((action = xbt_fifo_pop(actions_done))) {
-      DEBUG1("** %s done **", SIMIX_action_get_name(action));
-      SIMIX_action_signal_all(action);
-    }
-  }
-
+  while (SIMIX_solve(NULL, NULL) != -1.0);
+  
   // FIXME: cleanup incomplete
-  xbt_fifo_free(actions_failed);
-  xbt_fifo_free(actions_done);
-
 
   if (xbt_cfg_get_int(_surf_cfg_set, "display_timing"))
     INFO1("simulation time %g", SIMIX_get_clock());
@@ -374,3 +364,8 @@ int smpi_run_simulation(int *argc, char **argv)
 
   return 0;
 }
+
+int main(int argc, char** argv)
+{
+  return smpi_run_simulation(&argc, argv);
+}