Ported over bamboo benchmarks for use as non-Bamboo java benchmarks.
[IRC.git] / Robust / src / Benchmarks / Scheduling / GC / NON_BAMBOO / RayTracer / TestRunner.java
diff --git a/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/TestRunner.java b/Robust/src/Benchmarks/Scheduling/GC/NON_BAMBOO/RayTracer/TestRunner.java
new file mode 100644 (file)
index 0000000..46ff50c
--- /dev/null
@@ -0,0 +1,92 @@
+/**************************************************************************
+ * * Java Grande Forum Benchmark Suite - Version 2.0 * * produced by * * Java
+ * Grande Benchmarking Project * * at * * Edinburgh Parallel Computing Centre *
+ * * email: epcc-javagrande@epcc.ed.ac.uk * * * This version copyright (c) The
+ * University of Edinburgh, 1999. * All rights reserved. * *
+ **************************************************************************/
+
+public class TestRunner extends RayTracer {
+
+  int numCore;
+  public int id;
+
+  public TestRunner(int id, 
+      int numCore,
+      int size,
+      Scene scene) {
+    super();
+    this.id = id;
+    this.numCore = numCore;
+    this.size = size;
+
+    // create the objects to be rendered
+    this.scene = scene; //createScene();
+
+    // set image size
+    width=size;
+    height=size;
+    // get lights, objects etc. from scene.
+    setScene(this.scene);
+
+    numobjects = this.scene.getObjects();
+    /*this.image=new int[size][];
+
+    // get lights, objects etc. from scene.
+    setScene(scene);
+
+    numobjects = scene.getObjects();*/
+  }
+
+  public void init() {
+    this.image=new int[this.size/this.numCore][];
+  }
+
+  public void JGFvalidate() {
+    // long refval[] = {2676692,29827635};
+    //  long refval[] = new long[2];
+    //  refval[0] = 2676692;
+    //  refval[1] = 29827635;
+    //  long dev = checksum - refval[size];
+    //  if (dev != 0) {
+    //  System.out.println("Validation failed");
+    //  System.out.println("Pixel checksum = " + checksum);
+    //  System.out.println("Reference value = " + refval[size]);
+    //  }
+  }
+
+  public void JGFtidyup() {
+    //  scene = null;
+    //  lights = null;
+    //  prim = null;
+    //  tRay = null;
+    //  inter = null;
+    // System.gc();
+  }
+
+  public void run() {
+    this.init();
+
+    int heightPerCore=height/numCore;
+    int startidx=heightPerCore * this.id;
+    int endidx=startidx + heightPerCore;
+    Interval interval = new Interval(0, width, height, startidx, endidx, 1);
+    render(interval);
+
+    //System.out.println("CHECKSUM="+checksum);
+
+  }
+  public static void main(String[] args) {
+    int threadnum = 62; // 56;
+    int size = threadnum * 25;
+    Composer comp = new Composer(threadnum, size);
+    RayTracer rt = new RayTracer();
+    Scene scene = rt.createScene();
+    for(int i = 0; i < threadnum; ++i) {
+      TestRunner tr = new TestRunner(i, threadnum, size, scene);
+      tr.run();
+      if(comp.compose(tr)) {
+        long r = comp.result;
+      }
+    }
+  }
+}