--- jsr166/src/test/loops/FJJacobi.java 2010/07/07 20:32:04 1.5 +++ jsr166/src/test/loops/FJJacobi.java 2010/10/22 05:18:31 1.9 @@ -7,7 +7,6 @@ // Jacobi iteration on a mesh. Based loosely on a Filaments demo import java.util.concurrent.*; -//import jsr166y.*; public class FJJacobi { @@ -16,8 +15,7 @@ public class FJJacobi { /** * The maximum number of matrix cells * at which to stop recursing down and instead directly update. - **/ - + */ static final double EPSILON = 0.0001; // convergence criterion public static void main(String[] args) throws Exception { @@ -47,31 +45,33 @@ public class FJJacobi { double[][] a = new double[dim][dim]; double[][] b = new double[dim][dim]; // Initialize interiors to small value - double smallVal = 1.0/dim; + double smallVal = EPSILON; // 1.0/dim; for (int i = 1; i < dim-1; ++i) { for (int j = 1; j < dim-1; ++j) a[i][j] = smallVal; } - - int nreps = 3; + // Fill all edges with 1's. + for (int k = 0; k < dim; ++k) { + a[k][0] = 1.0; + a[k][n+1] = 1.0; + a[0][k] = 1.0; + a[n+1][k] = 1.0; + b[k][0] = 1.0; + b[k][n+1] = 1.0; + b[0][k] = 1.0; + b[n+1][k] = 1.0; + } + int nreps = 10; for (int rep = 0; rep < nreps; ++rep) { - // Fill all edges with 1's. - for (int k = 0; k < dim; ++k) { - a[k][0] += 1.0; - a[k][n+1] += 1.0; - a[0][k] += 1.0; - a[n+1][k] += 1.0; - } Driver driver = new Driver(a, b, 1, n, 1, n, steps, granularity); long startTime = System.currentTimeMillis(); fjp.invoke(driver); long time = System.currentTimeMillis() - startTime; - double secs = (double) time / 1000.0; + double secs = ((double)time) / 1000.0; System.out.println("Compute Time: " + secs); - System.out.println("Workers: " + fjp.getPoolSize()); System.out.println(fjp); } } @@ -88,7 +88,6 @@ public class FJJacobi { if (tryUnfork()) compute(); else { - // quietlyJoin(); quietlyJoin(); reinitialize(); }