From: adash Date: Mon, 3 Nov 2008 03:34:50 +0000 (+0000) Subject: working version .... X-Git-Tag: buildscript^7~63 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=06d9993afb96c4ef19dcfc801f757ad6bc3976ee;p=IRC.git working version .... global array allocation in fft needs to address scaling problems --- diff --git a/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/Makefile b/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/Makefile index a2f85c7f..09f5170c 100644 --- a/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/Makefile +++ b/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/Makefile @@ -2,10 +2,27 @@ MAINCLASS=fft2d SRC=${MAINCLASS}.java \ fft1d.java \ Matrix.java -FLAGS = -dsm -optimize -mainclass ${MAINCLASS} +FLAGS =-dsm -dsmcaching -prefetch -transstats -optimize -excprefetch fft2d.main -excprefetch fft2d.twiddle -excprefetch fft1d.factorize -excprefetch fft1d.printFactors -excprefetch Matrix.setValues -trueprob 0.90 -mainclass ${MAINCLASS} +FLAGS1=-dsm -transstats -optimize -mainclass ${MAINCLASS} default: - ../../../../buildscript ${FLAGS} ${SRC} -o ${MAINCLASS} + ../../../../buildscript ${FLAGS1} ${SRC} -o ${MAINCLASS}NPNC + ../../../../buildscript ${FLAGS} ${SRC} -o ${MAINCLASS}N + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}1NPNC.bin + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}2NPNC.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}2.bin + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}3NPNC.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}3.bin + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}4NPNC.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}4.bin + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}5NPNC.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}5.bin + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}6NPNC.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}6.bin + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}7NPNC.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}7.bin + cp ${MAINCLASS}NPNC.bin ${MAINCLASS}8NPNC.bin + cp ${MAINCLASS}N.bin ${MAINCLASS}8.bin clean: rm -rf tmpbuilddirectory diff --git a/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft1d.java b/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft1d.java index 9a5759a2..b2fd03de 100644 --- a/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft1d.java +++ b/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft1d.java @@ -98,7 +98,7 @@ public class fft1d{ outputIm = global new double[N]; factorize(); - printFactors(); + //printFactors(); // Allocate memory for intermediate result of FFT. temRe = global new double[maxFactor]; //Check usage of this @@ -136,19 +136,20 @@ public class fft1d{ public void printFactors() { if (factorsWerePrinted) return; factorsWerePrinted = true; + System.printString("factors.length = " + factors.length + "\n"); for (int i = 0; i < factors.length; i++) - System.printString("factors[i] = " + factors[i]); + System.printString("factors[i] = " + factors[i] + "\n"); } public void factorize() { - int radices[] = new int[6]; + int radices[] = global new int[6]; radices[0] = 2; radices[1] = 3; radices[2] = 4; radices[3] = 5; radices[4] = 8; radices[5] = 10; - int temFactors[] = new int[MaxFactorsNumber]; + int temFactors[] = global new int[MaxFactorsNumber]; // 1 - point FFT, no need to factorize N. if (N == 1) { @@ -201,7 +202,7 @@ public class fft1d{ // maxFactor = 10; // Inverse temFactors and store factors into factors[]. - factors = new int[NumofFactors]; + factors = global new int[NumofFactors]; for (i = 0; i < NumofFactors; i++) { factors[i] = temFactors[NumofFactors - i - 1]; } @@ -210,8 +211,8 @@ public class fft1d{ // sofar[] : finished factors before the current stage. // factors[]: factors of N processed in the current stage. // remain[] : finished factors after the current stage. - sofar = new int[NumofFactors]; - remain = new int[NumofFactors]; + sofar = global new int[NumofFactors]; + remain = global new int[NumofFactors]; remain[0] = N / factors[0]; sofar[0] = 1; diff --git a/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft2d.java b/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft2d.java index b8e76a24..d1ec64dd 100644 --- a/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft2d.java +++ b/Robust/src/Benchmarks/Prefetch/2DFFT/dsm/fft2d.java @@ -12,9 +12,10 @@ public class fft2d extends Thread { public fft1d fft1, fft2; public Matrix data; public int x0, x1, y0, y1; + public double inputRe[], inputIm[]; // Constructor: 2-d FFT of Complex data. - public fft2d(Matrix data, fft1d fft1, fft1d fft2, int x0, int x1, int y0, int y1) { + public fft2d(double[] inputRe, double[] inputIm, Matrix data, fft1d fft1, fft1d fft2, int x0, int x1, int y0, int y1) { this.data = data; this.x0 = x0; this.x1 = x1; @@ -22,6 +23,8 @@ public class fft2d extends Thread { this.y1 = y1; this.fft1 = fft1; this.fft2 = fft2; + this.inputRe = inputRe; + this.inputIm = inputIm; } public void run() { @@ -29,10 +32,9 @@ public class fft2d extends Thread { barr = new Barrier("128.195.175.84"); double tempdataRe[][]; double tempdataIm[][]; + double mytemRe[][]; + double mytemIm[][]; int rowlength, columnlength; - double temRe[];// intermediate results - double temIm[]; - atomic { rowlength = data.M; //height @@ -41,8 +43,7 @@ public class fft2d extends Thread { tempdataIm = data.dataIm; // Calculate FFT for each row of the data. - // for (int i = 0; i < height; i++) - // fft1.fft(dataRe[i], dataIm[i]); + //System.printString("x0= " + x0 + " x1= " + x1 + " y0= "+ y0 + " y1= " + y1 + " width = " + columnlength + " height= " + rowlength+ "\n"); for (int i = x0; i < x1; i++) { int N = fft1.N; if(columnlength != N) { @@ -56,8 +57,8 @@ public class fft2d extends Thread { //output of FFT double outputRe[] = fft1.outputRe; //local array double outputIm[] = fft1.outputIm; - temRe = fft1.temRe; // intermediate results - temIm = fft1.temIm; + double temRe[] = fft1.temRe; // intermediate results + double temIm[] = fft1.temIm; int count[] = new int[fft1.MaxFactorsNumber]; int j; int k = 0; @@ -86,7 +87,6 @@ public class fft2d extends Thread { for (int factorIndex = 0; factorIndex < fft1.NumofFactors; factorIndex++) { twiddle(factorIndex, fft1, temRe, temIm, outputRe, outputIm); } - //System.printString("ready to copy"); // Copy the output[] data to input[], so the output can be // returned in the input array. for (int b = 0; b < N; b++) { @@ -94,20 +94,20 @@ public class fft2d extends Thread { inputIm[b] = outputIm[b]; } } - } + }//end of for } + //Start Barrier Barrier.enterBarrier(barr); // Tranpose data. - double mytemRe[][], mytemIm[][]; atomic { - tempdataRe = data.dataRe; - tempdataIm = data.dataIm; + mytemRe = new double[columnlength][rowlength]; + mytemIm = new double[columnlength][rowlength]; for(int i = x0; i