run-doj-validation-test.sh: a single script that performs validation tests for all...
[IRC.git] / Robust / src / Benchmarks / oooJava / monte / JGFMonteCarloBench.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 JGFMonteCarloBench extends CallAppDemo {
9
10   public JGFMonteCarloBench(){
11     super();
12   }
13   
14   public void JGFsetsize(int size) {
15     this.size = size;
16   }
17
18   public void JGFinitialise(int workload) {
19
20     initialise(workload);
21
22   }
23
24   public void JGFapplication() {
25
26     runiters();
27
28   }
29
30   public void JGFvalidate() {
31     double refval[] = new double[2];
32     refval[0] = -0.0333976656762814;
33     refval[1] = -0.03215796752868655;
34     
35     double dev = Math.abs(getAppDemo().JGFavgExpectedReturnRateMC - refval[size]);
36     if (dev > 1.0e-12) {
37       System.out.println("Validation failed");
38       System.out.println(" expectedReturnRate= " + getAppDemo().JGFavgExpectedReturnRateMC  + "  " + dev
39           + "  " + size);
40     }else{
41       System.out.println("VALID");
42     }
43   }
44
45   public void JGFrun(int size,int workload) {
46
47     JGFsetsize(size);
48     JGFinitialise(workload);
49     JGFapplication();
50     JGFvalidate();
51
52   }
53
54   public static void main(String argv[]) {
55
56     JGFMonteCarloBench mc = new JGFMonteCarloBench();
57     int size=1;
58     int workload=100;
59     if(argv.length>0){
60       size=Integer.parseInt(argv[0]);
61     }
62     if(argv.length>1){
63       workload=Integer.parseInt(argv[1]);
64     }
65     mc.JGFrun(size,workload);
66
67   }
68
69 }