From: adash Date: Tue, 8 Dec 2009 18:21:13 +0000 (+0000) Subject: modified rectangular matrix for convolution X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=66d63f32a5a89813dea72d597ed75743db566e7c;p=IRC.git modified rectangular matrix for convolution --- diff --git a/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionRect.java b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionRect.java new file mode 100644 index 00000000..17a144bc --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/2DConv/dsm/ConvolutionRect.java @@ -0,0 +1,425 @@ +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=15; + int kernelWidth=15; + + double[][] kernel = new double[kernelHeight][kernelWidth]; + initKernel15(kernel); + + atomic { + int myx0=x0; + int myy0=y0; + int myx1=x1; + int myy1=y1; + + double tempinput[][] = img.inputImage; + double tempout[][] = img.outputImage; + + double tinput1[] = tempinput[myx0+0]; + double tinput2[] = tempinput[myx0+1]; + double tinput3[] = tempinput[myx0+2]; + double tinput4[] = tempinput[myx0+3]; + double tinput5[] = tempinput[myx0+4]; + double tinput6[] = tempinput[myx0+5]; + double tinput7[] = tempinput[myx0+6]; + double tinput8[] = tempinput[myx0+7]; + double tinput9[] = tempinput[myx0+8]; + double tinput10[] = tempinput[myx0+9]; + double tinput11[] = tempinput[myx0+10]; + double tinput12[] = tempinput[myx0+11]; + double tinput13[] = tempinput[myx0+12]; + double tinput14[] = tempinput[myx0+13]; + double tinput0[] = tinput1; + + int l=myx0+14; + for(int i=myx0;i0) { + NUM_THREADS = Integer.parseInt(args[0]); + if(args.length>1) { + WIDTH = Integer.parseInt(args[1]); + if(args.length>2) + HEIGHT = Integer.parseInt(args[2]); + } + } + + 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 + + Image img; + Convolution[] conv; + Convolution tmp; + + atomic { + img = global new Image(HEIGHT,WIDTH,kernelHeight,kernelWidth); + img.setValues(); + conv = global new Convolution[NUM_THREADS]; + int increment=HEIGHT/NUM_THREADS; + int base = 0; + for(int i = 0; i