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); |
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 |
|
} |
48 |
– |
for (int i = NCPU; i >= 1; i >>>= 1) { |
49 |
– |
fjp.setParallelism(i); |
50 |
– |
oneRun(fjp, array, i, reps, tests); |
51 |
– |
} |
52 |
– |
fjp.shutdown(); |
55 |
|
} |
56 |
|
|
57 |
|
static void oneRun(ForkJoinPool fjp, |