Name: taskwait | Association: none |
Category: executable | Properties: default |
|
Clauses
depend, nowaitBinding
The taskwait region binds to the current task region. The binding thread set of the taskwait region is the current team.Semantics
The taskwait construct specifies a wait on the completion of child tasks of the current task.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.
If one or more depend clauses are present on the taskwait construct and the nowait clause is not also present, 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.
If one or more depend clauses are present on the taskwait construct and the nowait clause is also present, the behavior is as if these clauses were applied to a task construct with an empty associated structured block that generates a task for which execution may be deferred. Thus, all predecessor tasks of this task must complete execution before any subsequently generated task that depends on this task starts its execution.
Execution Model Events
The taskwait-begin event occurs in a thread when it encounters a taskwait construct with no depend clause 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 region corresponding to a taskwait construct with no depend clause.
The taskwait-wait-end event occurs when a task ends an interval of active or passive waiting and resumes execution from a region corresponding to a taskwait construct with no depend clause.
The taskwait-end event occurs in a thread when it encounters a taskwait construct with no depend clause after the taskwait synchronization on exit from the taskwait region.
The taskwait-init event occurs in a thread when it encounters a taskwait construct with one or more depend clauses on entry to the taskwait region.
The taskwait-complete event occurs on completion of the dependent task that results from a taskwait construct with one or more depend clauses, in the context of the thread that executes the dependent task and before any subsequently generated task that depends on the dependent task starts its execution.
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.
A thread dispatches a registered ompt_callback_task_create callback for each occurrence of a taskwait-init event in the context of the encountering task. This callback has the type signature ompt_callback_task_create_t. In the dispatched callback, (flags & ompt_task_taskwait) always evaluates to true. If the nowait clause is not present, (flags & ompt_task_undeferred) also evaluates to true.
A thread dispatches a registered ompt_callback_task_schedule callback for each occurrence of a taskwait-complete event. This callback has the type signature ompt_callback_task_schedule_t with ompt_taskwait_complete as its prior_task_status argument.
Restrictions
Restrictions to the taskwait construct are as follows:Cross References