--- jsr166/src/test/loops/FJJacobi.java 2010/10/22 05:18:31 1.9 +++ jsr166/src/test/loops/FJJacobi.java 2015/09/12 18:34:50 1.14 @@ -1,7 +1,7 @@ /* * Written by Doug Lea with assistance from members of JCP JSR-166 * Expert Group and released to the public domain, as explained at - * http://creativecommons.org/licenses/publicdomain + * http://creativecommons.org/publicdomain/zero/1.0/ */ // Jacobi iteration on a mesh. Based loosely on a Filaments demo @@ -10,7 +10,8 @@ import java.util.concurrent.*; public class FJJacobi { - static final int DEFAULT_GRANULARITY = 4096; // 1024; + // static final int DEFAULT_GRANULARITY = 4096; + static final int DEFAULT_GRANULARITY = 256; /** * The maximum number of matrix cells @@ -37,7 +38,8 @@ public class FJJacobi { return; } - ForkJoinPool fjp = new ForkJoinPool(); + // ForkJoinPool fjp = new ForkJoinPool(1); + ForkJoinPool fjp = ForkJoinPool.commonPool(); // allocate enough space for edges int dim = n+2; @@ -73,10 +75,10 @@ public class FJJacobi { System.out.println("Compute Time: " + secs); System.out.println(fjp); + Thread.sleep(1000); } } - abstract static class MatrixTree extends RecursiveAction { // maximum difference between old and new values double maxDiff; @@ -94,10 +96,8 @@ public class FJJacobi { double m = maxDiff; return (md > m) ? md : m; } - } - static final class LeafNode extends MatrixTree { final double[][] A; // matrix to get old values from final double[][] B; // matrix to put new values into @@ -161,7 +161,6 @@ public class FJJacobi { } } - static final class TwoNode extends MatrixTree { final MatrixTree q1; final MatrixTree q2; @@ -177,7 +176,6 @@ public class FJJacobi { } - static final class Driver extends RecursiveAction { MatrixTree mat; double[][] A; double[][] B; @@ -249,6 +247,4 @@ public class FJJacobi { System.out.println("max diff after " + steps + " steps = " + md); } } - - }