From f44972950eb8586bd801619e5f0e0b5393e368ea Mon Sep 17 00:00:00 2001 From: adash Date: Tue, 10 Feb 2009 01:31:45 +0000 Subject: [PATCH] small changes and major changes to LookUpService --- .../LookUpService/LookUpService.java | 123 +++++++++++++++--- .../Distributed/LookUpService/makefile | 6 +- .../Moldyn/dsm/JGFMolDynBenchSizeB.java | 2 +- .../Moldyn/dsm/JGFMolDynBenchSizeC.java | 2 +- .../javasingle/JGFMolDynBenchSizeB.java | 3 +- .../javasingle/JGFMolDynBenchSizeC.java | 2 +- Robust/src/Benchmarks/Prefetch/bm.txt | 3 + Robust/src/Benchmarks/Prefetch/run.sh | 2 +- 8 files changed, 116 insertions(+), 27 deletions(-) diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java b/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java index dfde7ceb..fd2aa212 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java +++ b/Robust/src/Benchmarks/Distributed/LookUpService/LookUpService.java @@ -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 -nEntry -nTrans -probRead \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"); + } } diff --git a/Robust/src/Benchmarks/Distributed/LookUpService/makefile b/Robust/src/Benchmarks/Distributed/LookUpService/makefile index 36145173..b8eb7282 100644 --- a/Robust/src/Benchmarks/Distributed/LookUpService/makefile +++ b/Robust/src/Benchmarks/Distributed/LookUpService/makefile @@ -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 diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeB.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeB.java index 60621b5e..716f31b5 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeB.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeB.java @@ -17,7 +17,7 @@ * All rights reserved. * * * **************************************************************************/ -public class JGFMolDynBenchSizeA { +public class JGFMolDynBenchSizeB { public static void main(String argv[]){ int nthreads; diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeC.java b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeC.java index c0d7bf9a..04a0afcc 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeC.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/dsm/JGFMolDynBenchSizeC.java @@ -17,7 +17,7 @@ * All rights reserved. * * * **************************************************************************/ -public class JGFMolDynBenchSizeA { +public class JGFMolDynBenchSizeC { public static void main(String argv[]){ int nthreads; diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeB.java b/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeB.java index 5fff8864..6dc3aa5e 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeB.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeB.java @@ -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; diff --git a/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeC.java b/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeC.java index d8146828..44249116 100644 --- a/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeC.java +++ b/Robust/src/Benchmarks/Prefetch/Moldyn/javasingle/JGFMolDynBenchSizeC.java @@ -17,7 +17,7 @@ * All rights reserved. * * * **************************************************************************/ -public class JGFMolDynBenchSizeA { +public class JGFMolDynBenchSizeC { public static void main(String argv[]){ int nthreads; diff --git a/Robust/src/Benchmarks/Prefetch/bm.txt b/Robust/src/Benchmarks/Prefetch/bm.txt index 883a9377..deaf47b8 100644 --- a/Robust/src/Benchmarks/Prefetch/bm.txt +++ b/Robust/src/Benchmarks/Prefetch/bm.txt @@ -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 diff --git a/Robust/src/Benchmarks/Prefetch/run.sh b/Robust/src/Benchmarks/Prefetch/run.sh index 54f3b25f..e1c21521 100755 --- a/Robust/src/Benchmarks/Prefetch/run.sh +++ b/Robust/src/Benchmarks/Prefetch/run.sh @@ -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` -- 2.34.1