Implicit barriers and explicit tasks

The public comment period closed January 31, 2008. This forum is now locked (read only).
Forum rules
The OpenMP Forums are now closed to new posts. Please visit Stack Overflow if you are in need of help:
Posts: 74
Joined: Fri Oct 26, 2007 3:19 am

Implicit barriers and explicit tasks

Post by jakub »

For explicit barriers, 2.8.3 says:
"All threads of the team executing the binding parallel region must execute the barrier region and complete execution of all explicit tasks generated in the binding parallel region up to this point before any are allowed to continue execution beyond the barrier."
Furthermore, 1.3 says that completion of all explicit tasks bound to the current parallel region is guaranteed before the master thread leaves the implicit barrier at the end of the parallel region.
As 2.8.3 is written in the explicit barrier description, I wonder whether implicit barriers provide similar guarantee (then the 1.3 sentence would be even redundant). Say

Code: Select all

int e;
int main ()
  e = 0;
  #pragma omp parallel
    #pragma omp for
    for (int i = 0; i < 4; i++)
      #pragma omp task shared (e)
        #pragma omp atomic
    // Does the implicit barrier here guarantee all explicit tasks completed?
    if (e != 4)
      abort ();