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 1773 - (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 :     Diderot_OptAddFlag (opts, "timing", "enable execution timing", &timingFlg);
15 :     Diderot_OptAddFlag (opts, "nrrd", "enable nrrd output", &printOutputFlg);
16 :     RegisterGlobalOpts (wrld, opts);
17 :     Diderot_OptProcess (opts, argc, argv);
18 :     Diderot_OptFree (opts);
19 :    
20 :     // run the generated global initialization code
21 :     if (wrld->verboseFlg)
22 :     fprintf (stderr, "initializing globals ...\n");
23 :     @PREFIX@Initially (wrld);
24 :    
25 :     if (wrld->verboseFlg)
26 :     fprintf(stderr, "run with %d strands ...\n", wrld->numStrands);
27 :     double t0 = airTime();
28 :     uint32_t nSteps = @PREFIX@Run (wrld, 0);
29 :     double totalTime = airTime() - t0;
30 :    
31 :     if (wrld->verboseFlg)
32 : jhr 1773 fprintf (stderr, "done: %d steps, in %f seconds\n", nSteps, totalTime);
33 :     else if (timingFlg)
34 : jhr 1719 printf ("usr=%f\n", totalTime);
35 :    
36 :     // output the final strand states
37 :     if (printOutputFlg)
38 :     PrintOutput (wrld);
39 :     else
40 :     WriteOutput (wrld);
41 :    
42 :     @PREFIX@Shutdown (wrld);
43 :    
44 :     return 0;
45 :    
46 :     } // main

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