some benchmarks for scheduling
authorjzhou <jzhou>
Sun, 3 Aug 2008 16:43:39 +0000 (16:43 +0000)
committerjzhou <jzhou>
Sun, 3 Aug 2008 16:43:39 +0000 (16:43 +0000)
14 files changed:
Robust/src/Benchmarks/PERT/Mcore/Estimator.java
Robust/src/Benchmarks/PERT/Mcore/PERT.java
Robust/src/Benchmarks/PERT/Mcore/Stage.java
Robust/src/Benchmarks/Scheduling/JGFSeries/JGFSeriesBench.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/JGFSeries/SeriesRunner.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/JGFSeries/c/JGFSeriesBench.c [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/JGFSeries/c/Makefile [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/MapReduce/MapReduce.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/MapReduce/MapReduceBase.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/MapReduce/MapWorker.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/MapReduce/Master.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/MapReduce/OutputCollector.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/MapReduce/ReduceWorker.java [new file with mode: 0644]
Robust/src/Benchmarks/Scheduling/MapReduce/Splitter.java [new file with mode: 0644]

index a2232dc914a230bd31fab24ff2043bfb5293b53a..2539ae6fdad0deaac67ec2d29e9e6f1876d89320 100644 (file)
@@ -4,70 +4,70 @@ public class Estimator {
 
     int stages;
     int time;
-    double variance;
-    double[] probtable;
+    float variance;
+    float[] probtable;
 
     public Estimator(int stages) {
        this.stages = stages;
        this.time = 0;
        this.variance = 0;
 
-       this.probtable = new double[31];
+       this.probtable = new float[31];
        int i = 0;
-       this.probtable[i++] = 0.5000;
-       this.probtable[i++] = 0.5398;
-       this.probtable[i++] = 0.5793;
-       this.probtable[i++] = 0.6179;
-       this.probtable[i++] = 0.6554;
-       this.probtable[i++] = 0.6915;
-       this.probtable[i++] = 0.7257;
-       this.probtable[i++] = 0.7580;
-       this.probtable[i++] = 0.7881;
-       this.probtable[i++] = 0.8159;
-       this.probtable[i++] = 0.8413;
-       this.probtable[i++] = 0.8643;
-       this.probtable[i++] = 0.8849;
-       this.probtable[i++] = 0.9032;
-       this.probtable[i++] = 0.9192;
-       this.probtable[i++] = 0.9332;
-       this.probtable[i++] = 0.9452;
-       this.probtable[i++] = 0.9554;
-       this.probtable[i++] = 0.9641;
-       this.probtable[i++] = 0.9713;
-       this.probtable[i++] = 0.9772;
-       this.probtable[i++] = 0.9821;
-       this.probtable[i++] = 0.9861;
-       this.probtable[i++] = 0.9893;
-       this.probtable[i++] = 0.9918;
-       this.probtable[i++] = 0.9938;
-       this.probtable[i++] = 0.9953;
-       this.probtable[i++] = 0.9965;
-       this.probtable[i++] = 0.9974;
-       this.probtable[i++] = 0.9981;
-       this.probtable[i++] = 0.9987;
+       this.probtable[i++] = (float)0.5000;
+       this.probtable[i++] = (float)0.5398;
+       this.probtable[i++] = (float)0.5793;
+       this.probtable[i++] = (float)0.6179;
+       this.probtable[i++] = (float)0.6554;
+       this.probtable[i++] = (float)0.6915;
+       this.probtable[i++] = (float)0.7257;
+       this.probtable[i++] = (float)0.7580;
+       this.probtable[i++] = (float)0.7881;
+       this.probtable[i++] = (float)0.8159;
+       this.probtable[i++] = (float)0.8413;
+       this.probtable[i++] = (float)0.8643;
+       this.probtable[i++] = (float)0.8849;
+       this.probtable[i++] = (float)0.9032;
+       this.probtable[i++] = (float)0.9192;
+       this.probtable[i++] = (float)0.9332;
+       this.probtable[i++] = (float)0.9452;
+       this.probtable[i++] = (float)0.9554;
+       this.probtable[i++] = (float)0.9641;
+       this.probtable[i++] = (float)0.9713;
+       this.probtable[i++] = (float)0.9772;
+       this.probtable[i++] = (float)0.9821;
+       this.probtable[i++] = (float)0.9861;
+       this.probtable[i++] = (float)0.9893;
+       this.probtable[i++] = (float)0.9918;
+       this.probtable[i++] = (float)0.9938;
+       this.probtable[i++] = (float)0.9953;
+       this.probtable[i++] = (float)0.9965;
+       this.probtable[i++] = (float)0.9974;
+       this.probtable[i++] = (float)0.9981;
+       this.probtable[i++] = (float)0.9987;
     }
 
-    public boolean estimate(int time, double variance2) {
-       System.printI(0xff30);
+    public boolean estimate(int time, float variance2) {
+       //System.printI(0xff30);
        this.time += time;
        this.variance += variance2;
        --this.stages;
-       System.printI(0xff31);
-       System.printI(this.stages);
-       System.printI(this.time);
-       System.printI((int)this.variance);
+       //System.printI(0xff31);
+       //System.printI(this.stages);
+       //System.printI(this.time);
+       //System.printI((int)this.variance);
        if(this.stages == 0) {
-               System.printI(0xff32);
+           //System.printI(0xff32);
            //System.printString("variance2: " + (int)(this.variance*100) + "(/100); ");
-           this.variance = Math.sqrt(this.variance);
+           this.variance = Math.sqrtf(this.variance);
            //System.printString("variance: " + (int)(this.variance*100) + "(/100)\n");
            return true;
        }
-       System.printI(0xff33);
+       //System.printI(0xff33);
        return false;
     }
 
-    public double getProbability(int x, int y) {
+    public float getProbability(int x, int y) {
        int l = x;
        int r = y;
        if(x > y) {
@@ -75,22 +75,22 @@ public class Estimator {
            r = x;
        }
 
-       double prob = prob(r) - prob(l);
+       float prob = prob(r) - prob(l);
        return prob;
     }
 
-    private double prob(int s) {
+    private float prob(int s) {
        int tmp = (int)((s - this.time) * 10 / this.variance);
        //System.printString(tmp + "\n");
        int abs = (int)Math.abs(tmp);
-       double prob = 0;
+       float prob = 0;
        if(abs > this.probtable.length - 1) {
            prob = 1;
        } else {
            prob = this.probtable[abs];
        }
        if(tmp < 0) {
-           return 1.0 - prob;
+           return (float)1.0 - prob;
        } else {
            return prob;
        }
@@ -100,7 +100,7 @@ public class Estimator {
        return this.time;
     }
 
-    public double getVariance() {
+    public float getVariance() {
        return this.variance;
     }
 
index 1aa9119999cceb49ce42e677c19405cf9d415e05..1d5ff8935306f5b7e5cf607649ed9f0cca6384e5 100644 (file)
@@ -1,5 +1,5 @@
 task t1(StartupObject s{initialstate}) {
-    System.printString("task t1\n");
+    //System.printString("task t1\n");
     int stages = 2;
     Estimator estimator = new Estimator(stages){estimate};
     for(int i = 0; i < stages; ++i) {
@@ -10,7 +10,7 @@ task t1(StartupObject s{initialstate}) {
 }
 
 task t2(Stage s{sampling}) {
-    System.printString("task t2\n");
+    //System.printString("task t2\n");
 
     s.sampling();
 
@@ -18,7 +18,7 @@ task t2(Stage s{sampling}) {
 }
 
 task t3(Stage s{estimate}) {
-    System.printString("task t3\n");
+    //System.printString("task t3\n");
 
     s.estimate();
 
@@ -26,31 +26,31 @@ task t3(Stage s{estimate}) {
 }
 
 task t4(Estimator e{estimate}, Stage s{merge}) {
-    System.printString("task t4\n");
+    //System.printString("task t4\n");
 
     boolean fake = false;
     boolean finish = e.estimate(s.getAntTime(), s.getAntVariance2());
 
     if(finish) {
-       System.printI(0xff40);
+       //System.printI(0xff40);
        taskexit(e{!estimate, prob}, s{!merge});
     } else {
-       System.printI(0xff41);
+       //System.printI(0xff41);
        taskexit(s{!merge});
     }
 }
 
 task t5(Estimator e{prob}) {
-    System.printString("task t5\n");
+    //System.printString("task t5\n");
 
     int x = 10;
     int y = 20;
-    System.printString("x: " + x + "; y: " + y + "\n");
-    System.printString("The anticipate days need to finish this project is: " + e.getTime() + "\n");
-    System.printString("And the anticipate variance is: " + (int)(e.getVariance()*100) + "(/100)\n");
-    double prob = e.getProbability(x, y);
+    //System.printString("x: " + x + "; y: " + y + "\n");
+    //System.printString("The anticipate days need to finish this project is: " + e.getTime() + "\n");
+    //System.printString("And the anticipate variance is: " + (int)(e.getVariance()*100) + "(/100)\n");
+    float prob = e.getProbability(x, y);
 
-    System.printString("The probability of this project to be finished in " + x + " to " + y + " days is: " + (int)(prob*100) + "%\n");
-       System.printI((int)(prob*100));
+    //System.printString("The probability of this project to be finished in " + x + " to " + y + " days is: " + (int)(prob*100) + "%\n");
+    //System.printI((int)(prob*100));
     taskexit(e{!prob});
 }
index 79d685732c6584f64edc43cf9ee6a99be9af58fe..accb9bbcc92a92c4435d50e5326dfcae11f4c1bc 100644 (file)
@@ -10,55 +10,71 @@ public class Stage {
     int nortime;
     int petime;
     int time;
-    double variance2;
+    float variance2;
 
     public Stage(int id) {
-       System.printI(0xff20);
+       //System.printI(0xff20);
        this.ID = id;
 
        this.samplings = new int[10];
-       System.printI(0xff21);
+       //System.printI(0xff21);
        for(int i = 0; i < this.samplings.length; ++i) {
-               System.printI(0xff22);
            this.samplings[i] = 0;
+           //System.printString(tint + "; ");
        }
-       System.printI(0xff23);
+       //System.printI(0xff23);
 
        this.optime = 0;
        this.nortime = 0;
        this.petime = 0;
        this.time = 0;
        this.variance2 = 0;
-       System.printI(0xff24);
+       //System.printI(0xff24);
     }
 
     public void sampling() {
-       System.printI(0xff00);
-       Random r = new Random(ID);
-       System.printI(0xff01);
+       //System.printI(0xff00);
        int tint = 0;
-       System.printI(this.samplings.length);
-       for(int i = 0; i < this.samplings.length; ++i) {
-           do {
-               tint = r.nextInt()%50;
-           } while(tint <= 0);
-               System.printI(0xff02);
-           this.samplings[i] = tint;
-           //System.printString(tint + "; ");
+       //System.printI(this.samplings.length);
+       int i = 0;
+       if(this.ID == 0) {
+           //System.printI(0xff01);
+           this.samplings[i++] = 33;
+           this.samplings[i++] = 36;
+           this.samplings[i++] = 27;
+           this.samplings[i++] = 15;
+           this.samplings[i++] = 43;
+           this.samplings[i++] = 35;
+           this.samplings[i++] = 36;
+           this.samplings[i++] = 42;
+           this.samplings[i++] = 49;
+           this.samplings[i++] = 21;
+       } else if(this.ID == 1) {
+           //System.printI(0xff02);
+           this.samplings[i++] = 12;
+           this.samplings[i++] = 27;
+           this.samplings[i++] = 40;
+           this.samplings[i++] = 9;
+           this.samplings[i++] = 13;
+           this.samplings[i++] = 26;
+           this.samplings[i++] = 40;
+           this.samplings[i++] = 26;
+           this.samplings[i++] = 22;
+           this.samplings[i++] = 36;
        }
-       System.printI(0xff03);
+       //System.printI(0xff03);
     }
 
     public void estimate() {
-       System.printI(0xff10);
+       //System.printI(0xff10);
        int highest = this.samplings[0];
-       System.printI(0xff12);
+       //System.printI(0xff12);
        int lowest = this.samplings[0];
        int sum = this.samplings[0];
-       System.printI(0xff13);
-       System.printI(this.samplings.length);
+       //System.printI(0xff13);
+       //System.printI(this.samplings.length);
        for(int i = 1; i < this.samplings.length; ++i) {
-               System.printI(0xff14);
+               //System.printI(0xff14);
            int temp = this.samplings[i];
            if(temp > highest) {
                highest = temp;
@@ -67,17 +83,17 @@ public class Stage {
            }
            sum += temp;
        }
-       System.printI(0xff15);
+       //System.printI(0xff15);
        sum  = sum - highest - lowest;
        int ordinary = sum / (this.samplings.length - 2);
        this.optime = lowest;;
        this.petime = highest;
        this.nortime = ordinary;
-       System.printI(0xff16);
+       //System.printI(0xff16);
        this.time = (this.optime + 4 * this.nortime + this.petime) / 6;
-       System.printI(0xff17);
-       this.variance2 = (double)(this.optime - this.petime) * (double)(this.optime - this.petime) / 36.0;
-       System.printI(0xff18);
+       //System.printI(0xff17);
+       this.variance2 = (float)(this.optime - this.petime) * (float)(this.optime - this.petime) / (float)36.0;
+       //System.printI(0xff18);
        //System.printString("Op time: " + this.optime + "; Nor time: " + this.nortime + "; Pe time: " + this.petime + "; variance2: " + (int)(this.variance2*100) + "(/100)\n");
     }
 
@@ -85,7 +101,7 @@ public class Stage {
        return this.time;
     }
 
-    public double getAntVariance2() {
+    public float getAntVariance2() {
        return this.variance2;
     }
 
diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/JGFSeriesBench.java b/Robust/src/Benchmarks/Scheduling/JGFSeries/JGFSeriesBench.java
new file mode 100644 (file)
index 0000000..1ebb878
--- /dev/null
@@ -0,0 +1,38 @@
+/** Bristlecone Version  **/
+
+/**************************************************************************
+*                                                                         *
+*         Java Grande Forum Benchmark Suite - Thread Version 1.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, 2001.      *
+*                         All rights reserved.                            *
+*                                                                         *
+**************************************************************************/
+
+task t1(StartupObject s{initialstate}) {
+    //System.printString("task t1\n");
+    
+    int datasize = 16;
+    for(int i = 0; i < datasize; ++i) {
+       SeriesRunner sr = new SeriesRunner(i){!finish};
+    }
+    
+    taskexit(s{!initialstate});
+}
+
+task t2(SeriesRunner sr{!finish}) {
+    //System.printString("task t2\n");
+    sr.run();
+    taskexit(sr{finish});
+}
diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/SeriesRunner.java b/Robust/src/Benchmarks/Scheduling/JGFSeries/SeriesRunner.java
new file mode 100644 (file)
index 0000000..25ac2ba
--- /dev/null
@@ -0,0 +1,235 @@
+/** Bristlecone Version  **/
+
+/**************************************************************************
+ *                                                                         *
+ *         Java Grande Forum Benchmark Suite - Thread Version 1.0          *
+ *                                                                         *
+ *                            produced by                                  *
+ *                                                                         *
+ *                  Java Grande Benchmarking Project                       *
+ *                                                                         *
+ *                                at                                       *
+ *                                                                         *
+ *                Edinburgh Parallel Computing Centre                      *
+ *                                                                         * 
+ *                email: epcc-javagrande@epcc.ed.ac.uk                     *
+ *                                                                         *
+ *                  Original version of this code by                       *
+ *                 Gabriel Zachmann (zach@igd.fhg.de)                      *
+ *                                                                         *
+ *      This version copyright (c) The University of Edinburgh, 2001.      *
+ *                         All rights reserved.                            *
+ *                                                                         *
+ **************************************************************************/
+
+/**
+ * Class SeriesRunner
+ *
+ * Performs the transcendental/trigonometric portion of the
+ * benchmark. This test calculates the nth fourier
+ * coefficients of the function (x+1)^x defined on the interval
+ * 0,2 (where n is an arbitrary number set in the constructor).
+ *
+ * The first four pairs of coefficients calculated shoud be:
+ * (2.83777, 0), (1.04578, -1.8791), (0.2741, -1.15884), and
+ * (0.0824148, -0.805759).
+ */
+public class SeriesRunner {
+    flag finish;
+
+    int id;
+
+    public SeriesRunner(int id){
+       this.id=id;
+    }
+
+    public void run() {
+       //System.printI(0xa0);
+       float pair[] = new float[2];
+       // Calculate the fourier series. Begin by calculating A[0].
+       if (id==0) {
+           pair[0] = TrapezoidIntegrate((float)0.0, //Lower bound.
+                                        (float)2.0, // Upper bound.
+                                        1000,        // # of steps.
+                                        (float)0.0, // No omega*n needed.
+                                        0) / (float)2.0; // 0 = term A[0].
+           //System.printI(0xa1);
+           pair[1] = 0;
+       } else {
+           // Calculate the fundamental frequency.
+           // ( 2 * pi ) / period...and since the period
+           // is 2, omega is simply pi.
+           //float omega = (float) 3.1415926535897932; // Fundamental frequency.
+           float omega = (float) 3.1415926535897932; // Fundamental frequency.
+
+           // Calculate A[i] terms. Note, once again, that we
+           // can ignore the 2/period term outside the integral
+           // since the period is 2 and the term cancels itself
+           // out.
+           pair[0] = TrapezoidIntegrate((float)0.0,
+                                        (float)2.0,
+                                        1000,
+                                        omega * (float)id, 
+                                        1);                       // 1 = cosine term.
+           //System.printI(0xa2);
+           // Calculate the B[i] terms.
+           pair[1] = TrapezoidIntegrate((float)0.0,
+                                        (float)2.0,
+                                        1000,
+                                        omega * (float)id,
+                                        2);                       // 2 = sine term.
+       }
+       //System.printI(0xa3);
+       //System.printString("coefficient NO.");
+       //System.printI(id);
+       //System.printI((int)(pair[0]*10000));
+       //System.printI((int)(pair[1]*10000));
+
+       // validate
+       if(id < 4) {
+           //System.printI(0xa4);
+           float ref[][] = new float[4][2];
+           ref[0][0] = (float)2.87290112;
+           ref[0][1] = (float)0.0;
+           ref[1][0] = (float)1.11594856;
+           ref[1][1] = (float)-1.88199680;
+           ref[2][0] = (float)0.34412988;
+           ref[2][1] = (float)-1.16458096;
+           ref[3][0] = (float)0.15222694;
+           ref[3][1] = (float)-0.81435320;
+           //System.printI(0xa5);
+           for (int j = 0; j < 2; j++){
+               //System.printI(0xa6);
+               float error = Math.abs(pair[j] - ref[id][j]);
+               if (error > 1.0e-7 ){
+                       //System.printI(0xa7);
+                   //System.printString("Validation failed for coefficient " + j + "," + id + "\n");
+                   //System.printString("Computed value = " + (int)(pair[j]*100000000) + "\n");
+                   //System.printString("Reference value = " + (int)(ref[id][j]*100000000) + "\n");
+                       //System.printI((int)(pair[j]*10000));
+                       //System.printI((int)(ref[id][j]*10000));
+               }
+           }
+       }
+       //System.printI(0xa8);
+    }
+
+    /*
+     * TrapezoidIntegrate
+     *
+     * Perform a simple trapezoid integration on the function (x+1)**x.
+     * x0,x1 set the lower and upper bounds of the integration.
+     * nsteps indicates # of trapezoidal sections.
+     * omegan is the fundamental frequency times the series member #.
+     * select = 0 for the A[0] term, 1 for cosine terms, and 2 for
+     * sine terms. Returns the value.
+     */
+
+    private float TrapezoidIntegrate (float x0,     // Lower bound.
+                                     float x1,     // Upper bound.
+                                     int nsteps,    // # of steps.
+                                     float omegan, // omega * n.
+                                     int select)    // Term type.
+    {
+       float x;               // Independent variable.
+       float dx;              // Step size.
+       float rvalue;          // Return value.
+
+       //System.printI(0xb0);
+       // Initialize independent variable.
+
+       x = x0;
+
+       // Calculate stepsize.
+
+       dx = (x1 - x0) / (float)nsteps;
+       //System.printI((int)(dx * 1000000));
+       //System.printI(0xb1);
+
+       // Initialize the return value.
+
+       rvalue = thefunction(x0, omegan, select) / (float)2.0;
+       //System.printI((int)(rvalue * 1000000));
+       //System.printI(0xb2);
+
+       // Compute the other terms of the integral.
+
+       if (nsteps != 1)
+       {
+           //System.printI(0xb3);
+           --nsteps;               // Already done 1 step.
+           while (--nsteps > 0)
+           {
+               //System.printI(0xb4);
+               //System.printI(nsteps);
+               x += dx;
+               rvalue += thefunction(x, omegan, select);
+               //System.printI((int)(rvalue * 1000000));
+               //System.printI(0xb5);
+           }
+       }
+
+       // Finish computation.
+
+       //System.printI(0xb6);
+       rvalue=(float)(rvalue + thefunction(x1,omegan,select) / (float)2.0) * dx;
+       //System.printI((int)(rvalue * 1000000));
+       //System.printString("rvalue: " + (int)(rvalue * 10000) + "\n");
+       //System.printI(0xb7);
+       return(rvalue);
+    }
+
+    /*
+     * thefunction
+     *
+     * This routine selects the function to be used in the Trapezoid
+     * integration. x is the independent variable, omegan is omega * n,
+     * and select chooses which of the sine/cosine functions
+     * are used. Note the special case for select=0.
+     */
+
+    private float thefunction(float x,      // Independent variable.
+                             float omegan, // Omega * term.
+                             int select)    // Choose type.
+    {
+
+       // Use select to pick which function we call.
+       //System.printI(0xc0);
+       float result = (float)0.0;
+       if(0 == select) {
+           //System.printI(0xc1);
+           result = Math.powf(x+(float)1.0,x);
+           //System.printI((int)(result * 1000000));
+       } else if (1 == select) {
+           //System.printI(0xc2);
+           return(Math.powf(x+(float)1.0,x) * Math.cosf(omegan*x));
+       } else if (2 == select) {
+           //System.printI(0xc3);
+           return(Math.powf(x+(float)1.0,x) * Math.sinf(omegan*x));
+       }
+
+       //System.printI(0xc4);
+       // We should never reach this point, but the following
+       // keeps compilers from issuing a warning message.
+       return result;
+    }    
+}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/c/JGFSeriesBench.c b/Robust/src/Benchmarks/Scheduling/JGFSeries/c/JGFSeriesBench.c
new file mode 100644 (file)
index 0000000..94659c4
--- /dev/null
@@ -0,0 +1,196 @@
+/** Single thread C Version  **/
+
+/**************************************************************************
+*                                                                         *
+*         Java Grande Forum Benchmark Suite - Thread Version 1.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, 2001.      *
+*                         All rights reserved.                            *
+*                                                                         *
+**************************************************************************/
+
+#ifdef RAW
+#include <raw.h>
+#else
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+#include <unistd.h>
+#endif
+#include <math.h>
+
+void begin(void);
+void run(int id);
+float TrapezoidIntegrate(float x0, float x1, int nsteps, float omegan, int select);
+float thefunction(float x, float omegan, int select);
+
+#ifndef RAW
+int main(int argc, char **argv) {
+  begin();
+  return 0;
+}
+#endif
+
+void begin(void) {
+       int datasize = 16;
+       int i = 0;
+       /* Main loop: */
+       for(i = 0; i < datasize; ++i) {
+               run(i);
+       }
+#ifdef RAW
+    raw_test_pass(raw_get_cycle());
+       raw_test_done(1);
+#endif
+}
+
+void run(int id) {
+       float pair[2];
+       // Calculate the fourier series. Begin by calculating A[0].
+       if (id==0) {
+           pair[0] = TrapezoidIntegrate((float)0.0, //Lower bound.
+                                                (float)2.0, // Upper bound.
+                                                1000,        // # of steps.
+                                            (float)0.0, // No omega*n needed.
+                                                0) / (float)2.0; // 0 = term A[0].
+           pair[1] = 0;
+       } else {
+           // Calculate the fundamental frequency.
+           // ( 2 * pi ) / period...and since the period
+           // is 2, omega is simply pi.
+           float omega = (float) 3.1415926535897932; // Fundamental frequency.
+
+           // Calculate A[i] terms. Note, once again, that we
+           // can ignore the 2/period term outside the integral
+           // since the period is 2 and the term cancels itself
+           // out.
+           pair[0] = TrapezoidIntegrate((float)0.0,
+                                            (float)2.0,
+                                                1000,
+                                            omega * (float)id, 
+                                                1);                       // 1 = cosine term.
+           //System.printI(0xa2);
+           // Calculate the B[i] terms.
+           pair[1] = TrapezoidIntegrate((float)0.0,
+                                               (float)2.0,
+                                               1000,
+                                               omega * (float)id,
+                                               2);                       // 2 = sine term.
+       }
+
+#ifdef RAW
+       //raw_test_pass_reg(id);
+       //raw_test_pass((int)(pair[0]*10000));
+       //raw_test_pass((int)(pair[1]*10000));
+#else
+       printf("coefficient NO. %d: %f; %f \n", id, pair[0], pair[1]);
+#endif
+
+       // validate
+       if(id < 4) {
+               int j = 0;
+           float ref[4][2];
+           ref[0][0] = 2.8729524964837996;
+           ref[0][1] = 0.0;
+           ref[1][0] = 1.1161046676147888;
+           ref[1][1] = -1.8819691893398025;
+           ref[2][0] = 0.34429060398168704;
+           ref[2][1] = -1.1645642623320958;
+           ref[3][0] = 0.15238898702519288;
+           ref[3][1] = -0.8143461113044298;
+           for (j = 0; j < 2; j++){
+               float error = abs(pair[j] - ref[id][j]);
+               if (error > 1.0e-12 ){
+#ifdef RAW
+                       //raw_test_pass(0xeeee);
+#else
+                   printf("Validation failed for coefficient %d:%d \n", j, id);
+                   printf("Computed value = %f \n", pair[j]);
+                   printf("Reference value = %f \n", ref[id][j]);
+#endif
+               }
+           }
+       }
+}
+
+/*
+ * TrapezoidIntegrate
+ *
+ * Perform a simple trapezoid integration on the function (x+1)**x.
+ * x0,x1 set the lower and upper bounds of the integration.
+ * nsteps indicates # of trapezoidal sections.
+ * omegan is the fundamental frequency times the series member #.
+ * select = 0 for the A[0] term, 1 for cosine terms, and 2 for
+ * sine terms. Returns the value.
+ */
+
+float TrapezoidIntegrate (float x0,     // Lower bound.
+                           float x1,     // Upper bound.
+                           int nsteps,    // # of steps.
+                           float omegan, // omega * n.
+                           int select)  { // Term type.
+       float x;               // Independent variable.
+       float dx;              // Step size.
+       float rvalue;          // Return value.
+
+       // Initialize independent variable.
+       x = x0;
+
+       // Calculate stepsize.
+       dx = (x1 - x0) / (float)nsteps;
+
+       // Initialize the return value.
+       rvalue = thefunction(x0, omegan, select) / (float)2.0;
+
+       // Compute the other terms of the integral.
+       if (nsteps != 1) {
+           --nsteps;               // Already done 1 step.
+           while (--nsteps > 0) {
+               x += dx;
+               rvalue += thefunction(x, omegan, select);
+           }
+       }
+
+       // Finish computation.
+       rvalue=(rvalue + thefunction(x1,omegan,select) / (float)2.0) * dx;
+       return(rvalue);
+}
+
+/*
+ * thefunction
+ *
+ * This routine selects the function to be used in the Trapezoid
+ * integration. x is the independent variable, omegan is omega * n,
+ * and select chooses which of the sine/cosine functions
+ * are used. Note the special case for select=0.
+ */
+
+float thefunction(float x,      // Independent variable.
+                              float omegan, // Omega * term.
+                              int select) {  // Choose type.
+
+       // Use select to pick which function we call.
+       float result = 0.0;
+       if(0 == select) {
+           result = powf(x+(float)1.0,x);
+       } else if (1 == select) {
+           return(powf(x+(float)1.0,x) * cosf(omegan*x));
+       } else if (2 == select) {
+           return(powf(x+(float)1.0,x) * sinf(omegan*x));
+       }
+
+       // We should never reach this point, but the following
+       // keeps compilers from issuing a warning message.
+       return result;
+}    
diff --git a/Robust/src/Benchmarks/Scheduling/JGFSeries/c/Makefile b/Robust/src/Benchmarks/Scheduling/JGFSeries/c/Makefile
new file mode 100644 (file)
index 0000000..c1b3433
--- /dev/null
@@ -0,0 +1,18 @@
+TOPDIR=/home/jzhou/starsearch
+include $(TOPDIR)/Makefile.include
+
+RGCCFLAGS += -O2 
+RGCCFLAGS += -DRAW 
+
+SIM-CYCLES = 10000
+
+ATTRIBUTES += HWIC
+
+TILES = 00
+
+OBJECT_FILES_00 = JGFSeriesBench.o
+#OBJECT_FILES = JGFSeriesBench.o
+
+# this is for a multi-tile test
+include $(COMMONDIR)/Makefile.all
+#include $(COMMONDIR)/Makefile.single
diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduce.java b/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduce.java
new file mode 100644 (file)
index 0000000..6f6bbbc
--- /dev/null
@@ -0,0 +1,134 @@
+task t1(StartupObject s{initialstate}) {
+    System.printString("task t1\n");
+    
+    String inputfile = "Manila International Airport Authority spokesman Octavio Lina said there were no injuries, but some of the 345 passengers vomited after disembarking, AP reported. Video of the incident shows passengers applauding as the plane landed safely.";
+    int m = 6;
+    int r = 3;
+    char seperator = '\n';
+    Splitter splitter = new Splitter(inputfile, m, seperator);
+    Master master = new Master(m, r, splitter){split};
+
+    taskexit(s{!initialstate});
+}
+
+//Split the input file into M pieces
+task t2(Master master{split}) {
+    System.printString("task t2\n");
+    
+    master.split();
+
+    taskexit(master{!split, assignMap});
+}
+
+//Select a map worker to handle one of the pieces of input file
+task t3(Master master{assignMap}) {
+    System.printString("task t3\n");
+    
+    //master.assignMap();
+    Splitter splitter = master.getSplitter();
+    String[] contentsplits = splitter.getSlices();
+    for(int i = 0; i < contentsplits.length; ++i) {
+       MapWorker mworker = new MapWorker(splitter.getFilename(), contentsplits[i], master.getR(), i){map};
+       master.setMapInit(i);
+    }
+
+    taskexit(master{!assignMap, mapoutput});
+}
+
+//MapWorker do 'map' function on a input file piece
+task t4(MapWorker mworker{map}) {
+    System.printString("task t4\n");
+    
+    mworker.map();
+
+    taskexit(mworker{!map, partition});
+}
+
+//Partition the intermediate key/value pair generated
+//into R intermediate local files
+task t5(MapWorker mworker{partition}) {
+    System.printString("task t5\n");
+    
+    mworker.partition();
+
+    taskexit(mworker{!partition, mapoutput});
+}
+
+//Register the intermediate ouput from map worker to master
+task t6(Master master{mapoutput}, MapWorker mworker{mapoutput}) {
+    System.printString("task t6\n");
+    
+    int total = master.getR();
+    for(int i = 0; i < total; ++i) {
+       OutputCollector temp = mworker.outputFile(i);
+       if(temp != null) {
+           master.addInterOutput(temp, i); 
+       }
+    }
+    master.setMapFinish(mworker.getID());
+
+    if(master.isMapFinish()) {
+       taskexit(master{!mapoutput, mapfinished, assignReduce}, mworker{!mapoutput});
+    }
+
+    taskexit(mworker{!mapoutput});
+}
+
+//Assign the list of intermediate output associated to one key to
+//a reduce worker 
+task t7(Master master{assignReduce}) {
+    System.printString("task t7\n");
+    
+    //master.assignReduce();
+    Vector[] interoutputs = master.getInteroutputs();
+    for(int i = 0; i < interoutputs.length; ++i) {
+       ReduceWorker rworker = new ReduceWorker(interoutputs[i], i){sortgroup};
+       master.setReduceInit(i);
+    }
+
+    taskexit(master{!assignReduce, reduceoutput});
+}
+
+//First do sort and group on the intermediate key/value pairs assigned
+//to reduce worker
+task t8(ReduceWorker rworker{sortgroup}) {
+    System.printString("task t8\n");
+    
+    rworker.sortgroup();
+
+    taskexit(rworker{!sortgroup, reduce});
+}
+
+//Do 'reduce' function
+task t9(ReduceWorker rworker{reduce}) {
+    System.printString("task t9\n");
+    
+    rworker.reduce();
+
+    taskexit(rworker{!reduce, reduceoutput});
+}
+
+//Collect the output into master
+task t10(Master master{reduceoutput}, ReduceWorker rworker{reduceoutput}) {
+    System.printString("task t10\n");
+    
+    master.collectROutput(rworker.getOutput());
+    master.setReduceFinish(rworker.getID());
+
+    if(master.isReduceFinish()) {
+       taskexit(master{!reduceoutput, reducefinished, output}, rworker{!reduceoutput});
+    }
+
+    taskexit(rworker{!reduceoutput});
+}
+
+task t11(Master master{output}) {
+    System.printString("task t11\n");
+    
+    /*if(master.isPartial()) {
+       System.printString("Partial! The result may not be right due to some failure!\n");
+    }*/
+    System.printString("Finish!\n");// Results are in the output file: " + master.getOutputFile() + "\n");
+    System.printI(0xdddd);
+    taskexit(master{!output});
+}
diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduceBase.java b/Robust/src/Benchmarks/Scheduling/MapReduce/MapReduceBase.java
new file mode 100644 (file)
index 0000000..3ff539d
--- /dev/null
@@ -0,0 +1,55 @@
+public class MapReduceBase {
+
+    public static void map(String key, String value, OutputCollector output) {
+       int n = value.length();
+       for (int i = 0; i < n; ) {
+           // Skip past leading whitespace
+           while ((i < n) && isspace(value.charAt(i))) {
+               ++i;
+           }
+
+           // Find word end
+           int start = i;
+           while ((i < n) && !isspace(value.charAt(i))) {
+               i++;
+           }
+
+           if (start < i) {
+               output.emit(value.subString(start, i), "1");
+               //System.printString(value.subString(start,i) + "\n");
+           }
+       }
+    }
+
+    public static void reduce(String key, Vector values, OutputCollector output) {
+       // Iterate over all entries with the
+       // // same key and add the values
+       int value = 0;
+       for(int i = 0; i < values.size(); ++i) {
+           value += Integer.parseInt((String)values.elementAt(i));
+       }
+
+       // Emit sum for input->key()
+       output.emit(key, String.valueOf(value));
+    }
+
+    static boolean isspace(char c) {
+       if((c == ' ') || 
+               (c == ',') ||
+               (c == '.') ||
+               (c == '!') ||
+               (c == '?') ||
+               (c == '"') ||
+               (c == '(') ||
+               (c == ')') ||
+               (c == '[') ||
+               (c == ']') ||
+               (c == '{') ||
+               (c == '}') ||
+               (c == '\n')) {
+           return true;
+       }
+       return false;
+    }
+}
+
diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/MapWorker.java b/Robust/src/Benchmarks/Scheduling/MapReduce/MapWorker.java
new file mode 100644 (file)
index 0000000..e7efa7c
--- /dev/null
@@ -0,0 +1,76 @@
+public class MapWorker {
+    flag map;
+    flag partition;
+    flag mapoutput;
+
+    int ID;
+
+    int r;
+    String key;
+    String value;
+    OutputCollector output;
+
+    //String[] locations;
+    OutputCollector[] outputs;
+
+    public MapWorker(String key, String value, int r, int id) {
+       this.ID = id;
+       this.r = r;
+
+       this.key = key;
+       this.value = value;
+       this.output = new OutputCollector();
+
+       /*locations = new String[r];
+       for(int i = 0; i < r; ++i) {
+           StringBuffer temp = new StringBuffer("/scratch/mapreduce_nor/output-intermediate-map-");
+           temp.append(String.valueOf(ID));
+           temp.append("-of-");
+           temp.append(String.valueOf(r));
+           temp.append("_");
+           temp.append(String.valueOf(i));
+           temp.append(".dat");
+           locations[i] = new String(temp);
+       }*/
+
+       outputs = new OutputCollector[r];
+       for(int i = 0; i < r; ++i) {
+           outputs[i] = null;
+       }
+    }
+
+    public void map() {
+       MapReduceBase.map(key, value, output);
+    }
+
+    public void partition() {
+       int size = this.output.size();
+       for(int i = 0; i < size; ++i) {
+           String key = this.output.getKey(i);
+           String value = this.output.getValue(i);
+           // use the hashcode of key to decide which intermediate output
+           // this pair should be in
+           int index = (int)Math.abs(key.hashCode()) % this.r;
+           OutputCollector oStream = outputs[index];
+           if(oStream == null) {
+               // open the file
+               oStream = new OutputCollector(); // append
+               outputs[index] = oStream;
+           }
+           oStream.emit(key, "1");
+       }
+    }
+
+    public OutputCollector outputFile(int i) {
+       return outputs[i];
+    }
+
+    public int getID() {
+       return this.ID;
+    }
+
+    public int getR() {
+       return this.r;
+    }
+
+}
diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/Master.java b/Robust/src/Benchmarks/Scheduling/MapReduce/Master.java
new file mode 100644 (file)
index 0000000..9fadc23
--- /dev/null
@@ -0,0 +1,171 @@
+public class Master {
+    flag split;
+    flag assignMap;
+    flag mapoutput;
+    flag mapfinished;
+    flag assignReduce;
+    flag reduceoutput;
+    flag reducefinished;
+    flag output;
+
+    int m;
+    int r;
+    int[] mworkerStates; // array of map worker's state
+    // 0: idle  1: process  2: finished 3: fail
+    int finishmworker;
+    int[] rworkerStates; // array of reduce worker's state
+    int finishrworker;
+    Vector[] interoutputs; // array of OutputCollector vector containing
+    // paths of intermediate outputs from
+    // map worker
+
+    Splitter splitter;
+
+    //String outputfile;  // path of final output file
+    OutputCollector output;
+
+    //boolean partial;
+
+    public Master(int m, int r, Splitter splitter) {
+       this.m = m;
+       this.r = r;
+
+       mworkerStates = new int[m];
+       rworkerStates = new int[r];
+       for(int i = 0; i < m; ++i) {
+           mworkerStates[i] = 0;
+       }
+       for(int i = 0; i < r; ++i) {
+           rworkerStates[i] = 0;
+       }
+
+       interoutputs = new Vector[r];
+       for(int i = 0; i < r; ++i) {
+           interoutputs[i] = null;
+       }
+
+       this.splitter = splitter;
+       //this.outputfile = new String("/scratch/mapreduce_nor/output.dat");
+       this.output = new OutputCollector();
+
+       //this.partial = false;
+       this.finishmworker = 0;
+       this.finishrworker = 0;
+    }
+
+    public int getR() {
+       return this.r;
+    }
+
+    /*public String getOutputFile() {
+       return this.outputfile;
+    }*/
+
+    /*public boolean isPartial() {
+       return this.partial;
+    }
+
+    public void setPartial(boolean partial) {
+       this.partial = partial || this.partial;
+    }*/
+
+    public void split() {
+       splitter.split();
+    }
+
+    /*public void assignMap() {
+       String[] contentsplits = splitter.getSlices();
+       for(int i = 0; i < contentsplits.length; ++i) {
+           //System.printString("*************************\n");
+           //System.printString(contentsplits[i] + "\n");
+           //System.printString("*************************\n");
+           MapWorker mworker = new MapWorker(splitter.getFilename(), contentsplits[i], r, i){map};
+           mworkerStates[i] = 1;
+       }
+    }*/
+    
+    public void setMapInit(int i) {
+       mworkerStates[i] = 1;
+    }
+
+    public void setMapFinish(int i) {
+       finishmworker++;
+       mworkerStates[i] = 2;
+    }
+
+    public void setMapFail(int i) {
+       mworkerStates[i] = 3;
+    }
+
+    public boolean isMapFinish() {
+       /*
+       //System.printString("check map finish\n");
+       for(int i = 0; i < mworkerStates.length; ++i) {
+           if(mworkerStates[i] == 1) {
+               return false;
+           }
+       }
+
+       return true;*/
+       return this.finishmworker == this.m;
+    }
+
+    public void addInterOutput(OutputCollector interoutput, int index) {
+       if(interoutputs[index] == null) {
+           interoutputs[index] = new Vector();
+       }
+       interoutputs[index].addElement(interoutput);
+    }
+
+    /*public void assignReduce() {
+       for(int i = 0; i < interoutputs.length; ++i) {
+           ReduceWorker rworker = new ReduceWorker(interoutputs[i], i){sortgroup};
+           rworkerStates[i] = 1;
+       }
+    }*/
+    
+    public void setReduceInit(int i) {
+       rworkerStates[i] = 1;
+    }
+
+    public void setReduceFinish(int i) {
+       finishrworker++;
+       rworkerStates[i] = 2;
+    }
+
+    public void setReduceFail(int i) {
+       rworkerStates[i] = 3;
+    }
+
+    public boolean isReduceFinish() {
+       //System.printI(0xa0);
+       /*
+       for(int i = 0; i < rworkerStates.length; ++i) {
+           if(rworkerStates[i] == 1) {
+               //System.printI(0);
+               return false;
+           }
+       }
+
+       //System.printI(1);
+       return true;*/
+       return this.finishrworker == this.r;
+    }
+
+    public void collectROutput(OutputCollector file) {
+       int size = file.size();
+       for(int i = 0; i < size; ++i) {
+           String key = file.getKey(i);
+           String value = file.getValue(i);
+           this.output.emit(key, value);
+       }
+    }
+    
+    public Vector[] getInteroutputs() {
+       return this.interoutputs;
+    }
+    
+    public Splitter getSplitter() {
+       return this.splitter;
+    }
+}
diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/OutputCollector.java b/Robust/src/Benchmarks/Scheduling/MapReduce/OutputCollector.java
new file mode 100644 (file)
index 0000000..3c6d852
--- /dev/null
@@ -0,0 +1,27 @@
+public class OutputCollector {
+
+    Vector keys;
+    Vector values;
+
+    public OutputCollector() {
+       this.keys = new Vector();
+       this.values = new Vector();
+    }
+
+    public void emit(String key, String value) {
+       this.keys.addElement(key);
+       this.values.addElement(value);
+    }
+
+    public int size() {
+       return this.keys.size();
+    }
+
+    public String getKey(int i) {
+       return (String)this.keys.elementAt(i);
+    }
+
+    public String getValue(int i) {
+       return (String)this.values.elementAt(i);
+    }
+}
diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/ReduceWorker.java b/Robust/src/Benchmarks/Scheduling/MapReduce/ReduceWorker.java
new file mode 100644 (file)
index 0000000..6584f8b
--- /dev/null
@@ -0,0 +1,106 @@
+public class ReduceWorker {
+    flag sortgroup;
+    flag reduce;
+    flag reduceoutput;
+
+    int ID;
+    Vector interoutputs;  // string vector containing paths
+    // of intermediate outputs from map worker
+    Vector keys;
+    HashMap values; // hashmap map key to vector of string vector
+    int[] sorts; // array record the sort of keys
+    OutputCollector output;
+    //String outputfile;  // path of the intermediate output file
+
+    public ReduceWorker(Vector interoutputs, int id) {
+       this.ID = id;
+       this.interoutputs = interoutputs;
+
+       this.keys = new Vector();
+       this.values = new HashMap();
+       //this.sorts = null;
+
+       this.output = new OutputCollector();
+       //this.outputfile = "/scratch/mapreduce_nor/output-intermediate-reduce-" + String.valueOf(id) + ".dat";
+    }
+
+    public void sortgroup() {
+       // group values associated to the same key
+       //System.printString("================================\n");
+       if(interoutputs == null) {
+           return;
+       }
+       for(int i = 0; i < interoutputs.size(); ++i) {
+           OutputCollector tmpout = (OutputCollector)interoutputs.elementAt(i);
+           int size = tmpout.size();
+           for(int j= 0; j < size; ++j) {
+               String key = tmpout.getKey(j);
+               String value = tmpout.getValue(j);
+               if(!this.values.containsKey(key)) {
+                   this.values.put(key, new Vector());
+                   this.keys.addElement(key);
+               }
+               ((Vector)this.values.get(key)).addElement(value);
+           }
+       }
+       //System.printString("================================\n");
+
+       // sort all the keys inside interoutputs
+       this.sorts = new int[this.keys.size()];
+       // insert sorting
+       this.sorts[0] = 0;
+       int tosort = 1;
+       for(; tosort < this.keys.size(); ++tosort) {
+           int tosortkey = ((String)this.keys.elementAt(tosort)).hashCode();
+           int index = tosort;
+           for(int i = tosort; i > 0; --i) {
+               if(((String)this.keys.elementAt(this.sorts[i - 1])).hashCode() > tosortkey) {
+                   this.sorts[i] = this.sorts[i-1];
+                   index = i - 1;
+               } else {
+                   //System.printString(i + "; " + tosort + "\n");
+                   index = i;
+                   i = 0;
+               }
+           }
+           this.sorts[index] = tosort;
+       }
+    }
+
+    public void reduce() {
+       if(this.interoutputs != null) {
+           for(int i = 0; i < this.sorts.length; ++i) {
+               String key = (String)this.keys.elementAt(this.sorts[i]);
+               Vector values = (Vector)this.values.get(key);
+               MapReduceBase.reduce(key, values, this.output);
+           }
+       }
+
+       // output all the result into some local file
+       /*int size = this.output.size();
+       FileOutputStream oStream = new FileOutputStream(outputfile, true); // append
+       for(int i = 0; i < size; ++i) {
+           String key = this.output.getKey(i);
+           String value = this.output.getValue(i);
+           // format: key value\n
+           oStream.write(key.getBytes());
+           oStream.write(' ');
+           oStream.write(value.getBytes());
+           oStream.write('\n');
+           oStream.flush();
+       }
+       oStream.close();*/
+    }
+
+    /*public String getOutputFile() {
+       return this.outputfile;
+    }*/
+    
+    public OutputCollector getOutput() {
+       return this.output;
+    }
+
+    public int getID() {
+       return this.ID;
+    }
+}
diff --git a/Robust/src/Benchmarks/Scheduling/MapReduce/Splitter.java b/Robust/src/Benchmarks/Scheduling/MapReduce/Splitter.java
new file mode 100644 (file)
index 0000000..28d7669
--- /dev/null
@@ -0,0 +1,33 @@
+public class Splitter {
+    String filename;
+    String content;
+    int length;
+    String[] slices;
+
+    public Splitter(String inputfile, int splitNum, char seperator) {
+       //System.printString("Top of Splitter's constructor\n");
+       filename = new String("tmp");
+       content = inputfile;
+       //System.printString(content + "\n");
+       
+       this.slices = new String[splitNum];
+       this.slices[0] = content;
+    }
+
+    public void split() {
+       if(slices.length == 1) {
+           return;
+       }
+       for(int i = 1; i < this.slices.length; ++i) {
+           slices[i] = new String(content.toCharArray());
+       }
+    }
+
+    public String getFilename() {
+       return filename;
+    }
+
+    public String[] getSlices() {
+       return this.slices;
+    }
+}