Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Move test of finish execution to after handling events.
authordonassbr <donassbr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Sep 2009 08:51:34 +0000 (08:51 +0000)
committerdonassbr <donassbr@48e7efb5-ca39-0410-a469-dd3cf9ba447f>
Tue, 1 Sep 2009 08:51:34 +0000 (08:51 +0000)
git-svn-id: svn+ssh://scm.gforge.inria.fr/svn/simgrid/simgrid/trunk@6644 48e7efb5-ca39-0410-a469-dd3cf9ba447f

src/surf/surf.c

index 7dba882..20f24c4 100644 (file)
@@ -384,13 +384,10 @@ double surf_solve(void)
   }
   DEBUG1("Next action end : %f", min);
 
   }
   DEBUG1("Next action end : %f", min);
 
-  if (min < 0.0)
-    return -1.0;
-
   DEBUG0("Looking for next event");
   while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
     DEBUG1("Next TRACE event : %f", next_event_date);
   DEBUG0("Looking for next event");
   while ((next_event_date = tmgr_history_next_date(history)) != -1.0) {
     DEBUG1("Next TRACE event : %f", next_event_date);
-    if (next_event_date > NOW + min)
+    if ((min != -1.0) && (next_event_date > NOW + min))
       break;
     DEBUG0("Updating models");
     while ((event =
       break;
     DEBUG0("Updating models");
     while ((event =
@@ -410,6 +407,12 @@ double surf_solve(void)
     }
   }
 
     }
   }
 
+  /* FIXME: Moved this test to here to avoid stoping simulation if there are actions running on cpus and all cpus are with availability = 0. 
+   * This may cause an infinite loop if one cpu has a trace with periodicity = 0 and the other a trace with periodicity > 0.
+   * The options are: all traces with same periodicity(0 or >0) or we need to change the way how the events are managed */
+  if (min < 0.0)
+    return -1.0;
+
   DEBUG1("Duration set to %f", min);
 
   NOW = NOW + min;
   DEBUG1("Duration set to %f", min);
 
   NOW = NOW + min;