04a0afccac5f7d7d037dadb685f7803d16e3480a
[IRC.git] / Robust / src / Benchmarks / Prefetch / Moldyn / dsm / JGFMolDynBenchSizeC.java
1 /**************************************************************************
2  *                                                                         *
3  *         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
4  *                                                                         *
5  *                            produced by                                  *
6  *                                                                         *
7  *                  Java Grande Benchmarking Project                       *
8  *                                                                         *
9  *                                at                                       *
10  *                                                                         *
11  *                Edinburgh Parallel Computing Centre                      *
12  *                                                                         * 
13  *                email: epcc-javagrande@epcc.ed.ac.uk                     *
14  *                                                                         *
15  *                                                                         *
16  *      This version copyright (c) The University of Edinburgh, 2001.      *
17  *                         All rights reserved.                            *
18  *                                                                         *
19  **************************************************************************/
20 public class JGFMolDynBenchSizeC { 
21
22     public static void main(String argv[]){
23     int nthreads;
24     if(argv.length != 0 ) {
25       nthreads = Integer.parseInt(argv[0]);
26     } else {
27       System.printString("The no of threads has not been specified, defaulting to 1\n");
28       System.printString("  " + "\n");
29       nthreads = 1;
30     }
31
32     JGFInstrumentor instr = new JGFInstrumentor();
33     JGFInstrumentor.printHeader(3,0,nthreads);
34
35     JGFMolDynBench mold;
36     atomic {
37       mold = global new JGFMolDynBench(nthreads); 
38     }
39     int size = 2;
40     JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers);
41     JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers);
42
43     atomic {
44       mold.JGFsetsize(size); 
45     }
46
47     JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers);
48
49     JGFMolDynBench tmp;
50     atomic {
51       mold.JGFinitialise(); 
52     }
53     JGFMolDynBench.JGFapplication(mold); 
54
55     /* Validate data */
56     /*
57     double[] refval = new double[2];
58     refval[0] = 1731.4306625334357;
59     refval[1] = 7397.392307839352;
60     double dval;
61     atomic {
62       dval = mold.ek[0].d;
63     }
64     double dev = Math.fabs(dval - refval[size]);
65     long l = (long) refval[size] *1000000;
66     long r = (long) dval * 1000000;
67     if (l != r ){
68       System.printString("Validation failed\n");
69       System.printString("Kinetic Energy = " + (long)dval + "  " + (long)dev + "  " + size + "\n");
70     }
71
72     JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers);
73     double interactions;
74     atomic {
75       interactions = mold.interactions;
76     }
77
78     JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers);
79     JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers);
80
81     JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers); 
82     JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers); 
83     */
84     System.printString("Finished\n");
85   }
86 }
87