3 public class AppDemoRunner extends Thread {
10 public int returnDefinition;
11 public float expectedReturnRate;
12 public float volatility;
13 public int nTimeSteps;
14 public float pathStartValue;
16 int id, nRunsMC, group;
17 //ToInitAllTasks toinitalltasks;
18 public Vector results;
20 public AppDemoRunner(int id,
24 /*ToInitAllTasks initalltask*/) {
28 this.results = new Vector();
30 //this.header = initalltask.header;
32 this.startDate = ad.startDate;
33 this.endDate = ad.endDate;
34 this.dTime = ad.dTime;
35 this.returnDefinition = ad.returnDefinition;
36 this.expectedReturnRate = ad.expectedReturnRate;
37 this.volatility = ad.volatility;
38 this.nTimeSteps = ad.nTimeStepsMC;
39 this.pathStartValue = ad.pathStartValue;
43 // Now do the computation.
44 int ilow, iupper, slice;
47 int nruns = this.nRunsMC;
49 slice = (nruns + gp-1)/gp;
52 iupper = (index+1)*slice;
57 for(int iRun=ilow; iRun < iupper; iRun++ ) {
58 //String header="MC run "+String.valueOf(iRun);
59 PriceStock ps = new PriceStock();
60 ps.setInitAllTasks(this);
61 ps.setTask(/*header, */(long)iRun*11);
63 results.addElement(ps.getResult());
67 public static void main(String[] args) {
68 int datasize = 10000; //should be times of 2
69 //int nruns = 62 * 62; //16 * 16;
70 int group = THREADNUM; // 16;
71 int nruns = group * group;
73 System.setgcprofileflag();
74 AppDemo ad = new AppDemo(datasize, nruns, group);
77 for(int i = 0; i < group; i++) {
78 AppDemoRunner adr = new AppDemoRunner(i, nruns, group, ad);