From: bdemsky Date: Wed, 7 May 2008 22:59:47 +0000 (+0000) Subject: check in old versions also X-Git-Tag: preEdgeChange~89 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=3e62172bc22b96400f13de3061980ce222867efe;p=IRC.git check in old versions also --- diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraphNold.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraphNold.java new file mode 100644 index 00000000..9c5a8f69 --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/BiGraphNold.java @@ -0,0 +1,107 @@ +/** + * A class that represents the irregular bipartite graph used in + * EM3D. The graph contains two linked structures that represent the + * E nodes and the N nodes in the application. + **/ +public class BiGraph +{ + public BiGraph() { + } + /** + * Nodes that represent the electrical field. + **/ + Node[] eNodes; + /** + * Nodes that representhe the magnetic field. + **/ + Node[] hNodes; + + /** + * Construct the bipartite graph. + * @param e the nodes representing the electric fields + * @param h the nodes representing the magnetic fields + **/ + BiGraph(Node[] e, Node[] h) + { + eNodes = e; + hNodes = h; + } + + /** + * Create the bi graph that contains the linked list of + * e and h nodes. + * @param numNodes the number of nodes to create + * @param numDegree the out-degree of each node + * @param verbose should we print out runtime messages + * @return the bi graph that we've created. + **/ + + static BiGraph create(int numNodes, int numDegree, boolean verbose, Random r) + { + + // making nodes (we create a table) + //if (verbose) System.printString("making nodes (tables in orig. version)"); + Node [] eTable=Node.fillTable(numNodes, numDegree, r); + Node [] hTable=Node.fillTable(numNodes, numDegree, r); + + // making neighbors + //if (verbose) System.printString("updating from and coeffs"); + for(int i = 0; i< numNodes; i++) { + Node n = hTable[i]; + n.makeUniqueNeighbors(eTable, r); + } + + for (int i = 0; i < numNodes; i++) { + Node n = eTable[i]; + n.makeUniqueNeighbors(hTable, r); + } + + // Create the fromNodes and coeff field + //if (verbose) System.printString("filling from fields"); + for(int i = 0; i< numNodes; i++) { + Node n = hTable[i]; + n.makeFromNodes(); + } + + for (int i = 0; i < numNodes; i++) { + Node n = eTable[i]; + n.makeFromNodes(); + } + + // Update the fromNodes + for (int i = 0; i < numNodes; i++) { + Node n = hTable[i]; + n.updateFromNodes(r); + } + for (int i = 0; i < numNodes; i++) { + Node n = eTable[i]; + n.updateFromNodes(r); + } + + BiGraph g = global new BiGraph(eTable, hTable); + return g; + } + + /** + * Override the toString method to print out the values of the e and h nodes. + * @return a string contain the values of the e and h nodes. + **/ + public String toString() + { + StringBuffer retval = new StringBuffer(); + Node tmp = eNodes[0]; + while(tmp!=null) { + Node n = tmp; + retval.append("E: " + n + "\n"); + tmp = tmp.next; + } + tmp = hNodes[0]; + while(tmp!=null) { + Node n = tmp; + retval.append("H: " + n + "\n"); + tmp = tmp.next; + } + return retval.toString(); + } + +} diff --git a/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dNold.java b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dNold.java new file mode 100644 index 00000000..daf334ef --- /dev/null +++ b/Robust/src/Benchmarks/Prefetch/Em3d/dsm/Em3dNold.java @@ -0,0 +1,244 @@ +/** + * + * + * 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; + + int numThreads; + + 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; + + atomic { + iteration = numIter; + barr=mybarr; + } + + for (int i = 0; i < iteration; i++) { + /* for eNodes */ + atomic { + for(int j = lowerlimit; j numThreads = " + numThreads+"\n"); + Barrier mybarr; + BiGraph graph; + Random rand = new Random(783); + + atomic { + mybarr = global new Barrier(numThreads); + 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]; + int increment=em.numNodes/numThreads; + int base=0; + for(int i=0;i -N -d [-p] [-m] [-h]\n"); + System.printString(" -N the number of nodes\n"); + System.printString(" -T the number of threads\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"); + } + +}