When exactly are supposed all explicit tasks tied to the current thread waited for?
Say is:
- Code: Select all
#include <omp.h>
#include <stdlib.h>
int
main (void)
{
int l = 0;
#pragma omp parallel reduction (+:l) num_threads (1)
{
#pragma omp task shared (l)
l++;
/* #pragma omp taskwait */
}
if (l != 1)
abort ();
return 0;
}
valid? I.e. is the point where all explicit tasks tied to the current thread after the last instruction in the implicit task, or later (e.g. after all reduction var merging, running destructors, etc.)?
Mandating it before might penalize even OpenMP 2.5 code or code that never uses tasks - as tasks can be created in other functions called from implicit task, not necessarily the implicit task itself,
this would mean the compiler needs to add before reduction merging code, lastprivate copying and running destructors probably a function call which would wait for all pending tasks. With
OpenMP 2.5 that wasn't necessary. Or is the above undefined and the above mentioned note applies in this case (and so the commented out taskwait is needed)?
