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

Comparing jsr166/src/test/loops/FJJacobi.java (file contents):
Revision 1.3 by jsr166, Mon Nov 2 23:42:46 2009 UTC vs.
Revision 1.9 by jsr166, Fri Oct 22 05:18:31 2010 UTC

# Line 7 | Line 7
7   // Jacobi iteration on a mesh. Based loosely on a Filaments demo
8  
9   import java.util.concurrent.*;
10 //import jsr166y.*;
10  
11   public class FJJacobi {
12  
# Line 16 | Line 15 | public class FJJacobi {
15      /**
16       * The maximum number of matrix cells
17       * at which to stop recursing down and instead directly update.
18 <     **/
20 <
18 >     */
19      static final double EPSILON = 0.0001;  // convergence criterion
20  
21      public static void main(String[] args) throws Exception {
# Line 47 | Line 45 | public class FJJacobi {
45          double[][] a = new double[dim][dim];
46          double[][] b = new double[dim][dim];
47          // Initialize interiors to small value
48 <        double smallVal = 1.0/dim;
48 >        double smallVal = EPSILON; // 1.0/dim;
49          for (int i = 1; i < dim-1; ++i) {
50              for (int j = 1; j < dim-1; ++j)
51                  a[i][j] = smallVal;
52          }
53 <
54 <        int nreps = 3;
53 >        // Fill all edges with 1's.
54 >        for (int k = 0; k < dim; ++k) {
55 >            a[k][0] = 1.0;
56 >            a[k][n+1] = 1.0;
57 >            a[0][k] = 1.0;
58 >            a[n+1][k] = 1.0;
59 >            b[k][0] = 1.0;
60 >            b[k][n+1] = 1.0;
61 >            b[0][k] = 1.0;
62 >            b[n+1][k] = 1.0;
63 >        }
64 >        int nreps = 10;
65          for (int rep = 0; rep < nreps; ++rep) {
58            // Fill all edges with 1's.
59            for (int k = 0; k < dim; ++k) {
60                a[k][0] += 1.0;
61                a[k][n+1] += 1.0;
62                a[0][k] += 1.0;
63                a[n+1][k] += 1.0;
64            }
66              Driver driver = new Driver(a, b, 1, n, 1, n, steps, granularity);
67  
68              long startTime = System.currentTimeMillis();
# Line 71 | Line 72 | public class FJJacobi {
72              double secs = ((double)time) / 1000.0;
73  
74              System.out.println("Compute Time: " + secs);
74            System.out.println("Workers: " + fjp.getPoolSize());
75              System.out.println(fjp);
76          }
77      }
# Line 88 | Line 88 | public class FJJacobi {
88              if (tryUnfork())
89                  compute();
90              else {
91 <                //                quietlyJoin();
92 <                quietlyHelpJoin();
91 >                quietlyJoin();
92                  reinitialize();
93              }
94              double m = maxDiff;

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines