Intel® C++ Compiler XE 13.1 User and Reference Guides
Specifies a wait on the completion of child tasks generated since the beginning of the current task
#pragma omp taskwait |
The omp taskwait pragma specifies a wait on the completion of child tasks generated since the beginning of the current task. The taskwait region includes an implicit task scheduling point in the current task region. The current task region is suspended at the task scheduling point until execution of all its child tasks generated before the taskwait region are completed.
In the following example, the taskwait pragma causes Task 3 to wait until the completion of Task 4. It does not wait for the completion of Task 2 or Task 1.
#pragma omp task // Task 1
{ ...
#pragma omp task // Task 2
{ do_work1(); }
#pragma omp task // Task 3
{ ...
#pragma omp task // Task 4
{ do_work2(); }
...
}
#pragma omp taskwait
...
}
}