From: adash Date: Mon, 10 Nov 2008 04:02:24 +0000 (+0000) Subject: new 2D convolution benchmark X-Git-Tag: buildscript^7~47 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=eab3e216a6479afc68eeab5e3cae170f490ec255;p=IRC.git new 2D convolution benchmark --- diff --git a/Robust/src/Benchmarks/Prefetch/2DConv/dsm/Convolution.java b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/Convolution.java new file mode 100644 index 00000000..edcf3e6f --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/Convolution.java @@ -0,0 +1,162 @@ +public class Convolution extends Thread { + Image img; + int x0,x1,y0,y1; + + public Convolution(Image img, int x0, int x1, int y0, int y1) { + this.img = img; + this.x0 = x0; + this.x1 = x1; + this.y0 = y0; + this.y1 = y1; + } + + public void run() { + int kernelHeight = 5; + int kernelWidth = 5; + double[][] kernel = new double[kernelHeight][kernelWidth]; + + atomic { + initKernel(kernel); + double tempinput[][] = img.inputImage; + double tempout[][] = img.outputImage; + + double tinput0[] = tempinput[x0]; + double tinput1[] = tempinput[x0+1]; + double tinput2[] = tempinput[x0+2]; + double tinput3[] = tempinput[x0+3]; + double tinput4[] = tempinput[x0+4]; + + for(int i=x0;i0) { + NUM_THREADS = Integer.parseInt(args[0]); + if(args.length>1) + SIZE = Integer.parseInt(args[1]); + } + + int[] mid = new int[8]; + mid[0] = (128<<24)|(195<<16)|(175<<8)|84; //dw-10 + mid[1] = (128<<24)|(195<<16)|(175<<8)|85; //dw-11 + mid[2] = (128<<24)|(195<<16)|(175<<8)|86; //dw-12 + mid[3] = (128<<24)|(195<<16)|(175<<8)|87; //dw-13 + mid[4] = (128<<24)|(195<<16)|(175<<8)|88; //dw-14 + mid[5] = (128<<24)|(195<<16)|(175<<8)|89; //dw-15 + mid[6] = (128<<24)|(195<<16)|(175<<8)|90; //dw-16 + mid[7] = (128<<24)|(195<<16)|(175<<8)|91; //dw-17 + + Image img; + Convolution[] conv; + Convolution tmp; + + int kernelHeight = 5; + int kernelWidth = 5; + atomic { + img = global new Image(SIZE,SIZE,kernelHeight,kernelWidth); + img.setValues(); + conv = global new Convolution[NUM_THREADS]; + int increment=SIZE/NUM_THREADS; + int base = 0; + for(int i = 0; i0) { + NUM_THREADS = Integer.parseInt(args[0]); + if(args.length>1) + SIZE = Integer.parseInt(args[1]); + } + + Image img; + Convolution[] conv; + Convolution tmp; + + int kernelHeight = 5; + int kernelWidth = 5; + img = new Image(SIZE,SIZE,kernelHeight,kernelWidth); + img.setValues(); + conv = new Convolution[NUM_THREADS]; + int increment=SIZE/NUM_THREADS; + int base = 0; + for(int i = 0; i