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 3117, Sun Mar 22 08:30:03 2015 UTC revision 3118, Mon Mar 23 18:05:45 2015 UTC
# Line 1  Line 1 
1  //! Main function for parallel C target  //! Main function for standalone parallel C target
2    //
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
# Line 11  Line 12 
12          exit (1);          exit (1);
13      }      }
14    
   // handle command-line options  
     {  
         Diderot_Options_t *opts = Diderot_OptNew ();  
         Diderot_uint_t np = wrld->sched->numWorkers;  
15  #ifndef DIDEROT_NO_INPUTS  #ifndef DIDEROT_NO_INPUTS
16      // initialize the default values for the inputs
17          @PREFIX@Inputs_t inputs;          @PREFIX@Inputs_t inputs;
18          InitDefaults (&inputs);          InitDefaults (&inputs);
19  #endif  #endif
20    
21      // handle command-line options
22        {
23            Diderot_Options_t *opts = Diderot_OptNew ();
24            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);
27  //      Diderot_OptAddFlag (opts, "T,text", "enable text output", &printOutputFlg);  //      Diderot_OptAddFlag (opts, "T,text", "enable text output", &printOutputFlg);
28          Diderot_OptAddUInt (opts, "n,nworkers", "specify number of worker threads", &np, true);          Diderot_OptAddUInt (opts, "n,nworkers", "specify number of worker threads", &np, true);
29  #ifndef DIDEROT_NO_INPUTS  #ifndef DIDEROT_NO_INPUTS
30          // register options for setting global inputs
31          RegisterGlobalOpts (&inputs, opts);          RegisterGlobalOpts (&inputs, opts);
32  #endif  #endif
33          RegisterOutputOpts (opts);          RegisterOutputOpts (opts);
34          Diderot_OptProcess (opts, argc, argv);          Diderot_OptProcess (opts, argc, argv);
35          Diderot_OptFree (opts);          Diderot_OptFree (opts);
36          wrld->sched->numWorkers = np;          wrld->sched->numWorkers = np;
 #ifndef DIDEROT_NO_INPUTS  
         if (InitInputs (wrld, &inputs)) {  
             fprintf(stderr, "Error initializing inputs:\n%s\n", biffMsgStrGet(wrld->errors));  
             exit(1);  
         }  
 #endif  
37      }      }
38    
39    // initialize scheduler stuff    // initialize scheduler stuff
# Line 46  Line 44 
44          exit(1);          exit(1);
45      }      }
46    
47    #ifndef DIDEROT_NO_INPUTS
48      // initialize the input globals
49        if (InitInputs (wrld, &inputs)) {
50            fprintf(stderr, "Error initializing inputs:\n%s\n", biffMsgStrGet(wrld->errors));
51            exit(1);
52        }
53    #endif
54    
55    // run the generated global initialization code    // run the generated global initialization code
56      if (wrld->verboseFlg)      if (wrld->verboseFlg)
57          fprintf (stderr, "initializing globals ...\n");          fprintf (stderr, "initializing globals ...\n");
# Line 56  Line 62 
62    
63      if (wrld->verboseFlg)      if (wrld->verboseFlg)
64          fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);          fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);
65    
66      uint32_t nSteps = @PREFIX@Run (wrld, 0);      uint32_t nSteps = @PREFIX@Run (wrld, 0);
67    
68      if (wrld->errors->errNum > 0) {      if (wrld->errors->errNum > 0) {
69          fprintf(stderr, "Error during execution:\n%s\n", biffMsgStrGet(wrld->errors));          fprintf(stderr, "Error during execution:\n%s\n", biffMsgStrGet(wrld->errors));
70          exit(1);          exit(1);

Legend:
Removed from v.3117  
changed lines
  Added in v.3118

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