We have the following questions from one of my USC students related to lecture notes, Implementing Task Decomposition.
At page 26 of above note,
int main ()
struct board *stack;
#pragma omp parallel search_for_solutions
(n, stack, &num_solutions);
void search_for_solutions (int n,
struct board *stack, int *num_solutions)
while (stack != NULL) ...
I do not understand why variable stack is private.
Even though it appears to be a local variable,
it is defined outside the omp parallel construct,
and so it will be treated as shared by default (page 39 from Lecture Note Programming with OpenMP, the second class).
If variable stack is private, then we could just define it as shared by
#pragma omp parallel shared (stack)
Variable stack is already protected by omp critical construct, I think this will work correctly.
But, the lecture note did not mention about this solution.
Is this a bad and/or wrong solution?
Professor Jose Villeta
EE-CSCI 452 Game Hardware Architectures