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

SCM Repository

[diderot] Annotation of /branches/vis12/src/compiler/c-target/fragments/seq-main.in
ViewVC logotype

Annotation of /branches/vis12/src/compiler/c-target/fragments/seq-main.in

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1719 - (view) (download)

1 : jhr 1719 //! Main function for sequential C target
2 :     int main (int argc, const char **argv)
3 :     {
4 :     bool timingFlg = false; //! true if timing computation
5 :     bool printOutputFlg = false; //! true if output is in text format
6 :    
7 :     // create the world
8 :     @PREFIX@World_t *wrld = @PREFIX@Init();
9 :     if (wrld == 0)
10 :     exit (1);
11 :    
12 :     // handle command-line options
13 :     Diderot_Options_t *opts = Diderot_OptNew ();
14 :     /* FIXME: register TimingFlg and NrrdOutputFlg */
15 :     Diderot_OptAddFlag (opts, "timing", "enable execution timing", &timingFlg);
16 :     Diderot_OptAddFlag (opts, "nrrd", "enable nrrd output", &printOutputFlg);
17 :     RegisterGlobalOpts (wrld, opts);
18 :     Diderot_OptProcess (opts, argc, argv);
19 :     Diderot_OptFree (opts);
20 :    
21 :     // run the generated global initialization code
22 :     if (wrld->verboseFlg)
23 :     fprintf (stderr, "initializing globals ...\n");
24 :     @PREFIX@Initially (wrld);
25 :    
26 :     if (wrld->verboseFlg)
27 :     fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);
28 :     double t0 = airTime();
29 :     uint32_t nSteps = @PREFIX@Run (wrld, 0);
30 :     double totalTime = airTime() - t0;
31 :    
32 :     if (wrld->verboseFlg)
33 :     fprintf (stderr, "done: %d updates, %d steps, in %f seconds\n", nUpdates, nSteps, totalTime);
34 :     else if (TimingFlg)
35 :     printf ("usr=%f\n", totalTime);
36 :    
37 :     // output the final strand states
38 :     if (printOutputFlg)
39 :     PrintOutput (wrld);
40 :     else
41 :     WriteOutput (wrld);
42 :    
43 :     @PREFIX@Shutdown (wrld);
44 :    
45 :     return 0;
46 :    
47 :     } // main

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