Example 13.c (final)

Discuss the OpenMP Examples document, updated for OpenMP 5.0
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help: https://stackoverflow.com/questions/tagged/openmp
Posts: 2
Joined: Mon Dec 21, 2015 5:10 am

Example 13.c (final)

Post by fohry »


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,