2 * A Java implementation of the <tt>power</tt> Olden benchmark. The original
3 * algorithm is from the following paper:
5 * <cite> S. Lumetta, L. Murphy, X. Li, D. Culler, and I. Khalil. "Decentralized
6 * optimal power pricing: The development of a parallel program." Supercomputing
9 * Note - the number of customers is fixed at 10,000 for this benchmark. We
10 * create a data structure that contains 1 root (the (power substation). There
11 * are 10 main feeders from the root and each feeder branches to 20 lateral
12 * nodes. Each lateral node is the head of a line of five branch nodes and each
13 * branch has 10 customers. In total, there are 10,000 customers (and 1201
16 * The power pricing problems sets the price of each customer's power
17 * consumption so that the economic efficiency of the whole community is
22 * Should we print the results as we run the benchmark
24 // static boolean printResults;
26 * Print information messages?
28 // static boolean printMsgs;
31 * The main routine which creates the power network and runs the simulation
34 * the command line args
36 public static void main(String args[]) {
38 boolean printResults = false;
39 boolean printMsgs =true;
40 // the input size is fixed, but the user may want the result printed
41 // parseCmdLine(args);
44 long start0 = System.currentTimeMillis();
45 // Root r = new Root(10, 20, 5, 10);
46 // Root r = new Root(24, 18, 5, 10);
47 // Root r = new Root(22, 20, 5, 10);
48 Root r = new Root(21, 20, 5, 10);
49 // Root r = new Root(20, 20, 5, 10);
50 long end0 = System.currentTimeMillis();
52 long start1 = System.currentTimeMillis();
54 r.nextIter(false, 0.7, 0.14);
59 System.out.println(r);
64 r.nextIter(printResults);
67 long end1 = System.currentTimeMillis();
70 System.out.println("Power build time " + (end0 - start0) / 1000.0);
72 .println("Power compute time " + (end1 - start1) / 1000.0);
73 System.out.println("Power total time " + (end1 - start0) / 1000.0);
75 System.out.println("Done!");
79 * Parse the command line options.
82 * the command line options.
85 * private static final void parseCmdLine(String args[]) { int i = 0; String
88 * while (i < args.length && args[i].startsWith("-")) { arg = args[i++]; if
89 * (arg.equals("-h")) { usage(); } else if (arg.equals("-p")) { printResults
90 * = true; } else if (arg.equals("-m")) { printMsgs = true; } } }
94 * The usage routine which describes the program options.
96 private static final void usage() {
97 System.out.println("usage: java Power [-p] [-m] [-h]");
98 System.out.println(" -p (print results)");
99 System.out.println(" -m (print informative messages)");
100 System.out.println(" -h (this message)");