From 404ffe69721e7076fc0734a4d0106be105e2c1fa Mon Sep 17 00:00:00 2001 From: adash Date: Fri, 25 Apr 2008 07:52:10 +0000 Subject: [PATCH] bug fixes --- .../Prefetch/Moldyn/dsm/JGFInstrumentor.java | 30 +- .../Prefetch/Moldyn/dsm/JGFMolDynBench.java | 414 +++++++++--------- .../Moldyn/dsm/JGFMolDynBenchSizeA.java | 11 +- .../Prefetch/Moldyn/dsm/JGFTimer.java | 20 +- .../Moldyn/dsm/TournamentBarrier.java | 2 +- .../Benchmarks/Prefetch/Moldyn/dsm/makefile | 2 +- 6 files changed, 240 insertions(+), 239 deletions(-) diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFInstrumentor.java index fc737bec..3f9f580c 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFInstrumentor.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/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/Moldyn/dsm/JGFMolDynBench.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java index b7ce77eb..5e2b6921 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBench.java @@ -28,9 +28,9 @@ public class JGFMolDynBench { public int PARTSIZE; - public global double[] epot; - public global double[] vir; - public global double[] ek; + public double[] epot; + public double[] vir; + public double[] ek; int size,mm; int[] datasizes; @@ -38,12 +38,11 @@ public class JGFMolDynBench { public int interactions; public int[] interacts; - public global int nthreads; - public global JGFInstrumentor instr; + public int nthreads; + public JGFInstrumentor instr; - public JGFMolDynBench(int nthreads, JGFInstrumentor instr) { + public JGFMolDynBench(int nthreads) { this.nthreads=nthreads; - this.instr = instr; } public void JGFsetsize(int size){ @@ -52,7 +51,7 @@ public class JGFMolDynBench { public void JGFinitialise(){ interactions = 0; - datasizes = new int[2]; + datasizes = global new int[2]; datasizes[0] = 8; datasizes[1] = 13; @@ -65,8 +64,6 @@ public class JGFMolDynBench { kb = 1.38066e-23; TSIM = 50; deltat = 5e-16; - - //initialise(); } public static void JGFapplication(JGFMolDynBench mold) { @@ -84,11 +81,14 @@ public class JGFMolDynBench { numthreads = mold.nthreads; } - double sh_force [][] = new double[3][partsize]; - double sh_force2 [][][] = new double[3][numthreads][partsize]; + double sh_force [][]; + double sh_force2 [][][]; + atomic { + sh_force = global new double[3][partsize]; + sh_force2 = global new double[3][numthreads][partsize]; + } // spawn threads - //Thread thobjects[] = new Thread [nthreads]; mdRunner[] thobjects; TournamentBarrier br; atomic { @@ -101,16 +101,18 @@ public class JGFMolDynBench { for(int i=1;i 1.0e-10 ){ - //System.printString("Validation failed"); - //System.printString("Kinetic Energy = " + (long)ek[0] + " " + (long)dev + " " + size); + //System.printString("Validation failed\n"); + //System.printString("Kinetic Energy = " + (long)ek[0] + " " + (long)dev + " " + size + "\n"); } } } @@ -157,20 +159,18 @@ class mdRunner extends Thread { TournamentBarrier br; random randnum; - JGFInstrumentor instr; JGFMolDynBench mymd; int nthreads; particle[] one; public mdRunner(int id, int mm, double [][] sh_force, double [][][] sh_force2,TournamentBarrier br, - JGFInstrumentor instr, int nthreads, JGFMolDynBench mymd) { + int nthreads, JGFMolDynBench mymd) { this.id=id; this.mm=mm; this.sh_force=sh_force; this.sh_force2=sh_force2; this.br=br; - this.instr = instr; this.nthreads = nthreads; this.mymd = mymd; count = 0.0; @@ -189,32 +189,38 @@ class mdRunner extends Thread { atomic { mdsize = mymd.PARTSIZE; - } - one = global new particle [mdsize]; - atomic { + one = global new particle[mdsize]; l = mymd.LENGTH; } - side = Math.pow((mdsize/den),0.3333333); - rcoff = mm/4.0; - - a = side/mm; - sideh = side*0.5; - hsq = h*h; - hsq2 = hsq*0.5; - npartm = mdsize - 1; - rcoffs = rcoff * rcoff; - tscale = 16.0 / (1.0 * mdsize - 1.0); - vaver = 1.13 * Math.sqrt(tref / 24.0); - vaverh = vaver * h; - - /* Particle Generation */ - - xvelocity = 0.0; - yvelocity = 0.0; - zvelocity = 0.0; - - ijk = 0; + int tmpmdsize; + double tmpden; + atomic { + tmpmdsize = mdsize; + tmpden = den; + } + + atomic { + side = Math.pow((tmpmdsize/tmpden),0.3333333); + rcoff = mm/4.0; + + a = side/mm; + sideh = side*0.5; + hsq = h*h; + hsq2 = hsq*0.5; + npartm = tmpmdsize - 1; + rcoffs = rcoff * rcoff; + tscale = 16.0 / (1.0 * tmpmdsize - 1.0); + vaver = 1.13 * Math.sqrt(tref / 24.0); + vaverh = vaver * h; + + /* Particle Generation */ + + xvelocity = 0.0; + yvelocity = 0.0; + zvelocity = 0.0; + ijk = 0; + } atomic { for (lg=0; lg<=1; lg++) { for (i=0; i vaverh) { count = count + 1.0; } - vel = vel + velt; - } + for (i=0;i vaverh) { count = count + 1.0; } + vel = vel + velt; + } - vel = vel / h; + vel = vel / h; - /* temperature scale if required */ + /* temperature scale if required */ - if((move < istop) && (((move+1) % irep) == 0)) { - sc = Math.sqrt(tref / (tscale*ekin)); - for (i=0;i 1.0e-10 ){ - System.printString("Validation failed"); - System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size); + System.printString("Validation failed\n"); + System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n"); } JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers); diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFTimer.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFTimer.java index d65f4010..4e1d168f 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFTimer.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/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/Moldyn/dsm/TournamentBarrier.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/TournamentBarrier.java index 266e3cc0..56259b45 100755 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/TournamentBarrier.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/TournamentBarrier.java @@ -40,7 +40,7 @@ public class TournamentBarrier { // Initialise the IsDone array. The choice of initial value is // arbitrary, but must be consistent! - IsDone = new boolean[numThreads]; + IsDone = global new boolean[numThreads]; for(int i = 0; i < n; i++) { IsDone[i] = false; } diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile index f1ad9c84..1d8fed82 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/makefile @@ -4,7 +4,7 @@ JGFInstrumentor.java \ JGFTimer.java \ JGFMolDynBench.java \ TournamentBarrier.java -FLAGS=-dsm -prefetch -optimize -debug -profile -mainclass ${MAINCLASS} -o ${MAINCLASS} -trueprob 0.5 +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 default: -- 2.34.1