ViewVC Help
View File | Revision Log | Show Annotations | Download File | Root Listing
root/jsr166/jsr166/src/test/loops/LU.java
(Generate patch)

Comparing jsr166/src/test/loops/LU.java (file contents):
Revision 1.5 by jsr166, Tue Mar 15 19:47:05 2011 UTC vs.
Revision 1.9 by dl, Sat Sep 12 18:59:08 2015 UTC

# Line 6 | Line 6
6  
7   //import jsr166y.*;
8   import java.util.concurrent.*;
9 import java.util.concurrent.TimeUnit;
10
9  
10   /**
11   * LU matrix decomposition demo
# Line 28 | Line 26 | public final class LU {
26  
27          int procs = 0;
28          int n = 2048;
29 <        int runs = 5;
29 >        int runs = 32;
30          try {
31              if (args.length > 0)
32                  procs = Integer.parseInt(args[0]);
# Line 45 | Line 43 | public final class LU {
43              System.out.println(usage);
44              return;
45          }
46 <        ForkJoinPool pool = (procs == 0) ? new ForkJoinPool() :
46 >        ForkJoinPool pool = (procs == 0) ? ForkJoinPool.commonPool() :
47              new ForkJoinPool(procs);
48          System.out.println("procs: " + pool.getParallelism() +
49                             " n: " + n + " runs: " + runs);
# Line 66 | Line 64 | public final class LU {
64              pool.invoke(new LowerUpper(n, M));
65              long time = System.nanoTime() - start;
66              double secs = ((double)time) / NPS;
67 <            System.out.printf("\tTime: %7.3f\n", secs);
67 >            System.out.printf("Time: %7.3f ", secs);
68 >            if ((run & 3) == 3) System.out.println();
69  
70              if (CHECK) check(m, copy, n);
71          }
# Line 74 | Line 73 | public final class LU {
73          pool.shutdown();
74      }
75  
77
76      static void randomInit(double[][] M, int n) {
77          java.util.Random rng = new java.util.Random();
78          for (int i = 0; i < n; ++i)
# Line 105 | Line 103 | public final class LU {
103          System.out.println("Max difference = " + maxDiff);
104      }
105  
108
106      // Blocks record underlying matrix, and offsets into current block
107      static final class Block {
108          final double[][] m;
# Line 218 | Line 215 | public final class LU {
215                  Block L10 = new Block(L.m, L.loRow+h, L.loCol);
216                  Block L11 = new Block(L.m, L.loRow+h, L.loCol+h);
217  
221
218                  Seq3 s1 =
219                      seq(new Lower(h, L00, M00),
220                          new Schur(h, L10, M00, M10),
# Line 234 | Line 230 | public final class LU {
230          }
231      }
232  
237
233      static final class Upper extends RecursiveAction {
234          final int size;
235          final Block U;
# Line 258 | Line 253 | public final class LU {
253              }
254          }
255  
261
256          public void compute() {
257              if (size == BLOCK_SIZE) {
258                  upper();
# Line 291 | Line 285 | public final class LU {
285          }
286      }
287  
294
288      static final class LowerUpper extends RecursiveAction {
289          final int size;
290          final Block M;
# Line 379 | Line 372 | public final class LU {
372              thr.invoke();
373          }
374      }
382
383
384
375   }
386

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines