run-doj-validation-test.sh: a single script that performs validation tests for all...
[IRC.git] / Robust / src / Benchmarks / oooJava / raytracer / JGFRayTracerBench.java
1 /**************************************************************************
2  * * Java Grande Forum Benchmark Suite - Version 2.0 * * produced by * * Java
3  * Grande Benchmarking Project * * at * * Edinburgh Parallel Computing Centre *
4  * * email: epcc-javagrande@epcc.ed.ac.uk * * * This version copyright (c) The
5  * University of Edinburgh, 1999. * All rights reserved. * *
6  **************************************************************************/
7
8 public class JGFRayTracerBench extends RayTracer {
9         JGFInstrumentor instr;
10
11         public JGFRayTracerBench(JGFInstrumentor instr) {
12                 super();
13                 this.instr = instr;
14         }
15
16         public void JGFsetsize(int size) {
17                 this.size = size;
18         }
19
20         public void JGFinitialise() {
21
22 //              instr.startTimer("Section3:RayTracer:Init");
23
24                 // set image size
25 //              width = height = datasizes[size];
26                 width = datasizes[size];
27                 height = datasizes[size];
28
29                 // create the objects to be rendered
30                 scene = createScene();
31
32                 // get lights, objects etc. from scene.
33                 setScene(scene);
34
35                 numobjects = scene.getObjects();
36
37 //              instr.stopTimer("Section3:RayTracer:Init");
38
39         }
40
41         public void JGFapplication(boolean vtest) {
42
43 //              instr.startTimer("Section3:RayTracer:Run");
44
45                 // Set interval to be rendered to the whole picture
46                 // (overkill, but will be useful to retain this for parallel versions)
47                 Interval interval = new Interval(0, width, height, 0, height, 1);
48
49                 // Do the business!
50                 render(interval,vtest);
51 //              System.out.println("DONE");
52 //              instr.stopTimer("Section3:RayTracer:Run");
53
54         }
55
56         public void JGFvalidate() {
57                 // long refval[] = {2676692,29827635};
58                 long refval[] = new long[2];
59                 refval[0] = 2676692;
60                 refval[1] = 29827635;
61                 long dev = checksum - refval[size];
62                 if (dev != 0) {
63                         System.out.println("Validation failed");
64                         System.out.println("Pixel checksum = " + checksum);
65                         System.out.println("Reference value = " + refval[size]);
66                 }
67         }
68
69         public void JGFtidyup() {
70 //              scene = null;
71 //              lights = null;
72 //              prim = null;
73 //              tRay = null;
74 //              inter = null;
75
76                 // System.gc();
77         }
78
79         public void JGFrun(int size, JGFInstrumentor instr,boolean vtest) {
80
81 //              instr.addTimer("Section3:RayTracer:Total", "Solutions", size);
82 //              instr.addTimer("Section3:RayTracer:Init", "Objects", size);
83 //              instr.addTimer("Section3:RayTracer:Run", "Pixels", size);
84
85                 JGFsetsize(size);
86
87 //              instr.startTimer("Section3:RayTracer:Total");
88
89                 JGFinitialise();
90                 JGFapplication(vtest);
91 //              JGFvalidate();
92 //              JGFtidyup();
93
94 //              instr.stopTimer("Section3:RayTracer:Total");
95 //
96 //              instr.addOpsToTimer("Section3:RayTracer:Init", (double) numobjects);
97 //              instr.addOpsToTimer("Section3:RayTracer:Run",(double) (width * height));
98 //              instr.addOpsToTimer("Section3:RayTracer:Total", 1);
99 //
100 //              instr.printTimer("Section3:RayTracer:Init");
101 //              instr.printTimer("Section3:RayTracer:Run");
102 //              instr.printTimer("Section3:RayTracer:Total");
103         }
104
105 }