int id,num_iterations;
double G[][],omega;
- long sync[][];
+ int sync[][];
int nthreads;
- public SORRunner(int id, double omega, double G[][], int num_iterations,long[][] sync, int nthreads) {
+ public SORRunner(int id, double omega, double G[][], int num_iterations,int[][] sync, int nthreads) {
this.id = id;
this.omega=omega;
this.G=G;
if (iupper > Mm1) iupper = Mm1+1;
if (tmpid == (numthreads-1)) iupper = Mm1+1;
- for (int p=0; p<2*numiterations; p++) {
- atomic {
- for (int i=ilow+(p%2); i<iupper; i=i+2) {
+ for (int p=0; p<2*numiterations; p++) {
+ atomic {
+ for (int i=ilow+(p%2); i<iupper; i=i+2) {
- double [] Gi = G[i];
- double [] Gim1 = G[i-1];
+ double [] Gi = G[i];
+ double [] Gim1 = G[i-1];
- if(i == 1) {
- double [] Gip1 = G[i+1];
+ if(i == 1) {
+ double [] Gip1 = G[i+1];
- for (int j=1; j<Nm1; j=j+2){
- Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
- + Gi[j+1]) + one_minus_omega * Gi[j];
+ for (int j=1; j<Nm1; j=j+2){
+ Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
+ + Gi[j+1]) + one_minus_omega * Gi[j];
- }
- } else if (i == Mm1) {
+ }
+ } else if (i == Mm1) {
- double [] Gim2 = G[i-2];
+ double [] Gim2 = G[i-2];
- for (int j=1; j<Nm1; j=j+2){
- if((j+1) != Nm1) {
- Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
- + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
- }
+ for (int j=1; j<Nm1; j=j+2){
+ if((j+1) != Nm1) {
+ Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
+ + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
}
+ }
- } else {
+ } else {
- double [] Gip1 = G[i+1];
- double [] Gim2 = G[i-2];
+ double [] Gip1 = G[i+1];
+ double [] Gim2 = G[i-2];
- for (int j=1; j<Nm1; j=j+2){
- Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
- + Gi[j+1]) + one_minus_omega * Gi[j];
+ for (int j=1; j<Nm1; j=j+2){
+ Gi[j] = omega_over_four * (Gim1[j] + Gip1[j] + Gi[j-1]
+ + Gi[j+1]) + one_minus_omega * Gi[j];
- if((j+1) != Nm1) {
- Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
- + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
- }
+ if((j+1) != Nm1) {
+ Gim1[j+1]=omega_over_four * (Gim2[j+1] + Gi[j+1] + Gim1[j]
+ + Gim1[j+2]) + one_minus_omega * Gim1[j+1];
}
}
}
- } //close atomic
- // Signal this thread has done iteration
+ }
+ } //close atomic
- // Wait for neighbours;
- long ourcount;
- boolean done=true;
- atomic {
- sync[tmpid][0]++;
- ourcount=sync[tmpid][0];
- }
+ int ourcount;
+ boolean done=true;
+ atomic {
+ // Signal this thread has done iteration
+ sync[tmpid][0]++;
+ ourcount=sync[tmpid][0];
+ }
- while(done) {
- atomic {
- if ((tmpid==0 || ourcount <= sync[tmpid-1][0])
- &&((tmpid==(numthreads-1))||ourcount<=sync[tmpid+1][0]))
- done=false;
- }
+ // Wait for neighbours;
+ while(done) {
+ atomic {
+ if ((tmpid==0 || ourcount <= sync[tmpid-1][0])
+ &&((tmpid==(numthreads-1))||ourcount<=sync[tmpid+1][0]))
+ done=false;
}
+ }
- }//end of for
+ System.clearPrefetchCache();
+ }//end of for
} //end of run()
}
JGFInstrumentor.java \
JGFTimer.java \
SORRunner.java
-FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFSORBench.RandomMatrix -excprefetch JGFSORBench.init_sync -excprefetch JGFSORBench.JGFkernel -mainclass ${MAINCLASS} -trueprob 0.8
+FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFSORBench.RandomMatrix -excprefetch JGFSORBench.init_sync -excprefetch JGFSORBench.JGFkernel -mainclass ${MAINCLASS} -trueprob 0.80
FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS}
default:
- ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
- ../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC}
+# ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC}
+# ../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC}
../../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC}
../../../../buildscript ${FLAGS} -o ${MAINCLASS}1 ${SRC}
- ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}2NP ${SRC}
- ../../../../buildscript ${FLAGS} -o ${MAINCLASS}2 ${SRC}
- ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}4NP ${SRC}
- ../../../../buildscript ${FLAGS} -o ${MAINCLASS}4 ${SRC}
+ cp ${MAINCLASS}1NP.bin ${MAINCLASS}2NP.bin
+ cp ${MAINCLASS}1.bin ${MAINCLASS}2.bin
+ cp ${MAINCLASS}1NP.bin ${MAINCLASS}4NP.bin
+ cp ${MAINCLASS}1.bin ${MAINCLASS}4.bin
clean:
rm -rf tmpbuilddirectory