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

SCM Repository

[diderot] Diff of /branches/vis15/src/compiler/target-cpu/fragments/par-main.in
ViewVC logotype

Diff of /branches/vis15/src/compiler/target-cpu/fragments/par-main.in

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

revision 3915, Fri May 27 21:32:46 2016 UTC revision 3916, Sat May 28 12:01:02 2016 UTC
# Line 6  Line 6 
6      uint32_t    stepLimit = 0;          //! limit on number of execution steps (0 means unlimited)      uint32_t    stepLimit = 0;          //! limit on number of execution steps (0 means unlimited)
7    
8    // create the world    // create the world
9      world *wrld = new (nothrow) world();      world *wrld = new (std::nothrow) world();
10      if (wrld == nullptr) {      if (wrld == nullptr) {
11          std::cerr << "unable to create world" << std::endl          std::cerr << "unable to create world" << std::endl;
12          exit (1);          exit (1);
13      }      }
14    
# Line 20  Line 20 
20    
21    // handle command-line options    // handle command-line options
22      {      {
23          diderot::options *opts = new diderot::options ();          diderot::options<@REALTY@,@INTTY@> *opts = new diderot::options<@REALTY@,@INTTY@> ();
24          uint32_t np = wrld->_sched->numWorkers;          uint32_t np = wrld->_sched->numWorkers;
25          options->addFlag ("v,verbose", "enable runtime-system messages", &(wrld->verboseFlg));          opts->addFlag ("v,verbose", "enable runtime-system messages", &(wrld->_verbose));
26          options->addFlag ("t,timing", "enable execution timing", &timingFlg);          opts->addFlag ("t,timing", "enable execution timing", &timingFlg);
27          options->add ("n,nworkers", "specify number of worker threads", &np, true);          opts->add ("n,nworkers", "specify number of worker threads", &np, true);
28          options->add ("l,limit", "specify limit on number of super-steps (0 means unlimited)",          opts->add ("l,limit", "specify limit on number of super-steps (0 means unlimited)",
29              &stepLimit, true);              &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          register_inputs (&inputs, opts);          register_inputs (&inputs, opts);
33  #endif  #endif
34          register_outputs (opts);          register_outputs (opts);
35          options->process (opts, argc, argv);          opts->process (argc, argv);
36          delete options ();          delete opts;
37          wrld->_sched->numWorkers = np;          wrld->_sched->numWorkers = np;
38      }      }
39    
40    // initialize scheduler stuff    // initialize scheduler stuff
41      if (wrld->_verboseFlg) {      if (wrld->_verbose) {
42          std::cerr << "initializing world ..." << std::endl;          std::cerr << "initializing world ..." << std::endl;
43      }      }
44      if (wrld->init()) {      if (wrld->init()) {
# Line 48  Line 48 
48    
49  #ifndef DIDEROT_NO_INPUTS  #ifndef DIDEROT_NO_INPUTS
50    // initialize the input globals    // initialize the input globals
51      if (InitInputs (wrld, &inputs)) {      if (init_inputs (wrld, &inputs)) {
52          std::cerr << "Error initializing inputs:\n" << biffMsgStrGet(wrld->_errors) << std::endl;          std::cerr << "Error initializing inputs:\n" << biffMsgStrGet(wrld->_errors) << std::endl;
53          exit(1);          exit(1);
54      }      }
55  #endif  #endif
56    
57    // run the generated global initialization code    // run the generated global initialization code
58      if (wrld->verboseFlg) {      if (wrld->_verbose) {
59          std::cerr << "initializing globals ...\n");          std::cerr << "initializing globals ...\n");
60      }      }
61      if (@PREFIX@Initially (wrld)) {      if (initially (wrld)) {
62          std::cerr << "Error in global initialization:\n%s\n"          std::cerr << "Error in global initialization:\n%s\n"
63              << biffMsgStrGet(wrld->_errors) << std::endl;              << biffMsgStrGet(wrld->_errors) << std::endl;
64          exit(1);          exit(1);
65      }      }
66    
67      if (wrld->verboseFlg) {      if (wrld->_verbose) {
68          std::cerr << "run with " << wrld->numStrands << " strands ..." << std::endl;          std::cerr << "run with " << wrld->numStrands << " strands ..." << std::endl;
69      }      }
70    
71      uint32_t nSteps = @PREFIX@Run (wrld, stepLimit);      uint32_t nSteps = @PREFIX@run (wrld, stepLimit);
72    
73      if (wrld->errors->errNum > 0) {      if (wrld->_errors->errNum > 0) {
74          std::cerr << "Error during execution:\n%s\n" << biffMsgStrGet(wrld->errors));          std::cerr << "Error during execution:\n%s\n" << biffMsgStrGet(wrld->_errors));
75          exit(1);          exit(1);
76      }      }
77    
78      if (wrld->verboseFlg) {      if (wrld->_verbose) {
79          std::cerr << "done: " << nSteps << " steps, in " << wrld->_runTime << " seconds" << std::endl);          std::cerr << "done: " << nSteps << " steps, in " << wrld->_run_time << " seconds" << std::endl);
80      }      }
81      else if (timingFlg) {      else if (timingFlg) {
82          std::cout << "usr=" << world->_runTime << std::endl;          std::cout << "usr=" << world->_run_time << std::endl;
83      }      }
84    
85    // output the final strand states    // output the final strand states

Legend:
Removed from v.3915  
changed lines
  Added in v.3916

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