Oracle® Solaris Studio 12.4: OpenMP API User's Guide

Exit Print View

Updated: December 2014
 
 

4.1.2 OpenMP Task Types

The OpenMP specification defines various types of tasks that the programmer may use to reduce the overhead of tasking.

An undeferred is a task for which execution is not deferred with respect to the generating task; that is, the generating task region is suspended until execution of the undeferred task is completed. The undeferred task might not be executed immediately by the encountering thread. It might be placed in a pool and executed at a later time by the encountering thread or by some other thread. Once the execution of the task is completed, the generating task can resume. An example of an undeferred task is a task with an if clause expression that evaluates to false. In this case, an undeferred task is generated and the encountering thread must suspend the current task region. Execution of the current task region cannot be resumed until the task with the if clause is completed.

Unlike an undeferred task, an included task is executed immediately by the encountering thread and is not placed in the pool to be executed at a later time. The task's execution is sequentially included in the generating task region. As with undeferred tasks, the generating task is suspended until the execution of the included task is completed, at which point the generating task can resume. An example of an included task is a task that is a descendant of a final task.

A merged task is a task whose data environment is the same as that of its generating task region. If a mergeable clause is present on a task directive, and the generated task is an undeferred task or an included task, then the implementation may choose to generate a merged task instead. If a merged task is generated, then the behavior is as though there was no task directive at all.

A final task is a task that forces all of its descendent tasks to become final and included tasks. When a final clause is present on a task directive and the final clause expression evaluates to true, the generated task will be a final task.