Page 1 of 1

Example 13.c (final)

Posted: Mon Dec 09, 2019 1:32 am
by fohry
Hi,

I've a question on Example 13c (p. 83):

According to the OpenMP specification, a task is final if it enforces its
CHILDREN to become included tasks. As to my understanding, the task
itself is not included, though.

In Example 13c, let us, for instance, set LIMIT=-1, such that the
condition in final always evaluates to true. Then, in the topmost call
of bin_search, the tasks in lines S-11 and S-21 are final, but these
two tasks may still be run in parallel (only their children are included).

So omp_in_final() evaluates to true, and lines S-15-16 and S-25/26 are
NOT executed. Therefore, it seems as that lines S-18 and S-28 of the two
parallel tasks write concurrently to the same memory location.

Have I misunderstood something, or how can the problem be resolved?

Best regards,

Claudia