Research Article

Parallel Implementations of Candidate Solution Evaluation Algorithm for N-Queens Problem

Algorithm 11

CUDA dynamic parallelism scheme.
Input:
Output:
(1)tid global thread id in Kernel;
(2)num_tasks N–tid -1;/∗ Get task amount of current thread by thread ID ∗/
(3)if num_tasks threshold then
(4) call Algorithm 10;/∗ For smaller tasks, calculate the results directly ∗/
(5)else
(6) num_subtasks = (num_tasks + threshold -1)/threshold; (Algorithm 11)
(7) call Algorithm 12;/∗ Using dynamic parallel to call subkernel ∗/
(8)end