If I create a bunch of OpenMP tasks and do not use taskwait
, where does the program wait for that tasks completion? Consider the following example:
#pragma omp parallel
{
#pragma omp single
{
for (int i = 0; i < 1000; i++) {
#pragma omp task
... // e.g., call some independent function
}
// no taskwait here
}
// all the tasks completed now?
}
Does the program wait for task completion at the implicit barrier at the end of the single
block? I assume so, but cannot find any information about this issue in the OpenMP Specification.
EDIT
From barrier
description in OpenMP Spec.:
All threads of the team executing the binding parallel region must execute the barrier region and complete execution of all explicit tasks bound to this parallel region before any are allowed to continue execution beyond the barrier.
This, however, does not says whether I am responsible for task completion or the OpenMP runtime does it for me.