Name: single | Association: block |
Category: executable | Properties: work-distribution, worksharing, thread-limiting |
|
Clauses
allocate, copyprivate, firstprivate, nowait, privateBinding
The binding thread set for a single region is the current team. A single region binds to the innermost enclosing parallel region. Only the threads of the team that executes the binding parallel region participate in the execution of the structured block and the implied barrier of the single region if the barrier is not eliminated by a nowait clause.Semantics
The single construct specifies that the associated structured block is executed by only one of the threads in the team (not necessarily the primary thread), in the context of its implicit task. The method of choosing a thread to execute the structured block each time the team encounters the construct is implementation defined. An implicit barrier occurs at the end of a single region if the nowait clause is not specified.Execution Model Events
The single-begin event occurs after an implicit task encounters a single construct but before the task starts to execute the structured block of the single region.
The single-end event occurs after an implicit task finishes execution of a single region but before it resumes execution of the enclosing region.
Tool Callbacks
A thread dispatches a registered ompt_callback_work callback with ompt_scope_begin as its endpoint argument for each occurrence of a single-begin event in that thread. Similarly, a thread dispatches a registered ompt_callback_work callback with ompt_scope_end as its endpoint argument for each occurrence of a single-end event in that thread. For each of these callbacks, the wstype argument is ompt_work_single_executor if the thread executes the structured block associated with the single region; otherwise, the wstype argument is ompt_work_single_other. The callback has type signature ompt_callback_work_t.
Restrictions
Restrictions to the single construct are as follows:Cross References