start of new file
[IRC.git] / Robust / src / Benchmarks / Prefetch / Moldyn / java / JGFMolDynBenchSizeA.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 JGFMolDynBenchSizeA { 
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     mold = new JGFMolDynBench(nthreads); 
37     int size = 0;
38     JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers);
39     JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers);
40
41       mold.JGFsetsize(size); 
42
43     JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers);
44
45     JGFMolDynBench tmp;
46       mold.JGFinitialise(); 
47     JGFMolDynBench.JGFapplication(mold); 
48     /* Validate data */
49     double[] refval = new double[2];
50     refval[0] = 1731.4306625334357;
51     refval[1] = 7397.392307839352;
52     double dval;
53     //System.printString("Here #1\n");
54       dval = mold.ek[0];
55     //System.printString("Here #2\n");
56     double dev = Math.fabs(dval - refval[size]);
57     //long ldev = (long)dev * 1000000;
58     //System.printString("ldev= "+ldev);
59     //long ltmp = (long)1.0e-10 * 1000000;
60     //System.printString("ltmp= "+ltmp);
61     if (dev > 1.0e-10 ){
62     //if (ldev > ltmp ){
63       System.printString("Validation failed\n");
64       System.printString("Kinetic Energy = " + (long)dval + "  " + (long)dev + "  " + size + "\n");
65     }
66     System.printString("End of JGFvalidate\n");
67
68     JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers);
69     double interactions;
70     System.printString("Here #3\n");
71     interactions = mold.interactions;
72     System.printString("Here #4\n");
73
74     JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers);
75     JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers);
76
77     JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers); 
78     JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers); 
79   }
80 }
81