From ce11c387d993f0bfaaa94439c4491594f80c843d Mon Sep 17 00:00:00 2001 From: adash Date: Wed, 30 Apr 2008 09:11:43 +0000 Subject: [PATCH] barrier bug fix -> new hack and align prints --- .../Prefetch/LUFact/dsm/Barrier.java | 12 ++++---- .../Prefetch/LUFact/dsm/JGFInstrumentor.java | 30 +++++++++---------- .../LUFact/dsm/JGFLUFactBenchSizeA.java | 10 +++---- .../Prefetch/LUFact/dsm/JGFTimer.java | 20 ++++++------- .../Prefetch/LUFact/dsm/LinpackRunner.java | 7 +++++ 5 files changed, 44 insertions(+), 35 deletions(-) diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/Barrier.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/Barrier.java index 482b695a..fda1503f 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/Barrier.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/Barrier.java @@ -19,7 +19,7 @@ public class Barrier { public static void enterBarrier(Barrier b) { int tmp; - boolean retry=true; + boolean retry=true, ret1=false, ret2=true;; do { atomic { @@ -30,21 +30,23 @@ public class Barrier { if(b.numthreads > 1) b.cleared=true; b.entercount--; - return; + //return; + ret1 = true; } retry=false; } } } while(retry); - - while(true) { + if (ret1) return; + while(ret2) { atomic { if (b.cleared) { b.entercount--; int count = b.entercount; if (count==0) b.cleared=false; - return; + //return; + ret2=false; } } } diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java index fc737bec..5e89ddb9 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFInstrumentor.java @@ -31,7 +31,7 @@ public class JGFInstrumentor{ if (timers.containsKey(name)) { System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists"); + " already exists\n"); } else { timers.put(name, new JGFTimer(name)); @@ -42,7 +42,7 @@ public class JGFInstrumentor{ if (timers.containsKey(name)) { System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists"); + " already exists\n"); } else { timers.put(name, new JGFTimer(name,opname)); @@ -54,7 +54,7 @@ public class JGFInstrumentor{ if (timers.containsKey(name)) { System.printString("JGFInstrumentor.addTimer: warning - timer " + name + - " already exists"); + " already exists\n"); } else { timers.put(name, new JGFTimer(name,opname,size)); @@ -68,7 +68,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.startTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); } } @@ -79,7 +79,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.stopTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); } } @@ -89,7 +89,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.addOpsToTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); } } @@ -99,7 +99,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.addTimeToTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); } @@ -113,7 +113,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.readTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); time = 0.0; } return time; @@ -125,7 +125,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.resetTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); } } @@ -135,7 +135,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); } } @@ -145,7 +145,7 @@ public class JGFInstrumentor{ } else { System.printString("JGFInstrumentor.printTimer: failed - timer " + name + - " does not exist"); + " does not exist\n"); } } @@ -185,15 +185,15 @@ public class JGFInstrumentor{ header = base + "3 - Size B"; } - System.printString(header); + System.printString(header+"\n"); if (nthreads == 1) { - System.printString("Executing on " + nthreads + " thread"); + System.printString("Executing on " + nthreads + " thread\n"); } else { - System.printString("Executing on " + nthreads + " threads"); + System.printString("Executing on " + nthreads + " threads\n"); } - System.printString(""); + System.printString("\n"); } } diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java index e71f57fe..6c42f209 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFLUFactBenchSizeA.java @@ -24,8 +24,8 @@ public class JGFLUFactBenchSizeA { 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; } @@ -33,24 +33,24 @@ public class JGFLUFactBenchSizeA { JGFInstrumentor.printHeader(2,0,nthreads); JGFLUFactBench lub; atomic { - //lub = global new JGFLUFactBench(nthreads, instr); lub = global new JGFLUFactBench(nthreads); } int size = 0; - //lub.JGFrun(0); JGFInstrumentor.addTimer("Section2:LUFact:Kernel", "Mflops", size, instr.timers); atomic { lub.JGFsetsize(size); 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"); + System.printString("Validation failed\n"); } //JGFLUFactBench.JGFvalidate(lub); diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java index d65f4010..4e1d168f 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/JGFTimer.java @@ -53,7 +53,7 @@ public class JGFTimer { public void start(){ - if (on) System.printString("Warning timer " + " was already turned on"); + if (on) System.printString("Warning timer " + " was already turned on\n"); on = true; start_time = System.currentTimeMillis(); } @@ -61,7 +61,7 @@ public class JGFTimer { public void stop(){ time += (double) (System.currentTimeMillis()-start_time) / 1000.; - if (!on) System.printString("Warning timer " + " wasn't turned on"); + if (!on) System.printString("Warning timer " + " wasn't turned on\n"); calls++; on = false; } @@ -86,23 +86,23 @@ public class JGFTimer { } public void longprint(){ - System.printString("Timer Calls Time(s) Performance("+opname+"/s)"); - System.printString(name + " " + calls + " " + (long)time + " " + (long)this.perf()); + System.printString("Timer Calls Time(s) Performance("+opname+"/s)\n"); + System.printString(name + " " + calls + " " + (long)time + " " + (long)this.perf() + "\n"); } public void print(){ if (opname.equals("")) { - System.printString(name + " " + (long)time + " (s)"); + System.printString(name + " " + (long)time + " (s)\n"); } else { if(size == 0) { - System.printString(name + ":SizeA" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)"); + System.printString(name + ":SizeA" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); } else if (size == 1) { - System.printString(name + ":SizeB" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)"); + System.printString(name + ":SizeB" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); } else if (size == 2) { - System.printString(name + ":SizeC" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)"); + System.printString(name + ":SizeC" + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); } else{ - System.printString(name + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)"); + System.printString(name + "\t" + (long)time + " (s) \t " + (long)this.perf() + "\t" + " ("+opname+"/s)\n"); } } } @@ -117,7 +117,7 @@ public class JGFTimer { while ( name.length() < 40 ) name = name + " "; System.printString(name + "\t" + (long)this.perf() + "\t" - + " ("+opname+"/s)"); + + " ("+opname+"/s)\n"); } } diff --git a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java index e19fa177..e3d3f880 100644 --- a/Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java +++ b/Robust/src/Benchmarks/Prefetch/LUFact/dsm/LinpackRunner.java @@ -70,6 +70,8 @@ class LinpackRunner extends Thread { } // synchronise threads Barrier.enterBarrier(tmpbr); + System.clearPrefetchCache(); + // zero pivot implies this column already triangularized boolean b; atomic { @@ -77,6 +79,7 @@ class LinpackRunner extends Thread { } if (b) { Barrier.enterBarrier(tmpbr); + System.clearPrefetchCache(); // interchange if necessary atomic { if(lid == 0 ) { @@ -89,6 +92,7 @@ class LinpackRunner extends Thread { } // synchronise threads Barrier.enterBarrier(tmpbr); + System.clearPrefetchCache(); // compute multipliers atomic { t = -1.0/col_k[k]; @@ -98,6 +102,7 @@ class LinpackRunner extends Thread { } // synchronise threads Barrier.enterBarrier(tmpbr); + System.clearPrefetchCache(); // row elimination with column indexing atomic { slice = ((nlocal-kp1) + nthreads-1)/nthreads; @@ -118,10 +123,12 @@ class LinpackRunner extends Thread { } // synchronise threads Barrier.enterBarrier(tmpbr); + System.clearPrefetchCache(); } else { info = k; } Barrier.enterBarrier(tmpbr); + System.clearPrefetchCache(); } } -- 2.34.1