When exactly are supposed all explicit tasks tied to the current thread waited for?
- Code: Select all
int l = 0;
#pragma omp parallel reduction (+:l) num_threads (1)
#pragma omp task shared (l)
/* #pragma omp taskwait */
if (l != 1)
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)?