HOME
| OPENMP API Specification: Version 5.1 November 2020

2.19.6  taskgroup Construct

Summary The taskgroup construct specifies a wait on completion of child tasks of the current task and their descendent tasks.

Syntax

SVG-Viewer needed.

The syntax of the taskgroup construct is as follows:  

 
#pragma omp taskgroup [clause[[,] clause] ...] new-line 
    structured-block  

where clause is one of the following:  

 
task_reduction(reduction-identifier : list) 
allocate([allocator: ]list)  

SVG-Viewer needed.

SVG-Viewer needed.

The syntax of the taskgroup construct is as follows:  

 
!$omp taskgroup [clause [ [,] clause] ...] 
    loosely-structured-block 
!$omp end taskgroup  

or  

 
!$omp taskgroup [clause [ [,] clause] ...] 
    strictly-structured-block 
[!$omp end taskgroup]  

where clause is one of the following:  

 
task_reduction(reduction-identifier : list) 
allocate([allocator: ]list)  

SVG-Viewer needed.

Binding The binding task set of a taskgroup region is all tasks of the current team that are generated in the region. A taskgroup region binds to the innermost enclosing parallel region.

Description When a thread encounters a taskgroup construct, it starts executing the region. All child tasks generated in the taskgroup region and all of their descendants that bind to the same parallel region as the taskgroup region are part of the taskgroup set associated with the taskgroup region.

An implicit task scheduling point occurs at the end of the taskgroup region. The current task is suspended at the task scheduling point until all tasks in the taskgroup set complete execution.

Execution Model Events The taskgroup-begin event occurs in each thread that encounters the taskgroup construct on entry to the taskgroup region.

The taskgroup-wait-begin event occurs when a task begins an interval of active or passive waiting in a taskgroup region.

The taskgroup-wait-end event occurs when a task ends an interval of active or passive waiting and resumes execution in a taskgroup region.

The taskgroup-end event occurs in each thread that encounters the taskgroup construct after the taskgroup synchronization on exit from the taskgroup region.

Tool Callbacks A thread dispatches a registered ompt_callback_sync_region callback with ompt_sync_region_taskgroup as its kind argument and ompt_scope_begin as its endpoint argument for each occurrence of a taskgroup-begin event in the task that encounters the taskgroup construct. Similarly, a thread dispatches a registered ompt_callback_sync_region callback with ompt_sync_region_taskgroup as its kind argument and ompt_scope_end as its endpoint argument for each occurrence of a taskgroup-end event in the task that encounters the taskgroup construct. These callbacks occur in the task that encounters the taskgroup construct and have the type signature ompt_callback_sync_region_t.

A thread dispatches a registered ompt_callback_sync_region_wait callback with ompt_sync_region_taskgroup as its kind argument and ompt_scope_begin as its endpoint argument for each occurrence of a taskgroup-wait-begin event. Similarly, a thread dispatches a registered ompt_callback_sync_region_wait callback with ompt_sync_region_taskgroup as its kind argument and ompt_scope_end as its endpoint argument for each occurrence of a taskgroup-wait-end event. These callbacks occur in the context of the task that encounters the taskgroup construct and have type signature ompt_callback_sync_region_t.

Cross References