From: bdemsky Date: Thu, 8 May 2008 02:13:52 +0000 (+0000) Subject: hacked version X-Git-Tag: preEdgeChange~88 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3a17c34686dc747c2e41512c627e163c9dcea2e3;p=IRC.git hacked version --- diff --git a/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner2.java b/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner2.java new file mode 100644 index 00000000..8a1677e5 --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/SOR/dsm/SORRunner2.java @@ -0,0 +1,157 @@ +/************************************************************************** + * * + * 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 * + * * + * adapted from SciMark 2.0, author Roldan Pozo (pozo@cam.nist.gov) * + * * + * This version copyright (c) The University of Edinburgh, 2001. * + * All rights reserved. * + * * + **************************************************************************/ + +class SORRunner extends Thread { + + int id,num_iterations; + double G[][],omega; + double S[][]; + int sync[][]; + int nthreads; + + public SORRunner(int id, double omega, double G[][], int num_iterations,int[][] sync, int nthreads) { + this.id = id; + this.omega=omega; + this.G=G; + this.num_iterations=num_iterations; + this.sync=sync; + this.nthreads = nthreads; + } + + 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; + omega_over_four = omega * 0.25; + one_minus_omega = 1.0 - omega; + numthreads = nthreads; + tmpid = id; + numiterations = num_iterations; + } + + // update interior points + // + int Mm1 = M-1; + int Nm1 = N-1; + + + int ilow, iupper, slice, tslice, ttslice; + + tslice = (Mm1) / 2; + ttslice = (tslice + numthreads-1)/numthreads; + slice = ttslice*2; + ilow=tmpid*slice+1; + iupper = ((tmpid+1)*slice)+1; + if (iupper > Mm1) iupper = Mm1+1; + if (tmpid == (numthreads-1)) iupper = Mm1+1; + + for (int p=-2; p<2*numiterations; p++) { + if (p<0) { + int l=ilow; + if (l==1) + l=0; + if (p==-2) { + atomic { + S=global new double[iupper-l][N]; + for (int i=l; i