From: adash Date: Fri, 2 May 2008 19:51:45 +0000 (+0000) Subject: Em3d versions for 1,2, 4 threads X-Git-Tag: preEdgeChange~119 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=a7a1e88333abc828d4dc06109246c7d104bf0da0;p=IRC.git Em3d versions for 1,2, 4 threads --- diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d1.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d1.java new file mode 100644 index 00000000..b9a04f5d --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d1.java @@ -0,0 +1,237 @@ +/** + * + * + * Java implementation of the em3d Olden benchmark. This Olden + * benchmark models the propagation of electromagnetic waves through + * objects in 3 dimensions. It is a simple computation on an irregular + * bipartite graph containing nodes representing electric and magnetic + * field values. + * + *

+ * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von + * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing + * 1993, pages 262-273. + * + **/ +public class Em3d extends Thread +{ + + /** + * The number of nodes (E and H) + **/ + private int numNodes; + /** + * The out-degree of each node. + **/ + private int numDegree; + /** + * The number of compute iterations + **/ + private int numIter; + /** + * Should we print the results and other runtime messages + **/ + private boolean printResult; + /** + * Print information messages? + **/ + private boolean printMsgs; + + BiGraph bg; + int upperlimit; + int lowerlimit; + Barrier mybarr; + + public Em3d() { + numNodes = 0; + numDegree = 0; + numIter = 1; + printResult = false; + printMsgs = false; + } + + public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) { + this.bg = bg; + this.lowerlimit = lowerlimit; + this.upperlimit = upperlimit; + this.numIter = numIter; + this.mybarr = mybarr; + } + + public void run() { + int iteration; + Barrier barr; + Node enodebase; + Node hnodebase; + + atomic { + iteration = numIter; + barr=mybarr; + } + atomic { + enodebase=bg.eNodes; + hnodebase=bg.hNodes; + for(int j = 0; j numThreads = " + numThreads+"\n"); + Barrier mybarr; + atomic { + mybarr = global new Barrier(numThreads); + } + BiGraph graph; + Random rand = new Random(783); + atomic { + graph = BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand); + } + + long end0 = System.currentTimeMillis(); + + // compute a single iteration of electro-magnetic propagation + if (em.printMsgs) + System.printString("Propagating field values for " + em.numIter + + " iteration(s)...\n"); + long start1 = System.currentTimeMillis(); + Em3d[] em3d; + atomic { + em3d = global new Em3d[numThreads]; + em3d[0] = global new Em3d(graph, 0, em.numNodes, em.numIter, mybarr); + } + + Em3d tmp; + for(int i = 0; i -d [-p] [-m] [-h]\n"); + System.printString(" -N the number of nodes\n"); + System.printString(" -d the out-degree of each node\n"); + System.printString(" -i the number of iterations\n"); + System.printString(" -p (print detailed results\n)"); + System.printString(" -m (print informative messages)\n"); + System.printString(" -h (this message)\n"); + } + +} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java new file mode 100644 index 00000000..22bda0a3 --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d2.java @@ -0,0 +1,239 @@ +/** + * + * + * Java implementation of the em3d Olden benchmark. This Olden + * benchmark models the propagation of electromagnetic waves through + * objects in 3 dimensions. It is a simple computation on an irregular + * bipartite graph containing nodes representing electric and magnetic + * field values. + * + *

+ * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von + * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing + * 1993, pages 262-273. + * + **/ +public class Em3d extends Thread +{ + + /** + * The number of nodes (E and H) + **/ + private int numNodes; + /** + * The out-degree of each node. + **/ + private int numDegree; + /** + * The number of compute iterations + **/ + private int numIter; + /** + * Should we print the results and other runtime messages + **/ + private boolean printResult; + /** + * Print information messages? + **/ + private boolean printMsgs; + + BiGraph bg; + int upperlimit; + int lowerlimit; + Barrier mybarr; + + public Em3d() { + numNodes = 0; + numDegree = 0; + numIter = 1; + printResult = false; + printMsgs = false; + } + + public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) { + this.bg = bg; + this.lowerlimit = lowerlimit; + this.upperlimit = upperlimit; + this.numIter = numIter; + this.mybarr = mybarr; + } + + public void run() { + int iteration; + Barrier barr; + Node enodebase; + Node hnodebase; + + atomic { + iteration = numIter; + barr=mybarr; + } + atomic { + enodebase=bg.eNodes; + hnodebase=bg.hNodes; + for(int j = 0; j numThreads = " + numThreads+"\n"); + Barrier mybarr; + atomic { + mybarr = global new Barrier(numThreads); + } + BiGraph graph; + Random rand = new Random(783); + atomic { + graph = BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand); + } + + long end0 = System.currentTimeMillis(); + + // compute a single iteration of electro-magnetic propagation + if (em.printMsgs) + System.printString("Propagating field values for " + em.numIter + + " iteration(s)...\n"); + long start1 = System.currentTimeMillis(); + Em3d[] em3d; + atomic { + em3d = global new Em3d[numThreads]; + em3d[0] = global new Em3d(graph, 0, em.numNodes/2, em.numIter, mybarr); + em3d[1] = global new Em3d(graph, (em.numNodes/2) + 1, em.numNodes, em.numIter, mybarr); + } + + Em3d tmp; + for(int i = 0; i -d [-p] [-m] [-h]\n"); + System.printString(" -N the number of nodes\n"); + System.printString(" -d the out-degree of each node\n"); + System.printString(" -i the number of iterations\n"); + System.printString(" -p (print detailed results\n)"); + System.printString(" -m (print informative messages)\n"); + System.printString(" -h (this message)\n"); + } + +} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d4.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d4.java new file mode 100644 index 00000000..73c71fa8 --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3d4.java @@ -0,0 +1,243 @@ +/** + * + * + * Java implementation of the em3d Olden benchmark. This Olden + * benchmark models the propagation of electromagnetic waves through + * objects in 3 dimensions. It is a simple computation on an irregular + * bipartite graph containing nodes representing electric and magnetic + * field values. + * + *

+ * D. Culler, A. Dusseau, S. Goldstein, A. Krishnamurthy, S. Lumetta, T. von + * Eicken and K. Yelick. "Parallel Programming in Split-C". Supercomputing + * 1993, pages 262-273. + * + **/ +public class Em3d extends Thread +{ + + /** + * The number of nodes (E and H) + **/ + private int numNodes; + /** + * The out-degree of each node. + **/ + private int numDegree; + /** + * The number of compute iterations + **/ + private int numIter; + /** + * Should we print the results and other runtime messages + **/ + private boolean printResult; + /** + * Print information messages? + **/ + private boolean printMsgs; + + BiGraph bg; + int upperlimit; + int lowerlimit; + Barrier mybarr; + + public Em3d() { + numNodes = 0; + numDegree = 0; + numIter = 1; + printResult = false; + printMsgs = false; + } + + public Em3d(BiGraph bg, int lowerlimit, int upperlimit, int numIter, Barrier mybarr) { + this.bg = bg; + this.lowerlimit = lowerlimit; + this.upperlimit = upperlimit; + this.numIter = numIter; + this.mybarr = mybarr; + } + + public void run() { + int iteration; + Barrier barr; + Node enodebase; + Node hnodebase; + + atomic { + iteration = numIter; + barr=mybarr; + } + atomic { + enodebase=bg.eNodes; + hnodebase=bg.hNodes; + for(int j = 0; j numThreads = " + numThreads+"\n"); + Barrier mybarr; + atomic { + mybarr = global new Barrier(numThreads); + } + BiGraph graph; + Random rand = new Random(783); + atomic { + graph = BiGraph.create(em.numNodes, em.numDegree, em.printResult, rand); + } + + long end0 = System.currentTimeMillis(); + + // compute a single iteration of electro-magnetic propagation + if (em.printMsgs) + System.printString("Propagating field values for " + em.numIter + + " iteration(s)...\n"); + long start1 = System.currentTimeMillis(); + Em3d[] em3d; + atomic { + em3d = global new Em3d[numThreads]; + em3d[0] = global new Em3d(graph, 0, em.numNodes/4, em.numIter, mybarr); + em3d[1] = global new Em3d(graph, (em.numNodes/4) + 1, em.numNodes/2, em.numIter, mybarr); + em3d[2] = global new Em3d(graph, (em.numNodes/2) + 1, (3*em.numNodes)/4, em.numIter, mybarr); + em3d[3] = global new Em3d(graph, ((3*em.numNodes)/4 + 1), em.numNodes, em.numIter, mybarr); + } + + Em3d tmp; + for(int i = 0; i -d [-p] [-m] [-h]\n"); + System.printString(" -N the number of nodes\n"); + System.printString(" -d the out-degree of each node\n"); + System.printString(" -i the number of iterations\n"); + System.printString(" -p (print detailed results\n)"); + System.printString(" -m (print informative messages)\n"); + System.printString(" -h (this message)\n"); + } + +} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile index dde4656e..db09624d 100644 --- a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/makefile @@ -3,12 +3,30 @@ SRC=${MAINCLASS}.java \ BiGraph.java \ Node.java \ Barrier.java -FLAGS=-dsm -prefetch -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -nooptimize -profile -debug -mainclass ${MAINCLASS} -o ${MAINCLASS} -FLAGS2=-dsm -nooptimize -profile -debug -mainclass ${MAINCLASS} -o ${MAINCLASS}NP +SRC1=${MAINCLASS}1.java \ + BiGraph.java \ + Node.java \ + Barrier.java +SRC2=${MAINCLASS}2.java \ + BiGraph.java \ + Node.java \ + Barrier.java +SRC4=${MAINCLASS}4.java \ + BiGraph.java \ + Node.java \ + Barrier.java +FLAGS=-dsm -prefetch -excprefetch Em3d.main -excprefetch BiGraph.create -excprefetch Node.Node -excprefetch Node.fillTable -excprefetch Node.makeUniqueNeighbors -excprefetch Node.makeFromNodes -excprefetch Node.updateFromNodes -nooptimize -profile -debug -mainclass ${MAINCLASS} +FLAGS2=-dsm -nooptimize -profile -debug -mainclass ${MAINCLASS} default: - ../../../../buildscript ${FLAGS2} ${SRC} - ../../../../buildscript ${FLAGS} ${SRC} +# ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}NP ${SRC} +# ../../../../buildscript ${FLAGS} -o ${MAINCLASS} ${SRC} + ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}1NP ${SRC1} + ../../../../buildscript ${FLAGS} -o ${MAINCLASS}1 ${SRC1} + ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}2NP ${SRC2} + ../../../../buildscript ${FLAGS} -o ${MAINCLASS}2 ${SRC2} + ../../../../buildscript ${FLAGS2} -o ${MAINCLASS}4NP ${SRC4} + ../../../../buildscript ${FLAGS} -o ${MAINCLASS}4 ${SRC4} clean: rm -rf tmpbuilddirectory