double[][] G;
int num_iterations;
+ long RANDOM_SEED;
atomic {
numthreads = sor.nthreads;
mybarr = global new BarrierServer(numthreads);
G = global new double[datasize][];
num_iterations = sor.JACOBI_NUM_ITER;
+ RANDOM_SEED = sor.RANDOM_SEED;
}
mybarr.start(mid[0]);
atomic {
for(int i=0;i<numthreads;i++) {
- thobjects[i] = new SORWrap(global new SORRunner(i,omega,G,num_iterations,numthreads));
+ thobjects[i] = new SORWrap(global new SORRunner(i,omega,G,num_iterations,numthreads, RANDOM_SEED));
}
}
sor.Gtotal += G[i][j];
}
}
+ //System.out.println("DEBUG: G.length= " + G.length+" sor.Gtotal= " + sor.Gtotal);
}
}
int id, num_iterations;
double G[][],omega;
int nthreads;
+ long RANDOM_SEED;
- public SORRunner(int id, double omega, double G[][], int num_iterations, int nthreads) {
+ public SORRunner(int id, double omega, double G[][], int num_iterations, int nthreads, long RANDOM_SEED) {
this.id = id;
this.omega=omega;
this.G=G;
this.num_iterations=num_iterations;
this.nthreads = nthreads;
+ this.RANDOM_SEED = RANDOM_SEED;
}
public void run() {
Barrier.enterBarrier(barr);
atomic {
- Random rand=new Random();
+ Random rand=new Random(RANDOM_SEED);
double[] R = G[0];
for(int j=0;j<M;j++)
R[j]=rand.nextDouble() * 1e-6;