From 91fcb066b9737e5118c27c9870aa40027d5745f1 Mon Sep 17 00:00:00 2001 From: adash Date: Mon, 25 Jan 2010 20:01:21 +0000 Subject: [PATCH] add manual prefetches to the SOR benchmark --- .../ManualPrefetch/SOR/JGFInstrumentor.java | 199 ++++++++++++++++++ .../ManualPrefetch/SOR/JGFSORBench.java | 133 ++++++++++++ .../ManualPrefetch/SOR/JGFSORBenchSizeD.java | 64 ++++++ .../Prefetch/ManualPrefetch/SOR/JGFTimer.java | 123 +++++++++++ .../ManualPrefetch/SOR/SORRunner.java | 160 ++++++++++++++ .../Prefetch/ManualPrefetch/SOR/SORWrap.java | 9 + .../Prefetch/ManualPrefetch/SOR/makefile | 28 +++ 7 files changed, 716 insertions(+) create mode 100644 Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFInstrumentor.java create mode 100644 Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFSORBench.java create mode 100644 Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFSORBenchSizeD.java create mode 100644 Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFTimer.java create mode 100644 Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/SORRunner.java create mode 100644 Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/SORWrap.java create mode 100644 Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/makefile diff --git a/Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFInstrumentor.java b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFInstrumentor.java new file mode 100644 index 00000000..5e89ddb9 --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFInstrumentor.java @@ -0,0 +1,199 @@ +/************************************************************************** + * * + * Java Grande Forum Benchmark Suite - Thread Version 1.0 * + * * + * produced by * + * * + * Java Grande Benchmarking Project * + * * + * at * + * * + * Edinburgh Parallel Computing Centre * + * * + * email: epcc-javagrande@epcc.ed.ac.uk * + * * + * * + * This version copyright (c) The University of Edinburgh, 1999. * + * All rights reserved. * + * * + **************************************************************************/ +public class JGFInstrumentor{ + + protected HashMap timers; + protected HashMap data; + + public JGFInstrumentor() { + timers = new HashMap(); + data = new HashMap(); + } + + public static void addTimer (String name, HashMap timers){ + + if (timers.containsKey(name)) { + System.printString("JGFInstrumentor.addTimer: warning - timer " + name + + " already exists\n"); + } + else { + timers.put(name, new JGFTimer(name)); + } + } + + public static void addTimer (String name, String opname, HashMap timers){ + + if (timers.containsKey(name)) { + System.printString("JGFInstrumentor.addTimer: warning - timer " + name + + " already exists\n"); + } + else { + timers.put(name, new JGFTimer(name,opname)); + } + + } + + public static void addTimer (String name, String opname, int size, HashMap timers){ + + if (timers.containsKey(name)) { + System.printString("JGFInstrumentor.addTimer: warning - timer " + name + + " already exists\n"); + } + else { + timers.put(name, new JGFTimer(name,opname,size)); + } + + } + + public static void startTimer(String name, HashMap timers){ + if (timers.containsKey(name)) { + ((JGFTimer) timers.get(name)).start(); + } + else { + System.printString("JGFInstrumentor.startTimer: failed - timer " + name + + " does not exist\n"); + } + + } + + public static void stopTimer(String name, HashMap timers){ + if (timers.containsKey(name)) { + ((JGFTimer) timers.get(name)).stop(); + } + else { + System.printString("JGFInstrumentor.stopTimer: failed - timer " + name + + " does not exist\n"); + } + } + + public static void addOpsToTimer(String name, double count, HashMap timers){ + if (timers.containsKey(name)) { + ((JGFTimer) timers.get(name)).addops(count); + } + else { + System.printString("JGFInstrumentor.addOpsToTimer: failed - timer " + name + + " does not exist\n"); + } + } + + public static void addTimeToTimer(String name, double added_time, HashMap timers){ + if (timers.containsKey(name)) { + ((JGFTimer) timers.get(name)).addtime(added_time); + } + else { + System.printString("JGFInstrumentor.addTimeToTimer: failed - timer " + name + + " does not exist\n"); + } + + + + } + + public static double readTimer(String name, HashMap timers){ + double time; + if (timers.containsKey(name)) { + time = ((JGFTimer) timers.get(name)).time; + } + else { + System.printString("JGFInstrumentor.readTimer: failed - timer " + name + + " does not exist\n"); + time = 0.0; + } + return time; + } + + public static void resetTimer(String name, HashMap timers){ + if (timers.containsKey(name)) { + ((JGFTimer) timers.get(name)).reset(); + } + else { + System.printString("JGFInstrumentor.resetTimer: failed - timer " + name + + " does not exist\n"); + } + } + + public static void printTimer(String name, HashMap timers){ + if (timers.containsKey(name)) { + ((JGFTimer) timers.get(name)).print(); + } + else { + System.printString("JGFInstrumentor.printTimer: failed - timer " + name + + " does not exist\n"); + } + } + + public static void printperfTimer(String name, HashMap timers){ + if (timers.containsKey(name)) { + ((JGFTimer) timers.get(name)).printperf(); + } + else { + System.printString("JGFInstrumentor.printTimer: failed - timer " + name + + " does not exist\n"); + } + } + + public static void storeData(String name, Object obj, HashMap data){ + data.put(name,obj); + } + + public static void retrieveData(String name, Object obj, HashMap data){ + obj = data.get(name); + } + + public static void printHeader(int section, int size,int nthreads) { + + String header, base; + + header = ""; + base = "Java Grande Forum Thread Benchmark Suite - Version 1.0 - Section "; + + if (section == 1) + { + header = base + "1"; + } + else if (section == 2) + { + if (size == 0) + header = base + "2 - Size A"; + else if (size == 1) + header = base + "2 - Size B"; + else if (size == 2) + header = base + "2 - Size C"; + } + else if (section == 3) + { + if (size == 0) + header = base + "3 - Size A"; + else if (size == 1) + header = base + "3 - Size B"; + } + + System.printString(header+"\n"); + + if (nthreads == 1) { + System.printString("Executing on " + nthreads + " thread\n"); + } + else { + System.printString("Executing on " + nthreads + " threads\n"); + } + + System.printString("\n"); + } +} diff --git a/Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFSORBench.java b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFSORBench.java new file mode 100644 index 00000000..e5534d9e --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/ManualPrefetch/SOR/JGFSORBench.java @@ -0,0 +1,133 @@ +/************************************************************************** + * * + * Java Grande Forum Benchmark Suite - Thread Version 1.0 * + * * + * produced by * + * * + * Java Grande Benchmarking Project * + * * + * at * + * * + * Edinburgh Parallel Computing Centre * + * * + * email: epcc-javagrande@epcc.ed.ac.uk * + * * + * * + * This version copyright (c) The University of Edinburgh, 2001. * + * All rights reserved. * + * * + **************************************************************************/ +public class JGFSORBench { + + int size; + int[] datasizes; + int JACOBI_NUM_ITER; + long RANDOM_SEED; + public int nthreads; + public double Gtotal; + + public JGFSORBench(int nthreads){ + this.nthreads = nthreads; + datasizes = global new int[4]; + datasizes[0] = 1000; + datasizes[1] = 1500; + datasizes[2] = 2000; + datasizes[3] = 8000; + JACOBI_NUM_ITER = 100; + RANDOM_SEED = 10101010; + Gtotal = 0.0; + } + + public void JGFsetsize(int size){ + this.size = size; + } + + public static void JGFkernel(JGFSORBench sor) { + int numthreads, datasize; + BarrierServer mybarr; + + int[] mid = new int[8]; + mid[0] = (128<<24)|(195<<16)|(136<<8)|162; //dw-10 + mid[1] = (128<<24)|(195<<16)|(136<<8)|163; //dw-11 + mid[2] = (128<<24)|(195<<16)|(136<<8)|164; //dw-12 + mid[3] = (128<<24)|(195<<16)|(136<<8)|165; //dw-13 + mid[4] = (128<<24)|(195<<16)|(136<<8)|166; //dw-14 + mid[5] = (128<<24)|(195<<16)|(136<<8)|167; //dw-15 + mid[6] = (128<<24)|(195<<16)|(136<<8)|168; //dw-16 + mid[7] = (128<<24)|(195<<16)|(136<<8)|169; //dw-17 + + double[][] G; + int num_iterations; + long RANDOM_SEED; + + atomic { + numthreads = sor.nthreads; + datasize = sor.datasizes[sor.size]; + mybarr = global new BarrierServer(numthreads); + G = global new double[datasize][]; + num_iterations = sor.JACOBI_NUM_ITER; + RANDOM_SEED = sor.RANDOM_SEED; + } + mybarr.start(mid[0]); + + double omega = 1.25; + double omega_over_four = omega * 0.25; + double one_minus_omega = 1.0 - omega; + + // update interior points + // + //spawn threads + + SORWrap[] thobjects = new SORWrap[numthreads]; + + atomic { + for(int i=0;i Mm1) iupper = Mm1+1; + if (tmpid == (numthreads-1)) iupper = Mm1+1; + G[0]=global new double[N]; + for(int i=ilow;i