From 7e05a14d642c2279053478d86f770f1c222953f3 Mon Sep 17 00:00:00 2001 From: bdemsky Date: Sat, 9 Aug 2008 08:07:15 +0000 Subject: [PATCH] do sane array allocation now --- .../Prefetch/SOR/dsm/JGFSORBench.java | 80 +++++-------------- .../Prefetch/SOR/dsm/SORRunner.java | 41 ++++++---- .../Benchmarks/Prefetch/SOR/dsm/SORWrap.java | 9 +++ .../src/Benchmarks/Prefetch/SOR/dsm/makefile | 3 +- 4 files changed, 58 insertions(+), 75 deletions(-) create mode 100644 Robust/src/Benchmarks/Prefetch/SOR/dsm/SORWrap.java diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java index 30cef014..c4cae028 100644 --- a/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java +++ b/Robust/src/Benchmarks/Prefetch/SOR/dsm/JGFSORBench.java @@ -24,7 +24,6 @@ public class JGFSORBench { int JACOBI_NUM_ITER; long RANDOM_SEED; public int nthreads; - Random R; public double Gtotal; public JGFSORBench(int nthreads){ @@ -35,7 +34,6 @@ public class JGFSORBench { datasizes[2] = 2000; JACOBI_NUM_ITER = 100; RANDOM_SEED = 10101010; - R = global new Random(RANDOM_SEED); Gtotal = 0.0; } @@ -46,7 +44,6 @@ public class JGFSORBench { public static void JGFkernel(JGFSORBench sor) { int numthreads, datasize; BarrierServer mybarr; - Random rand; int[] mid = new int[4]; mid[0] = (128<<24)|(195<<16)|(175<<8)|79; @@ -54,43 +51,34 @@ public class JGFSORBench { mid[2] = (128<<24)|(195<<16)|(175<<8)|78; mid[3] = (128<<24)|(195<<16)|(175<<8)|69; + double[][] G; + int num_iterations; + atomic { numthreads = sor.nthreads; - rand = sor.R; datasize = sor.datasizes[sor.size]; mybarr = global new BarrierServer(numthreads); + G = global new double[datasize][]; + num_iterations = sor.JACOBI_NUM_ITER; } mybarr.start(mid[0]); - double[][] G; - int M, N; - atomic { - G = sor.RandomMatrix(datasize, datasize, rand); - M = G.length; - N = G[0].length; - } double omega = 1.25; - int num_iterations; - atomic { - num_iterations = sor.JACOBI_NUM_ITER; - } - double omega_over_four = omega * 0.25; double one_minus_omega = 1.0 - omega; // update interior points // - int Mm1 = M-1; - int Nm1 = N-1; - //spawn threads - SORRunner[] thobjects; + + SORWrap[] thobjects = new SORWrap[numthreads]; + atomic { - thobjects = global new SORRunner[numthreads]; + for(int i=0;i Mm1) iupper = Mm1+1; + if (tmpid == (numthreads-1)) iupper = Mm1+1; + for(int i=ilow;i Mm1) iupper = Mm1+1; - if (tmpid == (numthreads-1)) iupper = Mm1+1; for (int p=0; p<2*numiterations; p++) { atomic { diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORWrap.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORWrap.java new file mode 100644 index 00000000..5606094c --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORWrap.java @@ -0,0 +1,9 @@ +public class SORWrap { + public global SORRunner sor; + public SORWrap() { + } + + public SORWrap(SORRunner e) { + sor=e; + } +} \ No newline at end of file diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile b/Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile index a2b55b5b..57e526a0 100644 --- a/Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile +++ b/Robust/src/Benchmarks/Prefetch/SOR/dsm/makefile @@ -3,7 +3,8 @@ SRC=${MAINCLASS}.java \ JGFSORBench.java \ JGFInstrumentor.java \ JGFTimer.java \ - SORRunner.java + SORRunner.java \ + SORWrap.java FLAGS=-dsm -prefetch -optimize -excprefetch JGFSORBench.JGFSORBench -excprefetch JGFSORBenchSizeA.main -excprefetch JGFSORBench.RandomMatrix -excprefetch JGFSORBench.init_sync -excprefetch JGFSORBench.JGFkernel -mainclass ${MAINCLASS} -trueprob 0.88 FLAGS2=-dsm -optimize -mainclass ${MAINCLASS} -- 2.34.1