Developer Guide and Reference

ID 767251
Date 10/31/2024
Public
Document Table of Contents

Clauses Used in Multiple OpenMP* Fortran Directives

This topic summarizes clauses that are used in more than one OpenMP* Fortran directive.

Other clauses (or keywords) are available for some OpenMP* Fortran directives. For more information, see each directive description.

Some of the OpenMP* Fortran directives have clauses (or options) you can specify to control the scope attributes of variables for the duration of the directive.

Data Scope Attribute Clauses

Name

Description

DEFAULT

Lets you specify a scope for all variables in the lexical extent of a parallel region.

FIRSTPRIVATE

Provides a superset of the functionality provided by the PRIVATE clause. It declares one or more variables to be private to each thread in a team, and initializes each of them with the value of the corresponding original variable.

IN_REDUCTION

Specifies that a task participates in a reduction.

LASTPRIVATE

Provides a superset of the functionality provided by the PRIVATE clause. It declares one or more variables to be private to an implicit task, and causes the corresponding original variable to be updated after the end of the region.

LINEAR

Specifies that all variables in a list are private to a SIMD task and that they have a linear relationship within the iteration space of a loop.

PRIVATE

Declares one or more variables to be private to each thread in a team.

SHARED

Specifies variables that will be shared by all the threads in a team.

The data copying clauses let you copy data values from private or threadprivate variables in one implicit task or thread to the corresponding variables in other implicit tasks or threads in the team.

Data Copying Clauses

Name

Description

COPYIN

Specifies that the data in the primary thread of the team is to be copied to the thread private copies of the common block at the beginning of the parallel region.

COPYPRIVATE

Uses a private variable to broadcast a value, or a pointer to a shared object, from one member of a team to the other members. The COPYPRIVATE clause can only appear in the END SINGLE directive.

The data motion clause MAP is used in OpenMP* Fortran TARGET directives. This data motion clause does not modify the values of any of the internal control variables (ICVs).

List items that appear in this data motion clause may have corresponding new list items created in the device data environment that is associated with the construct. If a new list item is created, a new list item of the same type, kind, and rank is allocated. The initial value of the new list item is undefined.

The original list items and new list items may share storage. This means that data races can occur. Data races are caused by unintended sharing of data; for example, when WRITEs to either item by one task or device are followed by a READ of the other item by another task or device without intervening synchronization.

Data Allocation and Data Mapping Clauses

Name

Description

ALLOCATE

Specifies the memory allocator to be used for one or more private variables or common blocks of a construct.

MAP

Maps a variable from the data environment of the current task to the data environment of the device associated with the construct.

The following are other clauses that can be used in more than one OpenMP* Fortran directive.

Miscellaneous Clauses

Name

Description

ALIGNED

Specifies that all variables in a list are aligned.

COLLAPSE

Specifies how many loops are associated with the loop construct.

DEPEND

Enforces additional constraints on the scheduling of a task by enabling dependences between sibling tasks in the task region.

DEVICE

Specifies the target device for certain TARGET directives.

DEVICE_TYPE

Specifies whether a version of a procedure or a copy of a data entity is to be available on a HOST device, a non-HOST device, or both.

FINAL

Specifies that the generated task will be a final task.

HINT

Specifies synchronization hints about a region to aid optimization.

IF

Specifies a conditional expression. If the expression evaluates to .FALSE., the construct is not executed.

MERGEABLE

Specifies that the implementation may generate a merged task.

NOWAIT

Specifies that threads may resume execution before the execution of the region completes.

ORDER

Indicates that the iterations of the loop may execute in any order or simultaneously. For more information, see DO Directive, DISTRIBUTE, LOOP, and SIMD.

PRIORITY

Specifies that the generated tasks have the indicated priority for execution.

REDUCTION

Performs a reduction operation on the specified variables.

SUBDEVICE

Specifies which tiles or compute slices (c-slices) of the offload device the offloaded code will run on.

THREAD_LIMIT

Limits the number of threads that can participate in a construct.

UNTIED

Specifies that the task is never tied to the thread that started its execution.