46ff50c2d453de9b73e364fe78d77cf0f88c2552
[IRC.git] / Robust / src / Benchmarks / Scheduling / GC / NON_BAMBOO / RayTracer / TestRunner.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 TestRunner extends RayTracer {
9
10   int numCore;
11   public int id;
12
13   public TestRunner(int id, 
14       int numCore,
15       int size,
16       Scene scene) {
17     super();
18     this.id = id;
19     this.numCore = numCore;
20     this.size = size;
21
22     // create the objects to be rendered
23     this.scene = scene; //createScene();
24
25     // set image size
26     width=size;
27     height=size;
28     // get lights, objects etc. from scene.
29     setScene(this.scene);
30
31     numobjects = this.scene.getObjects();
32     /*this.image=new int[size][];
33
34     // get lights, objects etc. from scene.
35     setScene(scene);
36
37     numobjects = scene.getObjects();*/
38   }
39
40   public void init() {
41     this.image=new int[this.size/this.numCore][];
42   }
43
44   public void JGFvalidate() {
45     // long refval[] = {2676692,29827635};
46     //  long refval[] = new long[2];
47     //  refval[0] = 2676692;
48     //  refval[1] = 29827635;
49     //  long dev = checksum - refval[size];
50     //  if (dev != 0) {
51     //  System.out.println("Validation failed");
52     //  System.out.println("Pixel checksum = " + checksum);
53     //  System.out.println("Reference value = " + refval[size]);
54     //  }
55   }
56
57   public void JGFtidyup() {
58     //  scene = null;
59     //  lights = null;
60     //  prim = null;
61     //  tRay = null;
62     //  inter = null;
63     // System.gc();
64   }
65
66   public void run() {
67     this.init();
68
69     int heightPerCore=height/numCore;
70     int startidx=heightPerCore * this.id;
71     int endidx=startidx + heightPerCore;
72     Interval interval = new Interval(0, width, height, startidx, endidx, 1);
73     render(interval);
74
75     //System.out.println("CHECKSUM="+checksum);
76
77   }
78   public static void main(String[] args) {
79     int threadnum = 62; // 56;
80     int size = threadnum * 25;
81     Composer comp = new Composer(threadnum, size);
82     RayTracer rt = new RayTracer();
83     Scene scene = rt.createScene();
84     for(int i = 0; i < threadnum; ++i) {
85       TestRunner tr = new TestRunner(i, threadnum, size, scene);
86       tr.run();
87       if(comp.compose(tr)) {
88         long r = comp.result;
89       }
90     }
91   }
92 }