public class LookUpService extends Thread {
DistributedHashMap mydhmap;
- int threadid;
- int numthreads;
+ /**
+ * The thread id involved
+ **/
+ private int threadid;
+ /**
+ * The total number of threads
+ **/
+ private int numthreads;
- public LookUpService(DistributedHashMap dmap, int threadid, int numthreads) {
+ /**
+ * The total number of transactions
+ **/
+ private int numtrans;
+
+ /**
+ * The total number of objects created
+ **/
+ private int nobjs;
+
+ /**
+ * The probability of initiating a look up
+ * the read probability % between 0-99
+ **/
+ private int rdprob;
+
+ public LookUpService() {
+ }
+
+ public LookUpService(DistributedHashMap dmap, int threadid, int numthreads, int nobjs, int numtrans, int rdprob) {
mydhmap = dmap;
this.threadid = threadid;
this.numthreads = numthreads;
+ this.nobjs = nobjs;
+ this.numtrans = numtrans;
+ this.rdprob = rdprob;
}
public void run() {
+ Barrier barr;
+ barr = new Barrier("128.195.136.162");
//Add to the hash map
- int nobjs = 10;
- // Do read/writes
- int numtrans = 1000;
- // read probability % between 0-99
- int rdprob = 90;
+ int ntrans;
atomic {
for(int i = 0; i < nobjs; i++) {
Integer key = global new Integer(threadid*nobjs+i);
Object o2 = val;
mydhmap.put(o1, o2);
}
+ ntrans = numtrans;
}
- for (int i = 0; i < numtrans; i++) {
+ Barrier.enterBarrier(barr);
+ // Do read/writes
+ for (int i = 0; i < ntrans; i++) {
atomic {
Random rand = new Random(i);
int rdwr = rand.nextInt(100);
Integer key = global new Integer(rwkey);
Object o1 = key;
if (rdwr < rdprob) {
- Object o3 = mydhmap.get(key);
+ Object o3 = mydhmap.get(o1); //Read
} else {
Integer val = global new Integer(i);
Object o2 = val;
- mydhmap.put(key, val);
- mydhmap.put(o1, o2);
+ mydhmap.put(o1, o2); //Modify
}
}
}
}
public static void main(String[] args) {
- int nthreads;
- if(args.length>0)
- nthreads = Integer.parseInt(args[0]);
+ LookUpService ls = new LookUpService();
+ LookUpService.parseCmdLine(args,ls);
+ BarrierServer mybarr;
+ int nthreads = ls.numthreads;
int[] mid = new int[8];
- mid[0] = (128<<24)|(195<<16)|(175<<8)|79;//dc-1
+ mid[0] = (128<<24)|(195<<16)|(136<<8)|162;//dc-1
mid[1] = (128<<24)|(195<<16)|(136<<8)|163;//dc-2
mid[2] = (128<<24)|(195<<16)|(136<<8)|164;//dc-3
mid[3] = (128<<24)|(195<<16)|(136<<8)|165;//dc-4
LookUpService[] lus;
DistributedHashMap dhmap;
- //DistributedHashEntry dhe;
-
+ atomic {
+ mybarr = global new BarrierServer(nthreads);
+ }
+ mybarr.start(mid[0]);
atomic {
dhmap = global new DistributedHashMap(100, 100, 0.75f);
lus = global new LookUpService[nthreads];
for(int i = 0; i<nthreads; i++) {
- lus[i] = global new LookUpService(dhmap, i, nthreads);
+ lus[i] = global new LookUpService(dhmap, i, ls.numthreads, ls.nobjs, ls.numtrans, ls.rdprob);
+ }
+ }
+
+ boolean waitfordone=true;
+ while(waitfordone) {
+ atomic { //Master aborts are from here
+ if (mybarr.done)
+ waitfordone=false;
}
}
System.printString("Finished\n");
}
+
+ /**
+ * Parse the command line options.
+ **/
+ public static void parseCmdLine(String args[], LookUpService lus) {
+ int i = 0;
+ String arg;
+ while(i < args.length && args[i].startsWith("-")) {
+ arg = args[i++];
+ //check options
+ if(arg.equals("-N")) {
+ if(i < args.length) {
+ lus.numthreads = new Integer(args[i++]).intValue();
+ }
+ } else if(arg.equals("-nEntry")) {
+ if(i < args.length) {
+ lus.nobjs = new Integer(args[i++]).intValue();
+ }
+ } else if (arg.equals("-nTrans")) {
+ if(i < args.length) {
+ lus.numtrans = new Integer(args[i++]).intValue();
+ }
+ } else if(arg.equals("-probRead")) {
+ if(i < args.length) {
+ lus.rdprob = new Integer(args[i++]).intValue();
+ }
+ } else if(arg.equals("-h")) {
+ lus.usage();
+ }
+ }
+
+ if(lus.nobjs == 0 || lus.numtrans == 0)
+ lus.usage();
+ }
+
+ /**
+ * The usage routine which describes the program options.
+ **/
+ public void usage() {
+ System.printString("usage: ./LookUpServiceN.bin master -N <threads> -nEntry <objects in hashmap> -nTrans <number of transactions> -probRead <read probability> \n");
+ System.printString(" -N the number of threads\n");
+ System.printString(" -nEntry the number of objects to be inserted into distributed hashmap\n");
+ System.printString(" -nTrans the number of transactions to run\n");
+ System.printString(" -probRead the probability of read given a transaction\n");
+ System.printString(" -h help with usage\n");
+ }
}
JGFSORBenchSizeA:SOR/dsm:1:2:3:4:5:6:7:8:sorverA
JGFSORBenchSizeD:SOR/dsm:1:2:3:4:5:6:7:8:sorverD
JGFMolDynBenchSizeA:Moldyn/dsm:1:2:3:4:5:6:7:8:moldynverA
+JGFMolDynBenchSizeB:Moldyn/dsm:1:2:3:4:5:6:7:8:moldynverB
JGFMolDynBenchSizeD:Moldyn/dsm:1:2:3:4:5:6:7:8:moldynverD
JGFLUFactBenchSizeA:LUFact/dsm:1:2:3:4:5:6:7:8:lufactverA
MatrixMultiply:MatrixMultiply/dsm:1 800:2 800:3 800:4 800:5 800:6 800:7 800:8 800:800mmver
MatrixMultiply:MatrixMultiply/dsm:1 600:2 600:3 600:4 600:5 600:6 600:7 600:8 600:600mmver
+MatrixMultiply:MatrixMultiply/dsm:1 1200:2 1200:3 1200:4 1200:5 1200:6 1200:7 1200:8 1200:1200mmver
Em3d:Em3d/dsm:-T 1 -N 4000 -d 130 -p -i 6:-T 2 -N 4000 -d 130 -p -i 6:-T 3 -N 4000 -d 130 -p -i 6:-T 4 -N 4000 -d 130 -p -i 6:-T 5 -N 4000 -d 130 -p -i 6:-T 6 -N 4000 -d 130 -p -i 6:-T 7 -N 4000 -d 130 -p -i 6:-T 8 -N 4000 -d 130 -p -i 6:em3dver40001306
Em3d:Em3d/dsm:-T 1 -N 6000 -d 200 -p -i 10:-T 2 -N 6000 -d 200 -p -i 10:-T 3 -N 6000 -d 200 -p -i 10:-T 4 -N 6000 -d 200 -p -i 10:-T 5 -N 6000 -d 200 -p -i 10:-T 6 -N 6000 -d 200 -p -i 10:-T 7 -N 6000 -d 200 -p -i 10:-T 8 -N 6000 -d 200 -p -i 10:em3dver600020010
Em3d:Em3d/dsm:-T 1 -N 10000 -d 1000 -i 15:-T 2 -N 10000 -d 1000 -i 15:-T 3 -N 10000 -d 1000 -i 15:-T 4 -N 10000 -d 1000 -i 15:-T 5 -N 10000 -d 1000 -i 15:-T 6 -N 10000 -d 1000 -i 15:-T 7 -N 10000 -d 1000 -i 15:-T 8 -N 10000 -d 1000 -i 15:em3dver10000100015
Convolution:2DConv/dsm:1 2048:2 2048:3 2048:4 2048:5 2048:6 2048:7 2048:8 2048:20482dconv
Convolution:2DConv/dsm:1 1024:2 1024:3 1024:4 1024:5 1024:6 1024:7 1024:8 1024:10242dconv
Convolution:2DConv/dsm:1 6000:2 6000:3 6000:4 6000:5 6000:6 6000:7 6000:8 6000:60002dconv
+LookUpService:../Distributed/LookUpService:1:2:3:4:5:6:7:8:lookup