Home My Page Projects Code Snippets Project Openings diderot
Summary Activity Tracker Tasks SCM

SCM Repository

[diderot] Diff of /branches/vis12/src/compiler/c-target/fragments/run.in
ViewVC logotype

Diff of /branches/vis12/src/compiler/c-target/fragments/run.in

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1717, Sat Mar 10 19:44:29 2012 UTC revision 1806, Sat Apr 7 00:02:25 2012 UTC
# Line 5  Line 5 
5  uint32_t @PREFIX@Run (@PREFIX@World_t *wrld, uint32_t maxNSteps)  uint32_t @PREFIX@Run (@PREFIX@World_t *wrld, uint32_t maxNSteps)
6  {  {
7      Strand_t *strand = &(wrld->strandDesc[0]);      Strand_t *strand = &(wrld->strandDesc[0]);
8        @PREFIX@Globals_t *glob = wrld->globals;
9    
10      if (maxNSteps == 0) maxNSteps = 0xffffffff;  // essentially unlimited      if (maxNSteps == 0) maxNSteps = 0xffffffff;  // essentially unlimited
11    
12    // iterate until all strands are stable    // iterate until all strands are stable
13      if (wrld->verboseFlg) fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);      if (wrld->verboseFlg) fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);
     double t0 = airTime();  
14      uint32_t nSteps = 0, nUpdates = 0;      uint32_t nSteps = 0, nUpdates = 0;
15      uint32_t nActive = wrld->numStrands;      uint32_t nActive = wrld->numStrands;
16      while ((nActive > 0) && (nSteps <= maxNSteps)) {      while ((nActive > 0) && (nSteps <= maxNSteps)) {
# Line 20  Line 20 
20          for (int i = 0;  i < wrld->numStrands;  i++) {          for (int i = 0;  i < wrld->numStrands;  i++) {
21              if (! wrld->status[i]) {              if (! wrld->status[i]) {
22                  nUpdates++;                  nUpdates++;
23                  StrandStatus_t sts = strand->update(wrld->inState[i], wrld->outState[i]);                  StrandStatus_t sts = strand->update(glob, wrld->inState[i], wrld->outState[i]);
24                  switch (sts) {                  switch (sts) {
25                    case DIDEROT_STABILIZE:                    case DIDEROT_STABILIZE:
26                      existsStabilizing = true;                      existsStabilizing = true;
# Line 42  Line 42 
42                    // stabilize the strand's state.  Note that the outState has been set by                    // stabilize the strand's state.  Note that the outState has been set by
43                    // the last call to update, so we make the inState be the target of the                    // the last call to update, so we make the inState be the target of the
44                    // stabilize method.                    // stabilize method.
45                      strand->stabilize(wrld->outState[i], wrld->inState[i]);                      strand->stabilize(glob, wrld->outState[i], wrld->inState[i]);
46                      memcpy (wrld->outState[i], wrld->inState[i], strand->stateSzb);                      memcpy (wrld->outState[i], wrld->inState[i], strand->stateSzb);
47                      wrld->status[i] = DIDEROT_STABLE;                      wrld->status[i] = DIDEROT_STABLE;
48                      nActive--;                      nActive--;
# Line 54  Line 54 
54          wrld->inState = wrld->outState;          wrld->inState = wrld->outState;
55          wrld->outState = tmp;          wrld->outState = tmp;
56      }      }
     double totalTime = airTime() - t0;  
57    
58      return nSteps;      return nSteps;
59    

Legend:
Removed from v.1717  
changed lines
  Added in v.1806

root@smlnj-gforge.cs.uchicago.edu
ViewVC Help
Powered by ViewVC 1.0.0