From: adash Date: Fri, 2 May 2008 01:46:02 +0000 (+0000) Subject: bug fixes and some more changes X-Git-Tag: preEdgeChange~123 X-Git-Url: http://plrg.eecs.uci.edu/git/?a=commitdiff_plain;h=ceead4e3634be8db2095f394542a2719313fdc9e;p=IRC.git bug fixes and some more changes --- diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java index 7479ea62..f094074c 100644 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d.java @@ -77,11 +77,8 @@ public class Em3d extends Thread } } - for (int i = 0; i < iteration; i++) { /* for eNodes */ - System.clearPrefetchCache(); - atomic { Node n = enodebase; for(int j = lowerlimit; j numThreads = " + numThreads); + int numThreads = 4; + int[] mid = new int[numThreads]; + mid[0] = (128<<24)|(195<<16)|(175<<8)|69; + mid[1] = (128<<24)|(195<<16)|(175<<8)|78; + mid[2] = (128<<24)|(195<<16)|(175<<8)|73; + mid[3] = (128<<24)|(195<<16)|(175<<8)|79; + System.printString("DEBUG -> numThreads = " + numThreads+"\n"); Barrier mybarr; atomic { mybarr = global new Barrier(numThreads); @@ -140,21 +141,23 @@ public class Em3d extends Thread // compute a single iteration of electro-magnetic propagation if (em.printMsgs) System.printString("Propagating field values for " + em.numIter + - " iteration(s)..."); + " iteration(s)...\n"); long start1 = System.currentTimeMillis(); Em3d[] em3d; atomic { em3d = global new Em3d[numThreads]; - em3d[0] = global new Em3d(graph, 0, em.numNodes, em.numIter, mybarr); + em3d[0] = global new Em3d(graph, 0, em.numNodes/4, em.numIter, mybarr); + em3d[1] = global new Em3d(graph, (em.numNodes/4) + 1, em.numNodes/2, em.numIter, mybarr); + em3d[2] = global new Em3d(graph, (em.numNodes/2) + 1, (3*em.numNodes)/4, em.numIter, mybarr); + em3d[3] = global new Em3d(graph, (3*em.numNodes)/4 + 1, em.numNodes, em.numIter, mybarr); } - int mid = (128<<24)|(195<<16)|(175<<8)|73; Em3d tmp; for(int i = 0; i -d [-p] [-m] [-h]"); - System.printString(" -n the number of nodes"); - System.printString(" -d the out-degree of each node"); - System.printString(" -i the number of iterations"); - System.printString(" -p (print detailed results)"); - System.printString(" -m (print informative messages)"); - System.printString(" -h (this message)"); + System.printString("usage: java Em3d -n -d [-p] [-m] [-h]\n"); + System.printString(" -n the number of nodes\n"); + System.printString(" -d the out-degree of each node\n"); + System.printString(" -i the number of iterations\n"); + System.printString(" -p (print detailed results\n)"); + System.printString(" -m (print informative messages)\n"); + System.printString(" -h (this message)\n"); } } diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java index b791cd81..328c7a5d 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBench.java @@ -74,22 +74,25 @@ public class JGFLUFactBench { } //JGFInstrumentor.startTimer("Section2:LUFact:Kernel", instr.timers); - LinpackRunner tmp; - int mid = (128<<24)|(195<<16)|(175<<8)|73; + int[] mid = new int[4]; + mid[0] = (128<<24)|(195<<16)|(175<<8)|73; + mid[1] = (128<<24)|(195<<16)|(175<<8)|69; + mid[2] = (128<<24)|(195<<16)|(175<<8)|78; + mid[3] = (128<<24)|(195<<16)|(175<<8)|79; for(int i=1;i lref) { //System.printString("Validation failed"); - System.printString("Computed Norm Res = " + (long) residn * 1000000); - System.printString("Reference Norm Res = " + (long) ref[size] * 1000000); + //System.printString("Computed Norm Res = " + (long) residn * 1000000); + //System.printString("Reference Norm Res = " + (long) ref[size] * 1000000); return 1; } else { return 0; @@ -409,45 +413,4 @@ public class JGFLUFactBench { } } } - /* - public static void JGFvalidate(JGFLUFactBench lub) { - int i; - double eps,residn; - double[] ref; - - ref = new double[3]; - ref[0] = 6.0; - ref[1] = 12.0; - ref[2] = 20.0; - - atomic { - for (i = 0; i < lub.n; i++) { - lub.x[i] = lub.b[i]; - } - lub.norma = lub.matgen(lub.a,lub.lda,lub.n,lub.b); - for (i = 0; i < lub.n; i++) { - lub.b[i] = -(lub.b[i]); - } - - lub.dmxpy(lub.n,lub.b,lub.n,lub.lda,lub.x,lub.a); - lub.resid = 0.0; - lub.normx = 0.0; - for (i = 0; i < lub.n; i++) { -//resid = (resid > abs(b[i])) ? resid : abs(b[i]); -//normx = (normx > abs(x[i])) ? normx : abs(x[i]); -if (lub.resid <= abs(lub.b[i])) lub.resid = lub.abs(lub.b[i]); -if (lub.normx <= abs(lub.x[i])) lub.normx = lub.abs(lub.x[i]); -} -eps = lub.epslon((double)1.0); -residn = lub.resid/( lub.n*lub.norma*lub.normx*eps ); -} - -if (residn > ref[size]) { -System.printString("Validation failed"); -System.printString("Computed Norm Res = " + (long) residn); -System.printString("Reference Norm Res = " + (long) ref[size]); -} -} -*/ - } diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java index 6c42f209..be556243 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java @@ -43,20 +43,14 @@ public class JGFLUFactBenchSizeA { lub.JGFinitialise(); } JGFLUFactBench.JGFkernel(lub); - System.printString("End of JGFkernel\n"); int retval; atomic { retval = lub.JGFvalidate(); } - System.printString("End of JGFvalidate\n"); if(retval == 1) { System.printString("Validation failed\n"); } - //JGFLUFactBench.JGFvalidate(lub); - // atomic { - // lub.JGFvalidate(); - //} double ops; atomic { ops = lub.ops; diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile index 651ffc88..8b7b40f2 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/makefile @@ -6,13 +6,13 @@ JGFTimer.java \ Barrier.java \ Linpack.java \ LinpackRunner.java -FLAGS=-dsm -prefetch -optimize -debug -profile -excprefetch JGFLUFactBench.JGFkernel -excprefetch JGFLUFactBench.dmxpy -excprefetch JGFLUFactBench.JGFvalidate -excprefetch JGFLUFactBench.JGFinitialise -excprefetch JGFLUFactBench.matgen -excprefetch JGFLUFactBench.dgesl -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8 -FLAGS2=-dsm -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP +FLAGS=-dsm -prefetch -nooptimize -debug -profile -excprefetch JGFLUFactBench.JGFkernel -excprefetch JGFLUFactBench.dmxpy -excprefetch JGFLUFactBench.JGFvalidate -excprefetch JGFLUFactBench.JGFinitialise -excprefetch JGFLUFactBench.matgen -excprefetch JGFLUFactBench.dgesl -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8 +FLAGS2=-dsm -nooptimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP default: ../../../../buildscript ${FLAGS2} ${SRC} ../../../../buildscript ${FLAGS} ${SRC} clean: - rm -rf tmpbuildirectory + rm -rf tmpbuilddirectory rm *.bin diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java b/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java index 71caa044..4cc54a6c 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/java/JGFLUFactBench.java @@ -33,7 +33,6 @@ public class JGFLUFactBench { int ipvt[]; public JGFLUFactBench(int nthreads, JGFInstrumentor instr) { - //public JGFLUFactBench(int nthreads) { this.nthreads=nthreads; this.instr = instr; datasizes = new int[3]; diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java index c72ebab5..3fa7505b 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java @@ -96,7 +96,11 @@ public class JGFMolDynBench { br= global new Barrier(numthreads); } - int mid = (128<<24)|(195<<16)|(175<<8)|73; + int[] mid = new int[4]; + mid[0] = (128<<24)|(195<<16)|(175<<8)|73; + mid[1] = (128<<24)|(195<<16)|(175<<8)|69; + mid[2] = (128<<24)|(195<<16)|(175<<8)|79; + mid[3] = (128<<24)|(195<<16)|(175<<8)|78; mdRunner tmp; for(int i=1;i vaverh) { count = count + 1.0; } - vel = vel + velt; - } - - vel = vel / h; - - /* temperature scale if required */ - - if((move < istop) && (((move+1) % irep) == 0)) { - sc = Math.sqrt(tref / (tscale*ekin)); - for (i=0;i vaverh) { count = count + 1.0; } + vel = vel + velt; + } + vel = vel / h; + /* temperature scale if required */ + + if((move < istop) && (((move+1) % irep) == 0)) { + sc = Math.sqrt(tref / (tscale*ekin)); + for (i=0;i 1.0e-10 ){ + long l = (long) refval[size] *1000000; + long r = (long) dval * 1000000; + if (l != r ){ System.printString("Validation failed\n"); System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n"); } diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile index 7b6529e6..f50cb0f8 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile @@ -3,7 +3,7 @@ SRC=${MAINCLASS}.java \ JGFInstrumentor.java \ JGFTimer.java \ JGFMolDynBench.java \ -DebugBarrier.java +Barrier.java FLAGS=-dsm -prefetch -excprefetch particle.force -excprefetch particle.domove -excprefetch particle.mkekin -excprefetch TournamentBarrier.DoBarrier -excprefetch JGFMolDynBench.JGFvalidate -excprefetch JGFMolDynBench.JGFapplication -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.8 FLAGS2=-dsm -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS}NP @@ -12,5 +12,5 @@ default: ../../../../buildscript ${FLAGS} ${SRC} clean: - rm -rf tmpbuildirectory + rm -rf tmpbuilddirectory/ rm *.bin diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java index 4e947197..b0f1a1b7 100644 --- a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java +++ b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java @@ -58,7 +58,6 @@ public class JGFSORBench { double[][] G; int M, N; atomic { - //G = global new double[datasize][datasize]; G = sor.RandomMatrix(datasize, datasize, rand); M = G.length; N = G[0].length; @@ -92,20 +91,23 @@ public class JGFSORBench { //JGFInstrumentor.startTimer("Section2:SOR:Kernel", instr.timers); SORRunner tmp; - int mid = (128<<24)|(195<<16)|(175<<8)|73; + int[] mid = new int[4]; + mid[0] = (128<<24)|(195<<16)|(175<<8)|69; + mid[1] = (128<<24)|(195<<16)|(175<<8)|78; + mid[2] = (128<<24)|(195<<16)|(175<<8)|73; + mid[3] = (128<<24)|(195<<16)|(175<<8)|79; for(int i=1;i 1.0e-12 ){ + long l = (long) refval[size] * 1000000; + long r = (long) Gtotal * 1000000; + if (l != r ){ //System.printString("Validation failed"); //System.printString("Gtotal = " + (long) Gtotal * 1000000 + " " +(long) dev * 1000000 + " " + size); return 1; @@ -161,29 +165,4 @@ public class JGFSORBench { return 0; } } - - /* - public void JGFtidyup(){ - System.gc(); - } - - public void JGFrun(int size){ - - - JGFInstrumentor.addTimer("Section2:SOR:Kernel", "Iterations",size); - - JGFsetsize(size); - JGFinitialise(); - JGFkernel(); - JGFvalidate(); - JGFtidyup(); - - - JGFInstrumentor.addOpsToTimer("Section2:SOR:Kernel", (double) (JACOBI_NUM_ITER)); - - JGFInstrumentor.printTimer("Section2:SOR:Kernel"); - } - */ - - } diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBenchSizeA.java index dd9fd607..23f27224 100644 --- a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBenchSizeA.java +++ b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBenchSizeA.java @@ -27,8 +27,8 @@ public class JGFSORBenchSizeA{ if(argv.length != 0 ) { nthreads = Integer.parseInt(argv[0]); } else { - System.printString("The no of threads has not been specified, defaulting to 1"); - System.printString(" "); + System.printString("The no of threads has not been specified, defaulting to 1\n"); + System.printString(" \n"); nthreads = 1; } @@ -47,13 +47,12 @@ public class JGFSORBenchSizeA{ sor.JGFsetsize(size); } JGFSORBench.JGFkernel(sor); - System.printString("End of JGFkernel\n"); int retval; atomic { retval = sor.JGFvalidate(); } if(retval!=0) { - System.printString("Validation failed"); + System.printString("Validation failed\n"); } int jacobi; diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner.java index a4d00872..bc909730 100644 --- a/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner.java +++ b/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner.java @@ -21,6 +21,7 @@ class SORRunner extends Thread { + int donecount, prevvalue; int id,num_iterations; double G[][],omega; long sync[][]; @@ -33,12 +34,14 @@ class SORRunner extends Thread { this.num_iterations=num_iterations; this.sync=sync; this.nthreads = nthreads; + this.prevvalue = 0; + this.donecount = 0; } public void run() { - int tmpid, M, N, numthreads; double omega_over_four, one_minus_omega; + int numiterations; atomic { M = G.length; N = G[0].length; @@ -46,6 +49,7 @@ class SORRunner extends Thread { one_minus_omega = 1.0 - omega; numthreads = nthreads; tmpid = id; + numiterations = num_iterations; } // update interior points @@ -65,7 +69,7 @@ class SORRunner extends Thread { if (tmpid == (numthreads-1)) iupper = Mm1+1; atomic { - for (int p=0; p<2*num_iterations; p++) { + for (int p=0; p<2*numiterations; p++) { for (int i=ilow+(p%2); i prevvalue) { + donecount++; + } + } + if (id == 0) { + donecount = 0; + prevvalue++; + } + /* // Wait for neighbours; if (id > 0) { + System.printString("id: " + id + " sync: id-1 0 " + sync[id-1][0] + " id 0" + sync[id][0] + "\n"); while (sync[id-1][0] < sync[id][0]) ; + System.printString("id: " + id + " sync: id-1 0 " + sync[id-1][0] + " id 0" + sync[id][0] + "\n"); } if (id < nthreads -1) { + System.printString("id: " + id + " sync: id 0 " + sync[id][0] + " id+1 0" + sync[id+1][0] + "\n"); while (sync[id+1][0] < sync[id][0]) ; + System.printString("id: " + id + " sync: id 0 " + sync[id][0] + " id+1 0" + sync[id+1][0] + "\n"); } - }//end of outer for - }//end of atomic - }//end of run + */ + } + } //end of atomic + } //end of run() }