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/licenses/publicdomain |
4 |
> |
* http://creativecommons.org/publicdomain/zero/1.0/ |
5 |
|
*/ |
6 |
|
|
7 |
|
|
40 |
|
System.out.printf("seq : %9.5f\n", elapsed); |
41 |
|
} |
42 |
|
|
43 |
< |
ForkJoinPool fjp = new ForkJoinPool(2); |
44 |
< |
for (int i = 2; i <= NCPU; i <<= 1) { |
45 |
< |
fjp.setParallelism(i); |
46 |
< |
oneRun(fjp, array, i, reps, tests); |
47 |
< |
} |
48 |
< |
for (int i = NCPU; i >= 1; i >>>= 1) { |
49 |
< |
fjp.setParallelism(i); |
50 |
< |
oneRun(fjp, array, i, reps, tests); |
43 |
> |
for (int sweeps = 0; sweeps < 2; ++sweeps) { |
44 |
> |
for (int i = 2; i <= NCPU; i <<= 1) { |
45 |
> |
ForkJoinPool fjp = new ForkJoinPool(i); |
46 |
> |
oneRun(fjp, array, i, reps, tests); |
47 |
> |
fjp.shutdown(); |
48 |
> |
} |
49 |
> |
for (int i = NCPU; i >= 1; i >>>= 1) { |
50 |
> |
ForkJoinPool fjp = new ForkJoinPool(i); |
51 |
> |
oneRun(fjp, array, i, reps, tests); |
52 |
> |
fjp.shutdown(); |
53 |
> |
} |
54 |
|
} |
52 |
– |
fjp.shutdown(); |
55 |
|
} |
56 |
|
|
57 |
|
static void oneRun(ForkJoinPool fjp, |