public class Nqueens extends Object
This program computes all solutions to the n-queens problem where n is specified in args (default = 12), and repeats the computation "repeat" times where "repeat" is specifies in args (default = ). There is a cutoff value specified as an optional third parameter in args (default = 3) that is used in the async seq clause to specify when a new async should be created.
The program uses the count of the total number of solutions as a correctness check and also prints the execution time for each repetition. The HjFinishAccumulator class is used to accumulate the total count as an illustration of how non-blocking operations can be used in conjunction with HJ.
Note the use of single "finish" statement in findQueensPar() that awaits termination of all async's created by the recursive calls to nqueensKernelPar.
To study scalability on a multi-core processor, you can execute "Nqueens 13 4 6" by varying the number of worker threads.
|Constructor and Description|