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

SCM Repository

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

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

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

revision 1261, Sat May 28 23:16:30 2011 UTC revision 1262, Sat May 28 23:45:43 2011 UTC
# Line 13  Line 13 
13  #include <assert.h>  #include <assert.h>
14  #include <Diderot/diderot.h>  #include <Diderot/diderot.h>
15    
16    // NOTE: we probably should put this in a file that supports runtime printing
17    static bool     VerboseFlg = false;
18    
19  struct struct_world {  struct struct_world {
20      bool                isArray;        // is the initialization an array or collection?      bool                isArray;        // is the initialization an array or collection?
21      uint32_t            nDims;          // depth of iteration nesting      uint32_t            nDims;          // depth of iteration nesting
# Line 28  Line 31 
31    
32  int main (int argc, const char **argv)  int main (int argc, const char **argv)
33  {  {
34    //      Diderot_Options_t *opts = Diderot_OptNew ();
35  printf("initializing globals ...\n");  
36      Diderot_InitGlobals (argc, argv);      Diderot_OptAddFlag (opts, "verbose", "", &VerboseFlg);
37        Diderot_RegisterGlobalOpts (opts);
38        Diderot_OptProcess (opts, argc, argv);
39        Diderot_OptFree (opts);
40    
41      // run the generated global initialization code
42    if (VerboseFlg) printf("initializing globals ...\n");
43        Diderot_InitGlobals ();
44    
45    // FIXME: we need to figure out how initialization should be handled.    // FIXME: we need to figure out how initialization should be handled.
46  printf("initializing strands ...\n");  if (VerboseFlg) printf("initializing strands ...\n");
47      Diderot_World_t *wrld = Diderot_Initially ();      Diderot_World_t *wrld = Diderot_Initially ();
48      for (int i = 0;  i < wrld->numStrands;  i++) {      for (int i = 0;  i < wrld->numStrands;  i++) {
49        // hack to make the invariant part of the state the same in both copies        // hack to make the invariant part of the state the same in both copies
# Line 41  Line 51 
51      }      }
52    
53    // iterate until all strands are stable    // iterate until all strands are stable
54  printf("run with %d strands ...\n", wrld->numStrands);  if (VerboseFlg) printf("run with %d strands ...\n", wrld->numStrands);
55      int nSteps = 0, nUpdates = 0;      int nSteps = 0, nUpdates = 0;
56      int nActive = wrld->numStrands;      int nActive = wrld->numStrands;
57      while (nActive > 0) {      while (nActive > 0) {
# Line 83  Line 93 
93          wrld->outState = tmp;          wrld->outState = tmp;
94      }      }
95    
96  printf("done: %d updates, %d steps\n", nUpdates, nSteps);  if (VerboseFlg) printf("done: %d updates, %d steps\n", nUpdates, nSteps);
97    // here we have the final state of all of the strands in the "in" buffer    // here we have the final state of all of the strands in the "in" buffer
98      FILE *outS = fopen("mip.txt", "w");      FILE *outS = fopen("mip.txt", "w");
99      if (outS == NULL) {      if (outS == NULL) {
# Line 135  Line 145 
145          wrld->size[i] = size[i];          wrld->size[i] = size[i];
146      }      }
147    
148    if (VerboseFlg) {
149  printf("AllocInitially: %d", size[0]);  printf("AllocInitially: %d", size[0]);
150  for (int i = 1;  i < nDims;  i++) printf(" x %d", size[i]);  for (int i = 1;  i < nDims;  i++) printf(" x %d", size[i]);
151  printf("\n");  printf("\n");
152    }
153    
154    // allocate the strand state pointers    // allocate the strand state pointers
155      wrld->numStrands = numStrands;      wrld->numStrands = numStrands;

Legend:
Removed from v.1261  
changed lines
  Added in v.1262

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