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

SCM Repository

[diderot] Diff of /branches/pure-cfg/src/lib/main.c
ViewVC logotype

Diff of /branches/pure-cfg/src/lib/main.c

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

revision 623, Tue Mar 15 17:04:53 2011 UTC revision 624, Tue Mar 15 21:23:04 2011 UTC
# Line 46  Line 46 
46          for (int i = 0;  i < wrld->numStrands;  i++) {          for (int i = 0;  i < wrld->numStrands;  i++) {
47              if (wrld->isActive[i]) {              if (wrld->isActive[i]) {
48                  nUpdates++;                  nUpdates++;
49                  StrandStatus_t sts = Diderot_Strands[0].update(wrld->inState[i], wrld->outState[i]);                  StrandStatus_t sts = Diderot_Strands[0]->update(wrld->inState[i], wrld->outState[i]);
50                  if (sts == DIDEROT_STABILIZE) {                  if (sts == DIDEROT_STABILIZE) {
51                    // copy out to in so that both copies are the stable state                    // copy out to in so that both copies are the stable state
52  // FIXME: there is a race condition here, since other strands might query this strand  // FIXME: there is a race condition here, since other strands might query this strand
53                      memcpy (wrld->outState[i], wrld->inState[i], Diderot_Strands[0].stateSzb);                      memcpy (wrld->outState[i], wrld->inState[i], Diderot_Strands[0]->stateSzb);
54                      wrld->isActive[i] = false;                      wrld->isActive[i] = false;
55                      nActive--;                      nActive--;
56                  }                  }
# Line 88  Line 88 
88  }  }
89    
90  // block allocation of an initial collection of strands  // block allocation of an initial collection of strands
91  Diderot_World_t *Diderot_AllocInitially (Strand_t *strand, Diderot_Initially_t *init)  Diderot_World_t *Diderot_AllocInitially (
92        Strand_t *strand,           // the type of strands being allocated
93        bool isArray,               // is the initialization an array or collection?
94        uint32_t nDims,             // depth of iteration nesting
95        int32_t *base,              // nDims array of base indices
96        uint32_t *size)             // nDims array of iteration sizes
97  {  {
98      Diderot_World_t *wrld = (Diderot_World_t *) malloc (sizeof(Diderot_World_t));      Diderot_World_t *wrld = (Diderot_World_t *) malloc (sizeof(Diderot_World_t));
99      if (wrld == 0) {      if (wrld == 0) {
# Line 96  Line 101 
101          exit (1);          exit (1);
102      }      }
103    
104      wrld->isArray = init->isArray;      wrld->isArray = isArray;
105      wrld->nDims = init->nDims;      wrld->nDims = nDims;
106      wrld->base = (int32_t *) malloc (wrld->nDims * sizeof(int32_t));      wrld->base = (int32_t *) malloc (nDims * sizeof(int32_t));
107      wrld->size = (int32_t *) malloc (wrld->nDims * sizeof(int32_t));      wrld->size = (int32_t *) malloc (nDims * sizeof(int32_t));
108      size_t numStrands = 1;      size_t numStrands = 1;
109      for (int i = 0;  i < wrld->nDims;  i++) {      for (int i = 0;  i < wrld->nDims;  i++) {
110          numStrands *= init->size[i];          numStrands *= size[i];
111          wrld->base[i] = init->base[i];          wrld->base[i] = base[i];
112          wrld->size[i] = init->size[i];          wrld->size[i] = size[i];
113      }      }
114    
115    // allocate the strand state pointers    // allocate the strand state pointers

Legend:
Removed from v.623  
changed lines
  Added in v.624

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