38 |
|
return; |
39 |
|
} |
40 |
|
|
41 |
< |
ForkJoinPool fjp = new ForkJoinPool(); |
41 |
> |
ForkJoinPool fjp = ForkJoinPool.commonPool(); |
42 |
|
|
43 |
|
// allocate enough space for edges |
44 |
|
int dim = n+2; |
67 |
|
Driver driver = new Driver(a, b, 1, n, 1, n, steps, granularity); |
68 |
|
|
69 |
|
long startTime = System.currentTimeMillis(); |
70 |
< |
fjp.invoke(driver); |
70 |
> |
driver.invoke(); |
71 |
|
|
72 |
|
long time = System.currentTimeMillis() - startTime; |
73 |
|
double secs = ((double)time) / 1000.0; |
74 |
|
|
75 |
|
System.out.println("Compute Time: " + secs); |
76 |
|
System.out.println(fjp); |
77 |
+ |
System.gc(); |
78 |
|
} |
79 |
|
} |
80 |
|
|
110 |
|
double[][] b = AtoB ? B : A; |
111 |
|
|
112 |
|
double md = 0.0; // local for computing max diff |
112 |
– |
|
113 |
|
for (int i = loRow; i <= hiRow; ++i) { |
114 |
|
for (int j = loCol; j <= hiCol; ++j) { |
115 |
|
double v = 0.25 * (a[i-1][j] + a[i][j-1] + |
116 |
|
a[i+1][j] + a[i][j+1]); |
117 |
|
b[i][j] = v; |
118 |
< |
|
119 |
< |
double diff = v - a[i][j]; |
118 |
> |
double prev = a[i][j]; |
119 |
> |
double diff = v - prev; |
120 |
|
if (diff < 0) diff = -diff; |
121 |
|
if (diff > md) md = diff; |
122 |
|
} |