small changes and major changes to LookUpService
authoradash <adash>
Tue, 10 Feb 2009 01:31:45 +0000 (01:31 +0000)
committeradash <adash>
Tue, 10 Feb 2009 01:31:45 +0000 (01:31 +0000)
Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java
Robust/src/Benchmarks/Distributed/LookUpService/makefile
Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeB.java
Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeC.java
Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeB.java
Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeC.java
Robust/src/Benchmarks/Prefetch/bm.txt
Robust/src/Benchmarks/Prefetch/run.sh

index dfde7ceb23899ddd71ad29c8dc972db1ffa89c56..fd2aa21217fc828515809e83a4d69ca31d9d5ea7 100644 (file)
@@ -1,21 +1,47 @@
 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);
@@ -24,8 +50,11 @@ public class LookUpService extends Thread {
         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);
@@ -33,24 +62,24 @@ public class LookUpService extends Thread {
         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
@@ -61,14 +90,24 @@ public class LookUpService extends Thread {
 
     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;
       }
     }
 
@@ -91,4 +130,50 @@ public class LookUpService extends Thread {
 
     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");
+  }
 }
index 361451731677be4fa55a1c2c971312ba3fc94a32..b8eb72821a96f7dc15f90d9dec0fd4ae5728106b 100644 (file)
@@ -2,12 +2,12 @@ MAINCLASS=LookUpService
 SRC1=${MAINCLASS}.java \
      ../../../ClassLibrary/DistributedHashMap.java
 FLAGS1=-dsm -dsmcaching -rangeprefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.90
-FLAGS2=-dsm -dsmcaching -prefetch -optimize -mainclass ${MAINCLASS} -trueprob 0.90
+FLAGS2=-dsm -dsmcaching -prefetch -optimize -excprefetch String.hashCode -excprefetch DistributedHashMap.resize -excprefetch String.equals -excprefetch LookUpService.main -mainclass ${MAINCLASS} -trueprob 0.90
 FLAGS3=-dsm -optimize -mainclass ${MAINCLASS}
 default:
        ../../../buildscript ${FLAGS3} -o ${MAINCLASS}NPNC ${SRC1}
-       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}RangePN ${SRC1}
-       ../../../buildscript ${FLAGS1} -o ${MAINCLASS}N ${SRC1}
+       ../../../buildscript ${FLAGS2} -o ${MAINCLASS}N ${SRC1}
+       ../../../buildscript ${FLAGS1} -o ${MAINCLASS}RangeN ${SRC1}
 
 clean:
        rm -rf tmpbuilddirectory
index 60621b5e8d3c9dd3a70b54e2f3073397043dacf5..716f31b5b193fcaaa7ba5f8d797f4e94cfaca565 100644 (file)
@@ -17,7 +17,7 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-public class JGFMolDynBenchSizeA { 
+public class JGFMolDynBenchSizeB { 
 
     public static void main(String argv[]){
     int nthreads;
index c0d7bf9a53e59594963c6396702c1de3324f42c9..04a0afccac5f7d7d037dadb685f7803d16e3480a 100644 (file)
@@ -17,7 +17,7 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-public class JGFMolDynBenchSizeA { 
+public class JGFMolDynBenchSizeC { 
 
     public static void main(String argv[]){
     int nthreads;
index 5fff8864583bf4cbd76c64152958588778155f6e..6dc3aa5e873e4795dd975dd9cec55275f070e3bc 100644 (file)
@@ -17,7 +17,7 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-public class JGFMolDynBenchSizeA { 
+public class JGFMolDynBenchSizeB { 
 
     public static void main(String argv[]){
     int nthreads;
@@ -47,6 +47,7 @@ public class JGFMolDynBenchSizeA {
     JGFMolDynBench.JGFapplication(mold); 
 
     /* Validate data */
+    double[] refval = new double[2];
     refval[0] = 1731.4306625334357;
     refval[1] = 7397.392307839352;
     double dval;
index d81468282e2b8d203ccf68162a4f58c90c2f4f0b..442491163698d09d6e2ad2c3289af05ead46c128 100644 (file)
@@ -17,7 +17,7 @@
  *                         All rights reserved.                            *
  *                                                                         *
  **************************************************************************/
-public class JGFMolDynBenchSizeA { 
+public class JGFMolDynBenchSizeC { 
 
     public static void main(String argv[]){
     int nthreads;
index 883a93775a51f60c0b4c52ff508f908f8bcc1eb8..deaf47b869a8732f1bf816ba2ca0c71bab802be7 100644 (file)
@@ -1,10 +1,12 @@
 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
@@ -20,3 +22,4 @@ Convolution:2DConv/dsm:1 16000:2 16000:3 16000:4 16000:5 16000:6 16000:7 16000:8
 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
index 54f3b25f450943e16c711ce6806138f48ceb78b1..e1c2152119f82d8c6ca3d48d8df5494771f52470 100755 (executable)
@@ -2,7 +2,7 @@
 
 #set -x
 MACHINELIST='dc-1.calit2.uci.edu dc-2.calit2.uci.edu dc-3.calit2.uci.edu dc-4.calit2.uci.edu dc-5.calit2.uci.edu dc-6.calit2.uci.edu dc-7.calit2.uci.edu dc-8.calit2.uci.edu'
-benchmarks='1152fft2d 40962dconv 20482dconv 800mmver moldynverA em3dver40001306'
+benchmarks='lookup 40962dconv 1200mmver moldynverB'
 
 LOGDIR=~/research/Robust/src/Benchmarks/Prefetch/runlog
 TOPDIR=`pwd`