//
// Code borrowed from :Java Digital Signal Processing book by Lyon and Rao
- public Matrix data1, data2;
+ public Matrix data1;
public int x0, x1;
// Constructor: 2-d FFT of Complex data.
- public fft2d(Matrix data1, Matrix data2, int x0, int x1) {
+ public fft2d(Matrix data1, int x0, int x1) {
this.data1 = data1;
- this.data2 = data2;
this.x0 = x0;
this.x1 = x1;
}
end = x1;
fft1 = new fft1d(columnlength);
fft2 = new fft1d(rowlength);
- for (int i = x0; i < x1; i++) {
+ int l=8;
+ for (int i = x0; i < x1; i++,l++) {
//input of FFT
- double inputRe[] = tempdataRe[i]; //local array
+ double inputRe[] = tempdataRe[i]; //local array
double inputIm[] = tempdataIm[i];
fft(fft1, inputRe, inputIm);
} //end of for
// Tranpose data.
if (start == 0) {
atomic {
- transpose(tempdataRe,tempdataIm, data2.dataRe,data2.dataIm, rowlength, columnlength);
+ transpose(tempdataRe, tempdataIm, rowlength, columnlength);
}
}
double transtempRe[][];
double transtempIm[][];
atomic {
- transtempRe = data2.dataRe;
- transtempIm = data2.dataIm;
- for (int j = start; j < end; j++) {
+ transtempRe = data1.dataRe;
+ transtempIm = data1.dataIm;
+ int l=8;
+ for (int j = start; j < end; j++,l++) {
//input of FFT
double inputRe[] = transtempRe[j]; //local array
double inputIm[] = transtempIm[j];
}
} //end of run
- public void transpose(double[][] tempdataRe, double[][] tempdataIm, double[][] outputRe,
- double[][] outputIm, int rowlength, int columnlength) {
+ public void transpose(double[][] tempdataRe, double[][] tempdataIm, int rowlength, int columnlength) {
for(int i = 0; i<rowlength; i++) {
double tRe[] = tempdataRe[i];
double tIm[] = tempdataIm[i];
- for(int j = 0; j<columnlength; j++) {
- outputRe[j][i] = tRe[j];
- outputIm[j][i] = tIm[j];
+ double a;
+
+ for(int j = 0; j<i; j++) {
+ a=tempdataRe[j][i];
+ tempdataRe[j][i] = tRe[j];
+ tRe[j]=a;
+ a=tempdataIm[j][i];
+ tempdataIm[j][i] = tIm[j];
+ tIm[j]=a;
}
}
}
mybarr.start(mid[0]);
Matrix data1;
- Matrix data2;
// Create threads to do FFT
fft2d[] myfft2d;
atomic {
// Set up data for FFT transform
data1 = global new Matrix(SIZE, SIZE);
- data2 = global new Matrix(SIZE, SIZE);
data1.setValues(); //Input Matrix
- data2.setZeros(); //Transpose Matrix
myfft2d = global new fft2d[NUM_THREADS];
int increment = SIZE/NUM_THREADS;
int base = 0;
for(int i =0 ; i<NUM_THREADS; i++) {
if((i+1)==NUM_THREADS)
- myfft2d[i] = global new fft2d(data1, data2, base, SIZE);
+ myfft2d[i] = global new fft2d(data1, base, SIZE);
else
- myfft2d[i] = global new fft2d(data1, data2, base, base+increment);
+ myfft2d[i] = global new fft2d(data1, base, base+increment);
base+=increment;
}
}
public class Array extends Thread {
- int [][] array;
+ int [][][] array;
- public Array() {
- int xmax=10000;
- int ymax=10;
- array=global new int[xmax][ymax];
- for(int i=0;i<xmax;i++) {
- for(int j=0;j<ymax;j++) {
- array[i][j]=i*j;
+ public Array() {
+ int xmax=100;
+ int ymax=4000;
+ int zmax=10;
+ array=global new int[xmax][ymax][zmax];
+ for(int i=0;i<xmax;i++) {
+ for(int j=0;j<ymax;j++) {
+ for(int k=0;k<zmax;k++) {
+ array[i][j][k]=i*j+k;
}
}
}
-
- public static void main(String [] argv) {
- Array a;
- atomic {
- a=global new Array();
- }
- a.start((128<<24)|(195<<16)|(136<<8)|162);
- a.join();
+ }
+
+ public static void main(String [] argv) {
+ Array a;
+ atomic {
+ a=global new Array();
}
-
- public void run() {
- atomic {
- int xlength=array.length;
- int ylength=array[0].length;
- long sum;
- for(int i=0;i<xlength;i++) {
- int a[]=array[i];
- for(int j=0;j<ylength;j++) {
- sum+=a[j];
- }
+ a.start((128<<24)|(195<<16)|(136<<8)|162);
+ a.join();
+ }
+
+ public void run() {
+ atomic {
+ int xlength=array.length;
+ int ylength=array[0].length;
+ int zlength=array[0][0].length;
+ long sum;
+ for(int i=0;i<xlength;i++) {
+ int a[][]=array[i];
+ for(int j=0;j<ylength;j++) {
+ int a2[]=a[j];
+ for(int k=0;k<zlength;k++) {
+ sum+=a2[k];
}
}
+ }
}
+ }
}
FLAGS2=-dsm -optimize -mainclass ${MAINCLASS}
default:
../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC ${SRC1}
- ../../../buildscript ${FLAGS1} -o ${MAINCLASS}NP ${SRC1}
- ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
- cp ${MAINCLASS}NPNC.bin ${MAINCLASS}1NPNC.bin
- cp ${MAINCLASS}NP.bin ${MAINCLASS}1NP.bin
- cp ${MAINCLASS}P.bin ${MAINCLASS}1.bin
+ ../../../buildscript ${FLAGS1} -o ${MAINCLASS}NPC ${SRC1}
+# ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
clean:
rm -rf tmpbuilddirectory
public static void main(String [] argv) {
Chase c;
- int numTraverse = 10000;
+ int numTraverse = 10000;
+ if (argv.length>0)
+ numTraverse=Integer.parseInt(argv[0]);
+
atomic {
- System.println("Starting transaction\n");
Foo fold=global new Foo();
for(int i=0;i<numTraverse;i++) {
c=global new Chase(fold);
}
+ System.out.println("Starting");
c.start((128<<24)|(195<<16)|(136<<8)|162);
c.join();
- System.out.println("Finished");
+ System.out.println("Finished");
}
public void run() {
-<<<<<<< Chase.java
- for (int j=0;j<10;j++) {
- atomic {
- Foo b=base;
- int i = 0;
- while(b!=null) {
-=======
atomic {
Foo b=base;
int i = 0;
while(b!=null) {
->>>>>>> 1.6
b=b.next;
-<<<<<<< Chase.java
- i++;
-=======
i++;
- if((i&127) == 0)
- ;
->>>>>>> 1.6
}
-<<<<<<< Chase.java
- }
- }
-=======
}
->>>>>>> 1.6
}
}
MAINCLASS=Chase
SRC1=${MAINCLASS}.java
-#FLAGS=-dsm -prefetch -dsmcaching -optimize -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.7
-FLAGS2=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.7
-FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} -trueprob 0.7
+#FLAGS=-dsm -prefetch -dsmcaching -optimize -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.98
+FLAGS2=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.99
+FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} -trueprob 0.99
#for testing no java option
#FLAGS=-dsm -prefetch -optimize -debug -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.99 -nojava
default:
../../../buildscript ${FLAGS3} -o ${MAINCLASS}NPNC ${SRC1}
- ../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
+ ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPC ${SRC1}
clean:
rm -rf tmpbuilddirectory
offsets1[3] = (short) 0;
System.rangePrefetch(o1, offsets1);
+ /*
+ offsets1[0] = getoffset{mdRunner, sh_force};
+ offsets1[1] = (short) 0;
+ offsets1[2] = (short) 0;
+ offsets1[3] = (short) 2;
+ System.rangePrefetch(this, offsets1);
+
+ offsets1[0] = getoffset{mdRunner, sh_force2};
+ offsets1[1] = (short) 0;
+ System.rangePrefetch(this, offsets1);
+ */
/////////////////////
mdsize = mymd.PARTSIZE;
//PREFETCH: sh_force[0..2][0..mdsize]
atomic {
/*
- short[] offsets1 = new short[6];
+ short[] offsets1 = new short[4];
offsets1[0] = getoffset{mdRunner, sh_force};
offsets1[1] = (short) 0;
offsets1[2] = (short) 0;
offsets1[3] = (short) 2;
- offsets1[4] = (short) 0;
- offsets1[5] = (short) (mdsize -1);
System.rangePrefetch(this, offsets1);
*/
/* move the particles and update velocities */
atomic {
/*
Object o = this.sh_force;
- short[] offsets1 = new short[4];
+ short[] offsets1 = new short[2];
offsets1[0] = (short) 0;
offsets1[1] = (short) 2;
- offsets1[2] = (short) 0;
- offsets1[3] = (short) (mdsize -1);
System.rangePrefetch(o, offsets1);
*/