case FKind.FlatMethod:
case FKind.FlatOffsetNode:
- //System.out.println("In FKind.FlatOffsetNode\n");
processOffsetNode((FlatOffsetNode)fn, currtable);
break;
boolean isnative=md.getModifiers().isNative();
boolean isjoin = md.getClassDesc().getSymbol().equals(TypeUtil.ThreadClass)&&!nodemd.getModifiers().isStatic()&&nodemd.numParameters()==0&&md.getSymbol().equals("join");
+ boolean isObjectgetType = md.getClassDesc().getSymbol().equals("Object") && md.getSymbol().equals("getType");
+ boolean isObjecthashCode = md.getClassDesc().getSymbol().equals("Object") && md.getSymbol().equals("nativehashCode");
LocalityBinding lb=new LocalityBinding(md, isatomic);
if (isnative&&isatomic) {
throw new Error("Using type that can be either local or global in context:\n"+currlb.getExplanation());
if(runmethodset==null&&thistype.equals(GLOBAL)&&!isatomic && !isjoin)
throw new Error("Using global object outside of transaction in context:\n"+currlb.getExplanation());
- if (runmethodset==null&&isnative&&thistype.equals(GLOBAL) && !isjoin)
+ if (runmethodset==null&&isnative&&thistype.equals(GLOBAL) && !isjoin && !isObjectgetType && !isObjecthashCode)
throw new Error("Potential call to native method "+md+" on global objects:\n"+currlb.getExplanation());
lb.setGlobalThis(thistype);
}
}
}
for (int i = 0; i < numtrans; i++) {
- Random rand = new Random(i);
- int rdwr = rand.nextInt(100);
- int rwkey = rand.nextInt(nobjs*numthreads);
- Integer k = new Integer(rwkey);
- if (rdwr < rdprob) {
- Integer tmp = mydhmap.get(k);
- } else {
- Integer val = global new Integer(i);
- mydhmap.put(k, val);
+ atomic {
+ Random rand = new Random(i);
+ int rdwr = rand.nextInt(100);
+ int rwkey = rand.nextInt(nobjs*numthreads);
+ Integer key = global new Integer(rwkey);
+ Object o1 = key;
+ if (rdwr < rdprob) {
+ Object o3 = mydhmap.get(key);
+ } else {
+ Integer val = global new Integer(i);
+ Object o2 = val;
+ mydhmap.put(key, val);
+ mydhmap.put(o1, o2);
+ }
}
}
}
SRC1=${MAINCLASS}.java \
../../../ClassLibrary/DistributedHashMap.java
FLAGS1=-dsm -dsmcaching -rangeprefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.90
-FLAGS2=-dsm -optimize -mainclass ${MAINCLASS}
+FLAGS2=-dsm -dsmcaching -prefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.90
+FLAGS3=-dsm -optimize -mainclass ${MAINCLASS}
default:
-# ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC ${SRC1}
- ../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangePN ${SRC1}
+ ../../../buildscript ${FLAGS3} -o ${MAINCLASS}NPNC ${SRC1}
+ ../../../buildscript ${FLAGS2} -o ${MAINCLASS}RangePN ${SRC1}
+ ../../../buildscript ${FLAGS1} -o ${MAINCLASS}N ${SRC1}
clean:
rm -rf tmpbuilddirectory
}
}
+ /*
atomic{
System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
}
+ */
System.printString("Convolution: Size=");
System.printInt(SIZE);
System.printString("2DConv Done!\n");
+ /*
atomic{
System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
}
+ */
}
//define 5X5 Gaussian kernel
--- /dev/null
+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 {
+ double tempinput[][] = img.inputImage;
+ double tempout[][] = img.outputImage;
+
+ double tinput1[] = tempinput[x0];
+ double tinput2[] = tempinput[x0+1];
+ double tinput3[] = tempinput[x0+2];
+ double tinput4[] = tempinput[x0+3];
+ double tinput5[] = tempinput[x0+4];
+ double tinput6[] = tempinput[x0+5];
+ double tinput7[] = tempinput[x0+6];
+ double tinput8[] = tempinput[x0+7];
+ double tinput9[] = tempinput[x0+8];
+ double tinput10[] = tempinput[x0+9];
+ double tinput11[] = tempinput[x0+10];
+ double tinput12[] = tempinput[x0+11];
+ double tinput13[] = tempinput[x0+12];
+ double tinput14[] = tempinput[x0+13];
+ double tinput0[] = tinput1;
+
+ int l=x0+14;
+ for(int i=x0;i<x1;i++,l++){
+ double tout[] = tempout[i];
+ tinput0 = tinput1; tinput1=tinput2; tinput2=tinput3; tinput3=tinput4; tinput4=tinput5;
+ tinput5 = tinput6; tinput6=tinput7; tinput7=tinput8; tinput8=tinput9; tinput9=tinput10;
+ tinput10 = tinput11; tinput11=tinput12; tinput12=tinput13; tinput13=tinput14; tinput14=tempinput[l];
+ for(int j=y0;j<y1;++j){
+ double s=0;
+ for(int b=0;b<kernelHeight;++b) {
+ s+=(tinput0[j+b] * kernel[0][b] + tinput1[j+b] * kernel[1][b] + tinput2[j+b]*kernel[2][b] +
+ tinput3[j+b]*kernel[3][b] + tinput4[j+b]*kernel[4][b] + tinput5[j+b]*kernel[5][b]+
+ tinput6[j+b]*kernel[6][b] + tinput7[j+b]*kernel[7][b] + tinput8[j+b]*kernel[8][b]+
+ tinput9[j+b]*kernel[9][b] + tinput10[j+b]*kernel[10][b] + tinput11[j+b]*kernel[11][b]+
+ tinput12[j+b]*kernel[12][b]+ tinput13[j+b]*kernel[13][b] + tinput14[j+b]*kernel[14][b]);
+ }
+ tout[j]=s;
+ }
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ int SIZE = 256;
+ int NUM_THREADS = 1;
+ int kernelHeight=15, kernelWidth=15;
+
+ if(args.length>0) {
+ 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)|(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(SIZE,SIZE,kernelHeight,kernelWidth);
+ img.setValues();
+ conv = global new Convolution[NUM_THREADS];
+ int increment=SIZE/NUM_THREADS;
+ int base = 0;
+ for(int i = 0; i<NUM_THREADS; i++) {
+ if((i+1)==NUM_THREADS)
+ conv[i] = global new Convolution(img, base, SIZE, 0, SIZE);
+ else
+ conv[i] = global new Convolution(img, base, base+increment, 0, SIZE);
+ base+=increment;
+ }
+ }
+
+ /*
+ atomic{
+ System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+ System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
+ }
+ */
+
+ System.printString("Convolution: Size=");
+ System.printInt(SIZE);
+ System.printString("\n");
+
+ for(int i = 0; i <NUM_THREADS; i++) {
+ atomic {
+ tmp = conv[i];
+ }
+ tmp.start(mid[i]);
+ }
+
+ for(int i = 0; i < NUM_THREADS; i++) {
+ atomic {
+ tmp = conv[i];
+ }
+ tmp.join();
+ }
+
+ System.printString("2DConv Done!\n");
+
+ /*
+ atomic{
+ System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+ System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
+ }
+ */
+ }
+
+ //define 15X15 Gaussian kernel
+ public static void initKernel15(double[][] kernel) {
+ kernel[0][0] = 1/256.0;
+ kernel[0][1] = 4/256.0;
+ kernel[0][2] = 6/256.0;
+ kernel[0][3] = 8/256.0;
+ kernel[0][4] = 10/256.0;
+ kernel[0][5] = 12/256.0;
+ kernel[0][6] = 14/256.0;
+ kernel[0][7] = 16/256.0;
+ kernel[0][8] = 14/256.0;
+ kernel[0][9] = 12/256.0;
+ kernel[0][10] = 10/256.0;
+ kernel[0][11] = 8/256.0;
+ kernel[0][12] = 6/256.0;
+ kernel[0][13] = 4/256.0;
+ kernel[0][14] = 1/256.0;
+
+ kernel[1][0] = 4/256.0;
+ kernel[1][1] = 16/256.0;
+ kernel[1][2] = 24/256.0;
+ kernel[1][3] = 32/256.0;
+ kernel[1][4] = 40/256.0;
+ kernel[1][5] = 48/256.0;
+ kernel[1][6] = 56/256.0;
+ kernel[1][7] = 64/256.0;
+ kernel[1][8] = 56/256.0;
+ kernel[1][9] = 48/256.0;
+ kernel[1][10] = 40/256.0;
+ kernel[1][11] = 32/256.0;
+ kernel[1][12] = 24/256.0;
+ kernel[1][13] = 16/256.0;
+ kernel[1][14] = 4/256.0;
+
+ kernel[2][0] = 6/256.0;
+ kernel[2][1] = 24/256.0;
+ kernel[2][2] = 36/256.0;
+ kernel[2][3] = 48/256.0;
+ kernel[2][4] = 60/256.0;
+ kernel[2][5] = 72/256.0;
+ kernel[2][6] = 84/256.0;
+ kernel[2][7] = 96/256.0;
+ kernel[2][8] = 84/256.0;
+ kernel[2][9] = 72/256.0;
+ kernel[2][10] = 60/256.0;
+ kernel[2][11] = 48/256.0;
+ kernel[2][12] = 36/256.0;
+ kernel[2][13] = 24/256.0;
+ kernel[2][14] = 6/256.0;
+
+ kernel[3][0] = 8/256.0;
+ kernel[3][1] = 32/256.0;
+ kernel[3][2] = 48/256.0;
+ kernel[3][3] = 64/256.0;
+ kernel[3][4] = 80/256.0;
+ kernel[3][5] = 96/256.0;
+ kernel[3][6] = 112/256.0;
+ kernel[3][7] = 128/256.0;
+ kernel[3][8] = 112/256.0;
+ kernel[3][9] = 96/256.0;
+ kernel[3][10] = 80/256.0;
+ kernel[3][11] = 64/256.0;
+ kernel[3][12] = 48/256.0;
+ kernel[3][13] = 32/256.0;
+ kernel[3][14] = 8/256.0;
+
+
+ kernel[4][0] = 10/256.0;
+ kernel[4][1] = 40/256.0;
+ kernel[4][2] = 60/256.0;
+ kernel[4][3] = 80/256.0;
+ kernel[4][4] = 100/256.0;
+ kernel[4][5] = 120/256.0;
+ kernel[4][6] = 140/256.0;
+ kernel[4][7] = 160/256.0;
+ kernel[4][8] = 140/256.0;
+ kernel[4][9] = 120/256.0;
+ kernel[4][10] = 100/256.0;
+ kernel[4][11] = 80/256.0;
+ kernel[4][12] = 60/256.0;
+ kernel[4][13] = 40/256.0;
+ kernel[4][14] = 10/256.0;
+
+ kernel[5][0] = 12/256.0;
+ kernel[5][1] = 48/256.0;
+ kernel[5][2] = 72/256.0;
+ kernel[5][3] = 96/256.0;
+ kernel[5][4] = 120/256.0;
+ kernel[5][5] = 144/256.0;
+ kernel[5][6] = 168/256.0;
+ kernel[5][7] = 192/256.0;
+ kernel[5][8] = 168/256.0;
+ kernel[5][9] = 144/256.0;
+ kernel[5][10] = 120/256.0;
+ kernel[5][11] = 96/256.0;
+ kernel[5][12] = 72/256.0;
+ kernel[5][13] = 48/256.0;
+ kernel[5][14] = 12/256.0;
+
+ kernel[6][0] = 14/256.0;
+ kernel[6][1] = 56/256.0;
+ kernel[6][2] = 84/256.0;
+ kernel[6][3] = 112/256.0;
+ kernel[6][4] = 140/256.0;
+ kernel[6][5] = 168/256.0;
+ kernel[6][6] = 196/256.0;
+ kernel[6][7] = 224/256.0;
+ kernel[6][8] = 196/256.0;
+ kernel[6][9] = 168/256.0;
+ kernel[6][10] = 140/256.0;
+ kernel[6][11] = 112/256.0;
+ kernel[6][12] = 84/256.0;
+ kernel[6][13] = 56/256.0;
+ kernel[6][14] = 14/256.0;
+
+ kernel[7][0] = 16/256.0;
+ kernel[7][1] = 64/256.0;
+ kernel[7][2] = 96/256.0;
+ kernel[7][3] = 128/256.0;
+ kernel[7][4] = 160/256.0;
+ kernel[7][5] = 192/256.0;
+ kernel[7][6] = 224/256.0;
+ kernel[7][7] = 256/256.0;
+ kernel[7][8] = 224/256.0;
+ kernel[7][9] = 192/256.0;
+ kernel[7][10] = 160/256.0;
+ kernel[7][11] = 128/256.0;
+ kernel[7][12] = 96/256.0;
+ kernel[7][13] = 64/256.0;
+ kernel[7][14] = 16/256.0;
+
+ kernel[8][0] = 14/256.0;
+ kernel[8][1] = 56/256.0;
+ kernel[8][2] = 84/256.0;
+ kernel[8][3] = 112/256.0;
+ kernel[8][4] = 140/256.0;
+ kernel[8][5] = 168/256.0;
+ kernel[8][6] = 196/256.0;
+ kernel[8][7] = 224/256.0;
+ kernel[8][8] = 196/256.0;
+ kernel[8][9] = 168/256.0;
+ kernel[8][10] = 140/256.0;
+ kernel[8][11] = 112/256.0;
+ kernel[8][12] = 84/256.0;
+ kernel[8][13] = 56/256.0;
+ kernel[8][14] = 14/256.0;
+
+ kernel[9][0] = 12/256.0;
+ kernel[9][1] = 48/256.0;
+ kernel[9][2] = 72/256.0;
+ kernel[9][3] = 96/256.0;
+ kernel[9][4] = 120/256.0;
+ kernel[9][5] = 144/256.0;
+ kernel[9][6] = 168/256.0;
+ kernel[9][7] = 192/256.0;
+ kernel[9][8] = 168/256.0;
+ kernel[9][9] = 144/256.0;
+ kernel[9][10] = 120/256.0;
+ kernel[9][11] = 96/256.0;
+ kernel[9][12] = 72/256.0;
+ kernel[9][13] = 48/256.0;
+ kernel[9][14] = 12/256.0;
+
+ kernel[10][0] = 10/256.0;
+ kernel[10][1] = 40/256.0;
+ kernel[10][2] = 60/256.0;
+ kernel[10][3] = 80/256.0;
+ kernel[10][4] = 100/256.0;
+ kernel[10][5] = 120/256.0;
+ kernel[10][6] = 140/256.0;
+ kernel[10][7] = 160/256.0;
+ kernel[10][8] = 140/256.0;
+ kernel[10][9] = 120/256.0;
+ kernel[10][10] = 100/256.0;
+ kernel[10][11] = 80/256.0;
+ kernel[10][12] = 60/256.0;
+ kernel[10][13] = 40/256.0;
+ kernel[10][14] = 10/256.0;
+
+ kernel[11][0] = 8/256.0;
+ kernel[11][1] = 32/256.0;
+ kernel[11][2] = 48/256.0;
+ kernel[11][3] = 64/256.0;
+ kernel[11][4] = 80/256.0;
+ kernel[11][5] = 96/256.0;
+ kernel[11][6] = 112/256.0;
+ kernel[11][7] = 128/256.0;
+ kernel[11][8] = 112/256.0;
+ kernel[11][9] = 96/256.0;
+ kernel[11][10] = 80/256.0;
+ kernel[11][11] = 64/256.0;
+ kernel[11][12] = 48/256.0;
+ kernel[11][13] = 32/256.0;
+ kernel[11][14] = 8/256.0;
+
+ kernel[12][0] = 6/256.0;
+ kernel[12][1] = 24/256.0;
+ kernel[12][2] = 36/256.0;
+ kernel[12][3] = 48/256.0;
+ kernel[12][4] = 60/256.0;
+ kernel[12][5] = 72/256.0;
+ kernel[12][6] = 84/256.0;
+ kernel[12][7] = 96/256.0;
+ kernel[12][8] = 84/256.0;
+ kernel[12][9] = 72/256.0;
+ kernel[12][10] = 60/256.0;
+ kernel[12][11] = 48/256.0;
+ kernel[12][12] = 36/256.0;
+ kernel[12][13] = 24/256.0;
+ kernel[12][14] = 6/256.0;
+
+ kernel[13][0] = 4/256.0;
+ kernel[13][1] = 16/256.0;
+ kernel[13][2] = 24/256.0;
+ kernel[13][3] = 32/256.0;
+ kernel[13][4] = 40/256.0;
+ kernel[13][5] = 48/256.0;
+ kernel[13][6] = 56/256.0;
+ kernel[13][7] = 64/256.0;
+ kernel[13][8] = 56/256.0;
+ kernel[13][9] = 48/256.0;
+ kernel[13][10] = 40/256.0;
+ kernel[13][11] = 32/256.0;
+ kernel[13][12] = 24/256.0;
+ kernel[13][13] = 16/256.0;
+ kernel[13][14] = 4/256.0;
+
+ kernel[14][0] = 1/256.0;
+ kernel[14][1] = 4/256.0;
+ kernel[14][2] = 6/256.0;
+ kernel[14][3] = 8/256.0;
+ kernel[14][4] = 10/256.0;
+ kernel[14][5] = 12/256.0;
+ kernel[14][6] = 14/256.0;
+ kernel[14][7] = 16/256.0;
+ kernel[14][8] = 14/256.0;
+ kernel[14][9] = 12/256.0;
+ kernel[14][10] = 10/256.0;
+ kernel[14][11] = 8/256.0;
+ kernel[14][12] = 6/256.0;
+ kernel[14][13] = 4/256.0;
+ kernel[14][14] = 1/256.0;
+ }
+}
+
+public class Image {
+ int width, height;
+ int kernelWidth, kernelHeight;
+ double[][] inputImage;
+ double[][] outputImage;
+
+ public Image(int width, int height, int kernelWidth, int kernelHeight) {
+ this.width = width;
+ this.height = height;
+ this.kernelWidth = kernelWidth;
+ this.kernelHeight = kernelHeight;
+ inputImage = global new double[height+kernelHeight-1][width+kernelWidth-1];
+ outputImage = global new double[height][width];
+ }
+
+ /* Create a valid image */
+ public void setValues() {
+ for (int i = 0; i < (height+kernelHeight - 1); i++) {
+ double ainput[] = inputImage[i];
+ for(int j = 0; j < (width+kernelWidth - 1); j++) {
+ ainput[j] = 256-j;
+ }
+ }
+
+ for (int i = 0; i < height; i++){
+ double aout[] = outputImage[i];
+ for(int j = 0; j < width; j++) {
+ aout[j] = 0;
+ }
+ }
+ }
+}
MAINCLASS=Convolution
SRC=${MAINCLASS}.java
SRC1=${MAINCLASS}SizeB.java
-FLAGS =-dsm -dsmcaching -prefetch -optimize -excprefetch Image.initKernel -excprefetch Image.setValues -excprefetch Convolution.main -trueprob 0.90 -mainclass ${MAINCLASS}
+SRC2=${MAINCLASS}SizeC.java
+FLAGS =-dsm -dsmcaching -prefetch -optimize -excprefetch Image.initKernel -excprefetch Image.setValues -excprefetch Convolution.main -trueprob 0.95 -mainclass ${MAINCLASS}
FLAGS1=-dsm -optimize -mainclass ${MAINCLASS}
default:
# ../../../../buildscript ${FLAGS1} ${SRC} -o ${MAINCLASS}NPNC
# ../../../../buildscript ${FLAGS} ${SRC} -o ${MAINCLASS}N
- ../../../../buildscript ${FLAGS1} ${SRC1} -o ${MAINCLASS}NPNC
- ../../../../buildscript ${FLAGS} ${SRC1} -o ${MAINCLASS}N
+# ../../../../buildscript ${FLAGS1} ${SRC1} -o ${MAINCLASS}NPNC
+# ../../../../buildscript ${FLAGS} ${SRC1} -o ${MAINCLASS}N
+ ../../../../buildscript ${FLAGS1} ${SRC2} -o ${MAINCLASS}NPNC
+ ../../../../buildscript ${FLAGS} ${SRC2} -o ${MAINCLASS}N
clean:
rm -rf tmpbuilddirectory
kernel[0][10] = 1/256.0;
kernel[1][0] = 4/256.0;
- kernel[1][1] = 8/256.0;
+ kernel[1][1] = 16/256.0;
kernel[1][2] = 24/256.0;
kernel[1][3] = 32/256.0;
kernel[1][4] = 40/256.0;
--- /dev/null
+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);
+
+ double tempinput[][] = img.inputImage;
+ double tempout[][] = img.outputImage;
+
+ double tinput1[] = tempinput[x0];
+ double tinput2[] = tempinput[x0+1];
+ double tinput3[] = tempinput[x0+2];
+ double tinput4[] = tempinput[x0+3];
+ double tinput5[] = tempinput[x0+4];
+ double tinput6[] = tempinput[x0+5];
+ double tinput7[] = tempinput[x0+6];
+ double tinput8[] = tempinput[x0+7];
+ double tinput9[] = tempinput[x0+8];
+ double tinput10[] = tempinput[x0+9];
+ double tinput11[] = tempinput[x0+10];
+ double tinput12[] = tempinput[x0+11];
+ double tinput13[] = tempinput[x0+12];
+ double tinput14[] = tempinput[x0+13];
+ double tinput0[] = tinput1;
+
+ int l=x0+14;
+ for(int i=x0;i<x1;i++,l++){
+ double tout[] = tempout[i];
+ tinput0 = tinput1; tinput1=tinput2; tinput2=tinput3; tinput3=tinput4; tinput4=tinput5;
+ tinput5 = tinput6; tinput6=tinput7; tinput7=tinput8; tinput8=tinput9; tinput9=tinput10;
+ tinput10 = tinput11; tinput11=tinput12; tinput12=tinput13; tinput13=tinput14; tinput14=tempinput[l];
+ for(int j=y0;j<y1;++j){
+ double s=0;
+ for(int b=0;b<kernelHeight;++b) {
+ s+=(tinput0[j+b] * kernel[0][b] + tinput1[j+b] * kernel[1][b] + tinput2[j+b]*kernel[2][b]+
+ tinput3[j+b]*kernel[3][b] + tinput4[j+b]*kernel[4][b] + tinput5[j+b]*kernel[5][b]+
+ tinput6[j+b]*kernel[6][b] + tinput7[j+b]*kernel[7][b] + tinput8[j+b]*kernel[8][b]+
+ tinput9[j+b]*kernel[9][b] + tinput10[j+b]*kernel[10][b] + tinput11[j+b]*kernel[11][b]+
+ tinput12[j+b]*kernel[12][b]+ tinput13[j+b]*kernel[13][b] + tinput14[j+b]*kernel[14][b]);
+ }
+ tout[j]=s;
+ }
+ }
+ }
+
+ public static void main(String[] args) {
+ int SIZE = 256;
+ int NUM_THREADS = 1;
+ int kernelHeight=15, kernelWidth=15;
+
+ if(args.length>0) {
+ NUM_THREADS = Integer.parseInt(args[0]);
+ if(args.length>1) {
+ SIZE = Integer.parseInt(args[1]);
+ }
+ }
+
+ Image img;
+ Convolution[] conv;
+ Convolution tmp;
+
+ 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<NUM_THREADS; i++) {
+ if((i+1)==NUM_THREADS)
+ conv[i] = new Convolution(img, base, SIZE, 0, SIZE);
+ else
+ conv[i] = new Convolution(img, base, base+increment, 0, SIZE);
+ base+=increment;
+ }
+
+ /*
+ System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+ System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
+ */
+
+ System.printString("Convolution: Size=");
+ System.printInt(SIZE);
+ System.printString("\n");
+
+ for(int i = 0; i <NUM_THREADS; i++) {
+ tmp = conv[i];
+ tmp.run();
+ }
+
+ /*
+ System.printString("img.outputImage[10][20] = " +(int) img.outputImage[10][20] + "\n");
+ System.printString("img.outputImage[256][890] = " +(int) img.outputImage[256][890] + "\n");
+ */
+ System.printString("2DConv Done!\n");
+ }
+
+ //define 15X15 Gaussian kernel
+ public static void initKernel15(double[][] kernel) {
+ kernel[0][0] = 1/256.0;
+ kernel[0][1] = 4/256.0;
+ kernel[0][2] = 6/256.0;
+ kernel[0][3] = 8/256.0;
+ kernel[0][4] = 10/256.0;
+ kernel[0][5] = 12/256.0;
+ kernel[0][6] = 14/256.0;
+ kernel[0][7] = 16/256.0;
+ kernel[0][8] = 14/256.0;
+ kernel[0][9] = 12/256.0;
+ kernel[0][10] = 10/256.0;
+ kernel[0][11] = 8/256.0;
+ kernel[0][12] = 6/256.0;
+ kernel[0][13] = 4/256.0;
+ kernel[0][14] = 1/256.0;
+
+ kernel[1][0] = 4/256.0;
+ kernel[1][1] = 16/256.0;
+ kernel[1][2] = 24/256.0;
+ kernel[1][3] = 32/256.0;
+ kernel[1][4] = 40/256.0;
+ kernel[1][5] = 48/256.0;
+ kernel[1][6] = 56/256.0;
+ kernel[1][7] = 64/256.0;
+ kernel[1][8] = 56/256.0;
+ kernel[1][9] = 48/256.0;
+ kernel[1][10] = 40/256.0;
+ kernel[1][11] = 32/256.0;
+ kernel[1][12] = 24/256.0;
+ kernel[1][13] = 16/256.0;
+ kernel[1][14] = 4/256.0;
+
+ kernel[2][0] = 6/256.0;
+ kernel[2][1] = 24/256.0;
+ kernel[2][2] = 36/256.0;
+ kernel[2][3] = 48/256.0;
+ kernel[2][4] = 60/256.0;
+ kernel[2][5] = 72/256.0;
+ kernel[2][6] = 84/256.0;
+ kernel[2][7] = 96/256.0;
+ kernel[2][8] = 84/256.0;
+ kernel[2][9] = 72/256.0;
+ kernel[2][10] = 60/256.0;
+ kernel[2][11] = 48/256.0;
+ kernel[2][12] = 36/256.0;
+ kernel[2][13] = 24/256.0;
+ kernel[2][14] = 6/256.0;
+
+ kernel[3][0] = 8/256.0;
+ kernel[3][1] = 32/256.0;
+ kernel[3][2] = 48/256.0;
+ kernel[3][3] = 64/256.0;
+ kernel[3][4] = 80/256.0;
+ kernel[3][5] = 96/256.0;
+ kernel[3][6] = 112/256.0;
+ kernel[3][7] = 128/256.0;
+ kernel[3][8] = 112/256.0;
+ kernel[3][9] = 96/256.0;
+ kernel[3][10] = 80/256.0;
+ kernel[3][11] = 64/256.0;
+ kernel[3][12] = 48/256.0;
+ kernel[3][13] = 32/256.0;
+ kernel[3][14] = 8/256.0;
+
+
+ kernel[4][0] = 10/256.0;
+ kernel[4][1] = 40/256.0;
+ kernel[4][2] = 60/256.0;
+ kernel[4][3] = 80/256.0;
+ kernel[4][4] = 100/256.0;
+ kernel[4][5] = 120/256.0;
+ kernel[4][6] = 140/256.0;
+ kernel[4][7] = 160/256.0;
+ kernel[4][8] = 140/256.0;
+ kernel[4][9] = 120/256.0;
+ kernel[4][10] = 100/256.0;
+ kernel[4][11] = 80/256.0;
+ kernel[4][12] = 60/256.0;
+ kernel[4][13] = 40/256.0;
+ kernel[4][14] = 10/256.0;
+
+ kernel[5][0] = 12/256.0;
+ kernel[5][1] = 48/256.0;
+ kernel[5][2] = 72/256.0;
+ kernel[5][3] = 96/256.0;
+ kernel[5][4] = 120/256.0;
+ kernel[5][5] = 144/256.0;
+ kernel[5][6] = 168/256.0;
+ kernel[5][7] = 192/256.0;
+ kernel[5][8] = 168/256.0;
+ kernel[5][9] = 144/256.0;
+ kernel[5][10] = 120/256.0;
+ kernel[5][11] = 96/256.0;
+ kernel[5][12] = 72/256.0;
+ kernel[5][13] = 48/256.0;
+ kernel[5][14] = 12/256.0;
+
+ kernel[6][0] = 14/256.0;
+ kernel[6][1] = 56/256.0;
+ kernel[6][2] = 84/256.0;
+ kernel[6][3] = 112/256.0;
+ kernel[6][4] = 140/256.0;
+ kernel[6][5] = 168/256.0;
+ kernel[6][6] = 196/256.0;
+ kernel[6][7] = 224/256.0;
+ kernel[6][8] = 196/256.0;
+ kernel[6][9] = 168/256.0;
+ kernel[6][10] = 140/256.0;
+ kernel[6][11] = 112/256.0;
+ kernel[6][12] = 84/256.0;
+ kernel[6][13] = 56/256.0;
+ kernel[6][14] = 14/256.0;
+
+ kernel[7][0] = 16/256.0;
+ kernel[7][1] = 64/256.0;
+ kernel[7][2] = 96/256.0;
+ kernel[7][3] = 128/256.0;
+ kernel[7][4] = 160/256.0;
+ kernel[7][5] = 192/256.0;
+ kernel[7][6] = 224/256.0;
+ kernel[7][7] = 256/256.0;
+ kernel[7][8] = 224/256.0;
+ kernel[7][9] = 192/256.0;
+ kernel[7][10] = 160/256.0;
+ kernel[7][11] = 128/256.0;
+ kernel[7][12] = 96/256.0;
+ kernel[7][13] = 64/256.0;
+ kernel[7][14] = 16/256.0;
+
+ kernel[8][0] = 14/256.0;
+ kernel[8][1] = 56/256.0;
+ kernel[8][2] = 84/256.0;
+ kernel[8][3] = 112/256.0;
+ kernel[8][4] = 140/256.0;
+ kernel[8][5] = 168/256.0;
+ kernel[8][6] = 196/256.0;
+ kernel[8][7] = 224/256.0;
+ kernel[8][8] = 196/256.0;
+ kernel[8][9] = 168/256.0;
+ kernel[8][10] = 140/256.0;
+ kernel[8][11] = 112/256.0;
+ kernel[8][12] = 84/256.0;
+ kernel[8][13] = 56/256.0;
+ kernel[8][14] = 14/256.0;
+
+ kernel[9][0] = 12/256.0;
+ kernel[9][1] = 48/256.0;
+ kernel[9][2] = 72/256.0;
+ kernel[9][3] = 96/256.0;
+ kernel[9][4] = 120/256.0;
+ kernel[9][5] = 144/256.0;
+ kernel[9][6] = 168/256.0;
+ kernel[9][7] = 192/256.0;
+ kernel[9][8] = 168/256.0;
+ kernel[9][9] = 144/256.0;
+ kernel[9][10] = 120/256.0;
+ kernel[9][11] = 96/256.0;
+ kernel[9][12] = 72/256.0;
+ kernel[9][13] = 48/256.0;
+ kernel[9][14] = 12/256.0;
+
+ kernel[10][0] = 10/256.0;
+ kernel[10][1] = 40/256.0;
+ kernel[10][2] = 60/256.0;
+ kernel[10][3] = 80/256.0;
+ kernel[10][4] = 100/256.0;
+ kernel[10][5] = 120/256.0;
+ kernel[10][6] = 140/256.0;
+ kernel[10][7] = 160/256.0;
+ kernel[10][8] = 140/256.0;
+ kernel[10][9] = 120/256.0;
+ kernel[10][10] = 100/256.0;
+ kernel[10][11] = 80/256.0;
+ kernel[10][12] = 60/256.0;
+ kernel[10][13] = 40/256.0;
+ kernel[10][14] = 10/256.0;
+
+ kernel[11][0] = 8/256.0;
+ kernel[11][1] = 32/256.0;
+ kernel[11][2] = 48/256.0;
+ kernel[11][3] = 64/256.0;
+ kernel[11][4] = 80/256.0;
+ kernel[11][5] = 96/256.0;
+ kernel[11][6] = 112/256.0;
+ kernel[11][7] = 128/256.0;
+ kernel[11][8] = 112/256.0;
+ kernel[11][9] = 96/256.0;
+ kernel[11][10] = 80/256.0;
+ kernel[11][11] = 64/256.0;
+ kernel[11][12] = 48/256.0;
+ kernel[11][13] = 32/256.0;
+ kernel[11][14] = 8/256.0;
+
+ kernel[12][0] = 6/256.0;
+ kernel[12][1] = 24/256.0;
+ kernel[12][2] = 36/256.0;
+ kernel[12][3] = 48/256.0;
+ kernel[12][4] = 60/256.0;
+ kernel[12][5] = 72/256.0;
+ kernel[12][6] = 84/256.0;
+ kernel[12][7] = 96/256.0;
+ kernel[12][8] = 84/256.0;
+ kernel[12][9] = 72/256.0;
+ kernel[12][10] = 60/256.0;
+ kernel[12][11] = 48/256.0;
+ kernel[12][12] = 36/256.0;
+ kernel[12][13] = 24/256.0;
+ kernel[12][14] = 6/256.0;
+
+ kernel[13][0] = 4/256.0;
+ kernel[13][1] = 16/256.0;
+ kernel[13][2] = 24/256.0;
+ kernel[13][3] = 32/256.0;
+ kernel[13][4] = 40/256.0;
+ kernel[13][5] = 48/256.0;
+ kernel[13][6] = 56/256.0;
+ kernel[13][7] = 64/256.0;
+ kernel[13][8] = 56/256.0;
+ kernel[13][9] = 48/256.0;
+ kernel[13][10] = 40/256.0;
+ kernel[13][11] = 32/256.0;
+ kernel[13][12] = 24/256.0;
+ kernel[13][13] = 16/256.0;
+ kernel[13][14] = 4/256.0;
+
+ kernel[14][0] = 1/256.0;
+ kernel[14][1] = 4/256.0;
+ kernel[14][2] = 6/256.0;
+ kernel[14][3] = 8/256.0;
+ kernel[14][4] = 10/256.0;
+ kernel[14][5] = 12/256.0;
+ kernel[14][6] = 14/256.0;
+ kernel[14][7] = 16/256.0;
+ kernel[14][8] = 14/256.0;
+ kernel[14][9] = 12/256.0;
+ kernel[14][10] = 10/256.0;
+ kernel[14][11] = 8/256.0;
+ kernel[14][12] = 6/256.0;
+ kernel[14][13] = 4/256.0;
+ kernel[14][14] = 1/256.0;
+ }
+}
+
+public class Image {
+ int width, height;
+ int kernelWidth, kernelHeight;
+ double[][] inputImage;
+ double[][] outputImage;
+
+ public Image(int width, int height, int kernelWidth, int kernelHeight) {
+ this.width = width;
+ this.height = height;
+ this.kernelWidth = kernelWidth;
+ this.kernelHeight = kernelHeight;
+ inputImage = new double[height+kernelHeight-1][width+kernelWidth-1];
+ outputImage = new double[height][width];
+ }
+
+ /* Create a valid image */
+ public void setValues() {
+ for (int i = 0; i < (height+kernelHeight - 1); i++) {
+ double ainput[] = inputImage[i];
+ for(int j = 0; j < (width+kernelWidth - 1); j++) {
+ ainput[j] = 256-j;
+ }
+ }
+
+ for (int i = 0; i < height; i++){
+ double aout[] = outputImage[i];
+ for(int j = 0; j < width; j++) {
+ aout[j] = 0;
+ }
+ }
+ }
+}
MAINCLASS=Convolution
SRC=${MAINCLASS}.java
SRC1=${MAINCLASS}SizeB.java
+SRC2=${MAINCLASS}SizeC.java
default:
#../../../../buildscript -optimize -thread -mainclass ${MAINCLASS} ${SRC} -o ${MAINCLASS}
- ../../../../buildscript -optimize -thread -mainclass ${MAINCLASS} ${SRC1} -o ${MAINCLASS}
+#../../../../buildscript -optimize -thread -mainclass ${MAINCLASS} ${SRC1} -o ${MAINCLASS}
+ ../../../../buildscript -optimize -thread -mainclass ${MAINCLASS} ${SRC2} -o ${MAINCLASS}
clean:
rm -rf tmpbuilddirectory
cp ${MAINCLASS}P.bin ${MAINCLASS}1.bin
clean:
- rm *.bin
rm -rf tmpbuilddirectory
+ rm *.bin
public class Foo {
+ Foo next;
public Foo() {
- next=null;
+ next=null;
}
- Foo next;
}
public class Chase extends Thread {
public void run() {
atomic {
Foo b=base;
+ /*
+ //Running small test for manual prefetch
+ //TODO Remove later
+ Object o = b;
+ short noffsets = (short) 2;
+ short[] offsets = new short[2];
+ offsets[0] = getoffset{Foo, next};
+ offsets[1] = (short)5;
+ System.rangePrefetch(o, offsets);
+ */
while(b!=null)
- b=b.next;
+ b=b.next;
}
}
}
MAINCLASS=Chase
SRC1=${MAINCLASS}.java
FLAGS=-dsm -prefetch -dsmcaching -optimize -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.7
-FLAGS1=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.7
-FLAGS2=-dsm -optimize -mainclass ${MAINCLASS} -trueprob 0.7
+FLAGS1=-dsm -rangeprefetch -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.7
+FLAGS2=-dsm -dsmcaching -optimize -mainclass ${MAINCLASS} -trueprob 0.7
+FLAGS3=-dsm -optimize -mainclass ${MAINCLASS} -trueprob 0.7
#for testing no java option
#FLAGS=-dsm -prefetch -optimize -debug -excprefetch Chase.main -excprefetch Chase.Chase -mainclass ${MAINCLASS} -trueprob 0.99 -nojava
default:
- ../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC ${SRC1}
- ../../../buildscript ${FLAGS1} -o ${MAINCLASS}NP ${SRC1}
- ../../../buildscript ${FLAGS} -o ${MAINCLASS}P ${SRC1}
- cp ${MAINCLASS}NPNC.bin ${MAINCLASS}1NPNC.bin
- cp ${MAINCLASS}NP.bin ${MAINCLASS}1NP.bin
- cp ${MAINCLASS}P.bin ${MAINCLASS}1.bin
+ ../../../buildscript ${FLAGS3} -o ${MAINCLASS}NPNC ${SRC1}
+ ../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
+ ../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangeP ${SRC1}
clean:
- rm *.bin
rm -rf tmpbuilddirectory
+ rm *.bin
this.y0 = y0;
this.x1 = x1;
this.y1 = y1;
- //System.printString("x0 = " +x0+" x1= "+x1+" y0= "+y0+" y1= "+y1+"\n");
}
public void run() {
offsets[0] = getoffset{MMul, a};
offsets[1] = (short) 0;
offsets[2] = (short) x0;
- //offsets[3] = (short) (x1 - x0);
- offsets[3] = (short) 10;
+ offsets[3] = (short) (x1 - x0 -1);
System.rangePrefetch(o, offsets);
// Prefetch mmul.btranspose[][] matrix
offsets1[0] = getoffset{MMul, btranspose};
offsets1[1] = (short) 0;
offsets1[2] = (short) x0;
- // offsets1[3] = (short) (x1 - x0);
- offsets1[3] = (short) 10;
+ offsets1[3] = (short) (x1 - x0 -1);
System.rangePrefetch(o1, offsets1);
// Prefetch mmul.c[][] matrix
offsets2[0] = getoffset{MMul, c};
offsets2[1] = (short) 0;
offsets2[2] = (short) x0;
- //offsets2[3] = (short) (x1 - x0);
- offsets2[3] = (short) 10;
+ offsets2[3] = (short) (x1 - x0 -1);
System.rangePrefetch(o2, offsets2);
double la[][]=mmul.a;
MAINCLASS=MatrixMultiply
SRC1=${MAINCLASS}N.java
FLAGS=-dsm -dsmcaching -prefetch -optimize -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.98
-FLAGS1=-dsm -dsmcaching -rangeprefetch -optimize -excprefetch MatrixMultiply.main -excprefetch MMul.setValues -excprefetch MMul.transpose -mainclass ${MAINCLASS} -trueprob 0.98
+FLAGS1=-dsm -dsmcaching -rangeprefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.98
FLAGS2=-dsm -optimize -mainclass ${MAINCLASS}
default:
../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC ${SRC1}
- ../../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangePN ${SRC1}
../../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
+ ../../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangePN ${SRC1}
clean:
rm -rf tmpbuilddirectory
default:
../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC ${SRC1}
../../../../buildscript ${FLAGS} -o ${MAINCLASS}N ${SRC1}
- ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC200 ${SRC2}
- ../../../../buildscript ${FLAGS} -o ${MAINCLASS}N200 ${SRC2}
+# ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NPNC200 ${SRC2}
+# ../../../../buildscript ${FLAGS} -o ${MAINCLASS}N200 ${SRC2}
clean:
rm -rf tmpbuilddirectory
public void JGFinitialise(){
interactions = 0;
- datasizes = global new int[2];
+ datasizes = global new int[3];
datasizes[0] = 8;
datasizes[1] = 13;
+ datasizes[2] = 18;
mm = datasizes[size];
PARTSIZE = mm*mm*mm*4;
--- /dev/null
+/**************************************************************************
+ * *
+ * 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 JGFMolDynBenchSizeA {
+
+ public static void main(String argv[]){
+ int nthreads;
+ if(argv.length != 0 ) {
+ nthreads = Integer.parseInt(argv[0]);
+ } else {
+ System.printString("The no of threads has not been specified, defaulting to 1\n");
+ System.printString(" " + "\n");
+ nthreads = 1;
+ }
+
+ JGFInstrumentor instr = new JGFInstrumentor();
+ JGFInstrumentor.printHeader(3,0,nthreads);
+
+ JGFMolDynBench mold;
+ atomic {
+ mold = global new JGFMolDynBench(nthreads);
+ }
+ int size = 1;
+ JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers);
+ JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers);
+
+ atomic {
+ mold.JGFsetsize(size);
+ }
+
+ JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers);
+
+ JGFMolDynBench tmp;
+ atomic {
+ mold.JGFinitialise();
+ }
+ JGFMolDynBench.JGFapplication(mold);
+
+ /* Validate data */
+ double[] refval = new double[2];
+ refval[0] = 1731.4306625334357;
+ refval[1] = 7397.392307839352;
+ double dval;
+ atomic {
+ dval = mold.ek[0].d;
+ }
+ double dev = Math.fabs(dval - refval[size]);
+ long l = (long) refval[size] *1000000;
+ long r = (long) dval * 1000000;
+ if (l != r ){
+ System.printString("Validation failed\n");
+ System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n");
+ }
+
+ JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers);
+ double interactions;
+ atomic {
+ interactions = mold.interactions;
+ }
+
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers);
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers);
+
+ JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers);
+ JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers);
+ System.printString("Finished\n");
+ }
+}
+
--- /dev/null
+/**************************************************************************
+ * *
+ * 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 JGFMolDynBenchSizeA {
+
+ public static void main(String argv[]){
+ int nthreads;
+ if(argv.length != 0 ) {
+ nthreads = Integer.parseInt(argv[0]);
+ } else {
+ System.printString("The no of threads has not been specified, defaulting to 1\n");
+ System.printString(" " + "\n");
+ nthreads = 1;
+ }
+
+ JGFInstrumentor instr = new JGFInstrumentor();
+ JGFInstrumentor.printHeader(3,0,nthreads);
+
+ JGFMolDynBench mold;
+ atomic {
+ mold = global new JGFMolDynBench(nthreads);
+ }
+ int size = 2;
+ JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers);
+ JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers);
+
+ atomic {
+ mold.JGFsetsize(size);
+ }
+
+ JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers);
+
+ JGFMolDynBench tmp;
+ atomic {
+ mold.JGFinitialise();
+ }
+ JGFMolDynBench.JGFapplication(mold);
+
+ /* Validate data */
+ /*
+ double[] refval = new double[2];
+ refval[0] = 1731.4306625334357;
+ refval[1] = 7397.392307839352;
+ double dval;
+ atomic {
+ dval = mold.ek[0].d;
+ }
+ double dev = Math.fabs(dval - refval[size]);
+ long l = (long) refval[size] *1000000;
+ long r = (long) dval * 1000000;
+ if (l != r ){
+ System.printString("Validation failed\n");
+ System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n");
+ }
+
+ JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers);
+ double interactions;
+ atomic {
+ interactions = mold.interactions;
+ }
+
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers);
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers);
+
+ JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers);
+ JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers);
+ */
+ System.printString("Finished\n");
+ }
+}
+
-MAINCLASS=JGFMolDynBenchSizeA
+MAINCLASS=JGFMolDynBenchSizeB
SRC=${MAINCLASS}.java \
JGFInstrumentor.java \
JGFTimer.java \
public void JGFinitialise(){
interactions = 0;
- datasizes = new int[2];
+ datasizes = new int[3];
datasizes[0] = 8;
datasizes[1] = 13;
+ datasizes[2] = 18;
mm = datasizes[size];
PARTSIZE = mm*mm*mm*4;
--- /dev/null
+/**************************************************************************
+ * *
+ * 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 JGFMolDynBenchSizeA {
+
+ public static void main(String argv[]){
+ int nthreads;
+ if(argv.length != 0 ) {
+ nthreads = Integer.parseInt(argv[0]);
+ } else {
+ System.printString("The no of threads has not been specified, defaulting to 1\n");
+ System.printString(" " + "\n");
+ nthreads = 1;
+ }
+
+ JGFInstrumentor instr = new JGFInstrumentor();
+ JGFInstrumentor.printHeader(3,0,nthreads);
+
+ JGFMolDynBench mold;
+ mold = new JGFMolDynBench(nthreads);
+ int size = 1;
+ JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers);
+ JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers);
+
+ mold.JGFsetsize(size);
+
+ JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers);
+
+ JGFMolDynBench tmp;
+ mold.JGFinitialise();
+ JGFMolDynBench.JGFapplication(mold);
+
+ /* Validate data */
+ refval[0] = 1731.4306625334357;
+ refval[1] = 7397.392307839352;
+ double dval;
+ dval = mold.ek[0].d;
+ double dev = Math.fabs(dval - refval[size]);
+ long l = (long) refval[size] *1000000;
+ long r = (long) dval * 1000000;
+ if (l != r ){
+ System.printString("Validation failed\n");
+ System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n");
+ }
+
+ JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers);
+ double interactions;
+ interactions = mold.interactions;
+
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers);
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers);
+
+ JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers);
+ JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers);
+ System.printString("Finished\n");
+ }
+}
+
--- /dev/null
+/**************************************************************************
+ * *
+ * 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 JGFMolDynBenchSizeA {
+
+ public static void main(String argv[]){
+ int nthreads;
+ if(argv.length != 0 ) {
+ nthreads = Integer.parseInt(argv[0]);
+ } else {
+ System.printString("The no of threads has not been specified, defaulting to 1\n");
+ System.printString(" " + "\n");
+ nthreads = 1;
+ }
+
+ JGFInstrumentor instr = new JGFInstrumentor();
+ JGFInstrumentor.printHeader(3,0,nthreads);
+
+ JGFMolDynBench mold;
+ mold = new JGFMolDynBench(nthreads);
+ int size = 2;
+ JGFInstrumentor.addTimer("Section3:MolDyn:Total", "Solutions",size, instr.timers);
+ JGFInstrumentor.addTimer("Section3:MolDyn:Run", "Interactions",size, instr.timers);
+
+ mold.JGFsetsize(size);
+
+ JGFInstrumentor.startTimer("Section3:MolDyn:Total", instr.timers);
+
+ JGFMolDynBench tmp;
+ mold.JGFinitialise();
+ JGFMolDynBench.JGFapplication(mold);
+
+ /* Validate data */
+ /*
+ double[] refval = new double[2];
+ refval[0] = 1731.4306625334357;
+ refval[1] = 7397.392307839352;
+ double dval;
+ dval = mold.ek[0].d;
+ double dev = Math.fabs(dval - refval[size]);
+ long l = (long) refval[size] *1000000;
+ long r = (long) dval * 1000000;
+ if (l != r ){
+ System.printString("Validation failed\n");
+ System.printString("Kinetic Energy = " + (long)dval + " " + (long)dev + " " + size + "\n");
+ }
+
+ JGFInstrumentor.stopTimer("Section3:MolDyn:Total", instr.timers);
+ double interactions;
+ interactions = mold.interactions;
+
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Run", (double) interactions, instr.timers);
+ JGFInstrumentor.addOpsToTimer("Section3:MolDyn:Total", 1, instr.timers);
+
+ JGFInstrumentor.printTimer("Section3:MolDyn:Run", instr.timers);
+ JGFInstrumentor.printTimer("Section3:MolDyn:Total", instr.timers);
+ */
+ System.printString("Finished\n");
+ }
+}
+
-MAINCLASS=JGFMolDynBenchSizeA
+MAINCLASS=JGFMolDynBenchSizeB
SRC=${MAINCLASS}.java \
JGFInstrumentor.java \
JGFTimer.java \
float loadFactor;
int secondcapacity;
- public HashMap(int initialCapacity, int secondcapacity, float loadFactor) {
+ public DistributedHashMap(int initialCapacity, int secondcapacity, float loadFactor) {
init(initialCapacity, secondcapacity, loadFactor);
}
void resize(int index) {
DHashEntry[] oldtable=table[index].array;
int newCapacity=oldtable.length*2+1;
- DHashEntry []newtable=global new DHashEntry[newCapacity];
+ DHashEntry [] newtable=global new DHashEntry[newCapacity];
table[index].array=newtable;
for(int i=0; i<oldtable.length; i++) {
while(ptr!=null) {
if (ptr.hashval==hashcode
- &&ptr.key.equals(key)) {
+ &&ptr.key.equals(key)) {
return ptr.value;
}
ptr=ptr.next;
while(ptr!=null) {
if (ptr.hashval==hashcode
- &&ptr.key.equals(key)) {
+ &&ptr.key.equals(key)) {
return true;
}
ptr=ptr.next;
case Kind.AtomicNode:
checkAtomicNode(md, nametable, (AtomicNode)bsn);
return;
-
+
case Kind.SESENode:
// do nothing, no semantic check for SESEs
return;
- }
+ }
throw new Error();
}
lefttype=new TypeDescriptor(TypeDescriptor.LONG);
// 090205 hack for boolean
else if (ltd.isBoolean()||rtd.isBoolean())
- lefttype=new TypeDescriptor(TypeDescriptor.BOOLEAN);
+ lefttype=new TypeDescriptor(TypeDescriptor.BOOLEAN);
else
lefttype=new TypeDescriptor(TypeDescriptor.INT);
righttype=lefttype;
key_table.put("private", new Integer(Sym.PRIVATE));
key_table.put("protected", new Integer(Sym.PROTECTED));
key_table.put("public", new Integer(Sym.PUBLIC));
- key_table.put("return", new Integer(Sym.RETURN));
+ key_table.put("return", new Integer(Sym.RETURN));
key_table.put("short", new Integer(Sym.SHORT));
key_table.put("static", new Integer(Sym.STATIC));
key_table.put("strictfp", new Integer(Sym.STRICTFP));
static final String[] keywords = new String[] {
"abstract", "assert", "atomic", "boolean", "break", "byte", "case", "catch", "char",
- "class", "const", "continue",
- "default", "disjoint", "do", "double",
+ "class", "const", "continue",
+ "default", "disjoint", "do", "double",
"else", "enum",
"extends", "external", "final", "finally",
"flag", //keyword for failure aware computation
"float", "for","getoffset", "global", "goto", "if",
//"implements",
- "import", "instanceof", "int",
+ "import", "instanceof", "int",
//"interface",
"isavailable",
"long",
else if (option.equals("-instructionfailures"))
state.INSTRUCTIONFAILURE=true;
else if (option.equals("-abcclose"))
- state.ARRAYBOUNDARYCHECK=false;
+ state.ARRAYBOUNDARYCHECK=false;
else if (option.equals("-help")) {
System.out.println("-classlibrary classlibrarydirectory -- directory where classlibrary is located");
System.out.println("-selfloop task -- this task doesn't self loop its parameters forever");
state.OWNERSHIPALIASFILE);
// generate multiple schedulings
- ScheduleAnalysis scheduleAnalysis = new ScheduleAnalysis(state,
- ta);
+ ScheduleAnalysis scheduleAnalysis = new ScheduleAnalysis(state,
+ ta);
// necessary preparation such as read profile info etc.
- scheduleAnalysis.preparation();
+ scheduleAnalysis.preparation();
scheduleAnalysis.preSchedule();
scheduleAnalysis.scheduleAnalysis();
//scheduleAnalysis.setCoreNum(scheduleAnalysis.getSEdges4Test().size());
scheduleAnalysis.schedule();
//simulate these schedulings
- ScheduleSimulator scheduleSimulator = new ScheduleSimulator(scheduleAnalysis.getCoreNum(),
- state,
- ta);
+ ScheduleSimulator scheduleSimulator = new ScheduleSimulator(scheduleAnalysis.getCoreNum(),
+ state,
+ ta);
Vector<Vector<Schedule>> schedulings = scheduleAnalysis.getSchedulings();
Vector<Integer> selectedScheduling = scheduleSimulator.simulate(schedulings);
if(state.MULTICORE) {
Vector<Schedule> scheduling = scheduleAnalysis.getSchedulings().elementAt(selectedScheduling.firstElement());
- BuildCodeMultiCore bcm=new BuildCodeMultiCore(state,
- bf.getMap(),
- tu,
- sa,
- scheduling,
- scheduleAnalysis.getCoreNum(),
- pa);
+ BuildCodeMultiCore bcm=new BuildCodeMultiCore(state,
+ bf.getMap(),
+ tu,
+ sa,
+ scheduling,
+ scheduleAnalysis.getCoreNum(),
+ pa);
bcm.setOwnershipAnalysis(oa);
bcm.buildCode();
scheduling = null;
#define RW_LOCK_UNLOCKED { RW_LOCK_BIAS }
//#define LOCK_PREFIX ""
#define LOCK_PREFIX \
- ".section .smp_locks,\"a\"\n" \
- " .align 4\n" \
- " .long 661f\n" /* address */ \
- ".previous\n" \
- "661:\n\tlock; "
+ ".section .smp_locks,\"a\"\n" \
+ " .align 4\n" \
+ " .long 661f\n" /* address */\
+ ".previous\n" \
+ "661:\n\tlock; "
#elif defined(FASTCHECK)
#define ENQUEUE(orig, dst) \
if (((unsigned int)orig)!=1) { \
- void *copy; \
- if (gc_createcopy(orig,©)) \
- enqueue(orig);\
- dst=copy; }
+ void *copy; \
+ if (gc_createcopy(orig,©)) \
+ enqueue(orig);\
+ dst=copy; }
#else
#define ENQUEUE(orig, dst) \
void *copy; \