HOME
| OPENMP API Specification: Version 5.0 November 2018

2.17.5  taskwait Construct

SummaryThe taskwait construct specifies a wait on the completion of child tasks of the current task. The taskwait construct is a stand-alone directive.

Syntax

SVG-Viewer needed.

The syntax of the taskwait construct is as follows:  

 
#pragma omp taskwait [clause[ [,] clause] ... ] new-line  

where clause is one of the following:  

 
depend([depend-modifier,]dependence-type : locator-list)  

SVG-Viewer needed.

SVG-Viewer needed.

The syntax of the taskwait construct is as follows:  

 
!$omp taskwait [clause[ [,] clause] ... ]  

where clause is one of the following:  

 
depend([depend-modifier,]dependence-type : locator-list)  

SVG-Viewer needed.

BindingThe taskwait region binds to the current task region. The binding thread set of the taskwait region is the current team.

Description If no depend clause is present on the taskwait construct, the current task region is suspended at an implicit task scheduling point associated with the construct. The current task region remains suspended until all child tasks that it generated before the taskwait region complete execution.

Otherwise, if one or more depend clauses are present on the taskwait construct, the behavior is as if these clauses were applied to a task construct with an empty associated structured block that generates a mergeable and included task. Thus, the current task region is suspended until the predecessor tasks of this task complete execution.

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

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

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

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

Tool Callbacks A thread dispatches a registered ompt_callback_sync_region callback with ompt_sync_region_taskwait as its kind argument and ompt_scope_begin as its endpoint argument for each occurrence of a taskwait-begin event in the task that encounters the taskwait construct. Similarly, a thread dispatches a registered ompt_callback_sync_region callback with ompt_sync_region_taskwait as its kind argument and ompt_scope_end as its endpoint argument for each occurrence of a taskwait-end event in the task that encounters the taskwait construct. These callbacks occur in the task that encounters the taskwait 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_taskwait as its kind argument and ompt_scope_begin as its endpoint argument for each occurrence of a taskwait-wait-begin event. Similarly, a thread dispatches a registered ompt_callback_sync_region_wait callback with ompt_sync_region_taskwait as its kind argument and ompt_scope_end as its endpoint argument for each occurrence of a taskwait-wait-end event. These callbacks occur in the context of the task that encounters the taskwait construct and have type signature ompt_callback_sync_region_t.

RestrictionsThe following restrictions apply to the taskwait construct:

Cross References