Intel® C++ Compiler 16.0 User and Reference Guide

omp taskgroup

Causes the program to wait until the completion of all enclosed and descendant tasks.

Syntax

#pragma omp taskgroup

structured-block

Arguments

None

Description

The thread that encounters the pragma executes the structured block and does not proceed past the end of the structured block until all tasks created inside the taskgroup region are complete.

Example: Instruct the program to wait until all of the tasks created inside the construct are complete

// Thread N reaches here

#pragma omp taskgroup {
   #pragma omp task {
      //task1
   }
   #pragma omp task {
      //task2
      #pragma omp task {
         //task2 child task
      }
   }
}  
// Thread N waits here until task1, task2, and all the child tasks created inside them complete.