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

SCM Repository

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

Diff of /branches/vis12-cl/src/compiler/c-target/fragments/par-main.in

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

revision 3177, Mon Mar 30 12:20:18 2015 UTC revision 3178, Mon Mar 30 15:18:21 2015 UTC
# Line 3  Line 3 
3  int main (int argc, const char **argv)  int main (int argc, const char **argv)
4  {  {
5      bool        timingFlg = false;      //! true if timing computation      bool        timingFlg = false;      //! true if timing computation
6      bool        printOutputFlg = false; //! true if output is in text format      uint32_t    stepLimit = 0;          //! limit on number of execution steps (0 means unlimited)
7    
8    // create the world    // create the world
9      @PREFIX@World_t *wrld = @PREFIX@New();      @PREFIX@World_t *wrld = @PREFIX@New();
# Line 24  Line 24 
24          Diderot_uint_t np = wrld->sched->numWorkers;          Diderot_uint_t np = wrld->sched->numWorkers;
25          Diderot_OptAddFlag (opts, "v,verbose", "enable runtime-system messages", &(wrld->verboseFlg));          Diderot_OptAddFlag (opts, "v,verbose", "enable runtime-system messages", &(wrld->verboseFlg));
26          Diderot_OptAddFlag (opts, "t,timing", "enable execution timing", &timingFlg);          Diderot_OptAddFlag (opts, "t,timing", "enable execution timing", &timingFlg);
 //      Diderot_OptAddFlag (opts, "T,text", "enable text output", &printOutputFlg);  
27          Diderot_OptAddUInt (opts, "n,nworkers", "specify number of worker threads", &np, true);          Diderot_OptAddUInt (opts, "n,nworkers", "specify number of worker threads", &np, true);
28            Diderot_OptAddUInt (opts, "l,limit", "specify limit on number of super-steps (0 means unlimited)",
29                &stepLimit, true);
30  #ifndef DIDEROT_NO_INPUTS  #ifndef DIDEROT_NO_INPUTS
31        // register options for setting global inputs        // register options for setting global inputs
32          RegisterGlobalOpts (&inputs, opts);          RegisterGlobalOpts (&inputs, opts);
# Line 63  Line 64 
64      if (wrld->verboseFlg)      if (wrld->verboseFlg)
65          fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);          fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);
66    
67      uint32_t nSteps = @PREFIX@Run (wrld, 0);      uint32_t nSteps = @PREFIX@Run (wrld, stepLimit);
68    
69      if (wrld->errors->errNum > 0) {      if (wrld->errors->errNum > 0) {
70          fprintf(stderr, "Error during execution:\n%s\n", biffMsgStrGet(wrld->errors));          fprintf(stderr, "Error during execution:\n%s\n", biffMsgStrGet(wrld->errors));
# Line 76  Line 77 
77          printf ("usr=%f\n", wrld->runTime);          printf ("usr=%f\n", wrld->runTime);
78    
79    // output the final strand states    // output the final strand states
     if (printOutputFlg)  
         PrintOutput (wrld);  
     else  
80          WriteOutput (wrld);          WriteOutput (wrld);
81    
82      @PREFIX@Shutdown (wrld);      @PREFIX@Shutdown (wrld);

Legend:
Removed from v.3177  
changed lines
  Added in v.3178

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