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

Comparing jsr166/src/test/loops/FJPhaserJacobi.java (file contents):
Revision 1.8 by jsr166, Mon Sep 20 20:42:37 2010 UTC vs.
Revision 1.13 by dl, Sat Sep 12 18:37:19 2015 UTC

# Line 1 | Line 1
1 < // Barrier version of Jacobi iteration
1 > /*
2 > * Written by Doug Lea with assistance from members of JCP JSR-166
3 > * Expert Group and released to the public domain, as explained at
4 > * http://creativecommons.org/publicdomain/zero/1.0/
5 > */
6  
7   import java.util.concurrent.*;
8  
9 + /** Barrier version of Jacobi iteration */
10   public class FJPhaserJacobi {
11  
12      static int dimGran;
13  
14      static final double EPSILON = 0.0001;  // convergence criterion
15  
16 <    public static void main(String[] args) {
16 >    public static void main(String[] args) throws Exception {
17          int n = 2048;
18          int steps = 1000;
19          try {
# Line 23 | Line 28 | public class FJPhaserJacobi {
28              return;
29          }
30  
31 <        ForkJoinPool fjp = new ForkJoinPool();
31 >        //        ForkJoinPool fjp = new ForkJoinPool();
32 >        ForkJoinPool fjp = ForkJoinPool.commonPool();
33 >
34          //        int granularity = (n * n / fjp.getParallelism()) / 2;
35          int granularity = n * n / fjp.getParallelism();
36          dimGran = (int)(Math.sqrt(granularity));
# Line 39 | Line 46 | public class FJPhaserJacobi {
46              for (int j = 1; j < dim-1; ++j)
47                  a[i][j] = smallVal;
48          }
49 <        int nreps = 3;
49 >        int nreps = 10;
50          for (int rep = 0; rep < nreps; ++rep) {
51              // Fill all edges with 1's.
52              for (int k = 0; k < dim; ++k) {
# Line 57 | Line 64 | public class FJPhaserJacobi {
64  
65              System.out.println("Compute Time: " + secs);
66              System.out.println(fjp);
67 <
67 >            Thread.sleep(1000);
68          }
62
69      }
70  
71      static class Segment extends CyclicAction {
# Line 137 | Line 143 | public class FJPhaserJacobi {
143          public void compute() {
144              int rows = hiRow - loRow + 1;
145              int cols = hiCol - loCol + 1;
146 <            int rblocks = (int)(Math.round((float)rows / dimGran));
147 <            int cblocks = (int)(Math.round((float)cols / dimGran));
146 >            int rblocks = Math.round((float)rows / dimGran);
147 >            int cblocks = Math.round((float)cols / dimGran);
148  
149              int n = rblocks * cblocks;
150  
# Line 171 | Line 177 | public class FJPhaserJacobi {
177          }
178      }
179   }
174

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines