Intel® Fortran Compiler Classic and Intel® Fortran Compiler Developer Guide and Reference

ID 767251
Date 3/22/2024
Public
Document Table of Contents

OpenMP* Directives

This is a summary of the OpenMP* directives supported in the Intel® Fortran Compiler. For detailed information about the OpenMP API, see the OpenMP Application Program Interface Version 5.2 specification, or Technical Report 12: Preview 2 for OpenMP API Version 6.0, which are available from the OpenMP web site.

In the directive lists below, an OpenMP directive is qualified with the word Directive when the name of the directive is also used for one or more elements besides the directive. For example: FLUSH refers to a directive, a statement, and a subroutine.

PARALLEL Directive

Use this directive to form a team of threads and execute those threads in parallel.

Directive

Description

PARALLEL

Defines a parallel region.

TASKING Directives

Use these directives for deferring execution.

Directive

Description

TASK

Defines a task region.

TASKLOOP

Specifies that the iterations of one or more associated DO loops should be executed using OpenMP tasks. The iterations are distributed across tasks that are created by the construct and scheduled to be executed in parallel by the current team.

WORKSHARING Directives

Use these directives to share work among a team of threads.

Directive

Description

DO Directive

Identifies an iterative worksharing construct in which the iterations of the associated loop should be divided among threads in a team.

LOOP Directive (ifx)

Specifies that the iterations of the associated DO loops can execute in any order or concurrently. This feature is only available for ifx.

SECTIONS

Specifies that the enclosed SECTION directives define blocks of code to be divided among threads in a team. Each section is executed once by a thread in the team.

SCOPE (ifx)

Specifies a block of code to be executed by all threads of the team. This feature is only available for ifx.

SINGLE

Specifies that a block of code is to be executed by only one thread in the team.

WORKSHARE

Divides the work of executing a block of statements or constructs into separate units. It also distributes the work of executing the units to threads of the team so each unit is only executed once.

SYNCHRONIZATION Directives

Use these directives to synchronize between threads.

Directive

Description

ATOMIC

Ensures that a specific memory location is updated atomically; this prevents the possibility of multiple, simultaneous reading and writing of threads.

BARRIER

Synchronizes all the threads in a team. It causes each thread to wait until all of the other threads in the team have reached the barrier.

CRITICAL Directive

Restricts access to a block of code to only one thread at a time.

FLUSH Directive

Identifies synchronization points at which the threads in a team must provide a consistent view of memory.

MASKED

Specifies a structured block that is executed by a subset of the threads of the current team. This feature is only available for ifx.

MASTER (deprecated, see MASKED)

Specifies a block of code to be executed by the primary thread of the team.

ORDERED

Specifies a block of code that the threads in a team must execute in the natural order of the loop iterations.

TASKGROUP

Specifies a wait for the completion of all child tasks of the current task and all of their descendant tasks.

TASKWAIT

Specifies a wait on the completion of child tasks generated since the beginning of the current task.

TASKYIELD

Specifies that the current task can be suspended at this point in favor of execution of a different task.

Data Environment Directives

Use these directives to affect the data environment.

Directive

Description

DECLARE MAPPER (ifx)

Declares a user-defined data mapper for derived types and variables that can subsequently be used in MAP clauses. DECLARE MAPPER is a pure directive, so it can appear in a Fortran PURE procedure. This feature is only available for ifx.

DEPOBJ (ifx)

Initializes, updates, or uninitializes an OpenMP depend object. This feature is only available for ifx.

GROUPPRIVATE (ifx)

Specifies that a variable is replicated once per group of threads participating in a parallel region. This feature is only available for ifx.

PREFETCH DATA (ifx)

Suggests to the compiler to preload data into cache. Preloading data in cache minimizes the effects of memory latency. PREFETCH DATA is a pure directive, so it can appear in a Fortran PURE procedure. This is an Intel® language extension. This feature is only available for ifx.

THREADPRIVATE

Specifies named common blocks to be private (local) to each thread; they are global within the thread.

Offload Target Control Directives

Use these directives to control execution on one or more offload targets.

Directive

Description

DECLARE TARGET (ifx)

Specifies named routines and variables that are created or mapped to a device. DECLARE TARGET is a pure directive, so it can appear in a Fortran PURE procedure. This feature is only available for ifx.

DECLARE VARIANT (ifx)

Identifies a variant of a base procedure and specifies the context in which this variant is used. DECLARE VARIANT is a pure directive, so it can appear in a Fortran PURE procedure. This feature is only available for ifx.

DISPATCH (ifx)

Determines if a procedure variant is called for a given subroutine or function call. This feature is only available for ifx.

DISTRIBUTE

Specifies that loop iterations will be distributed among the primary threads of all thread teams in a league created by a teams construct.

INTEROP (ifx)

Identifies a foreign runtime context and identifies runtime characteristics of that context, enabling interoperability with it. This feature is only available for ifx.

REQUIRES (ifx)

Lists the features that an implementation must support so that the program compiles and runs correctly. This feature is only available for ifx.

TARGET Directive (ifx)

Creates a device data environment and executes the construct on that device. This feature is only available for ifx.

TARGET DATA (ifx)

Maps variables to a device data environment for the extent of the region. This feature is only available for ifx.

TARGET ENTER DATA (ifx)

Specifies that variables are mapped to a device data environment. This feature is only available for ifx.

TARGET EXIT DATA (ifx)

Specifies that variables are unmapped from a device data environment. This feature is only available for ifx.

TEAMS (ifx)

Creates a league of thread teams inside a target region to execute a structured block in the primary thread of each team. This feature is only available for ifx.

TARGET UPDATE (ifx)

Makes the list items in the device data environment consistent with their corresponding original list items. This feature is only available for ifx.

Vectorization Directives

Use these directives to control execution on vector hardware.

Directive

Description

SCAN

Specifies a scan computation that updates each list item in each iteration of an enclosing SIMD loop nest.

SIMD Directive (OpenMP*)

Transforms the loop into a loop that will be executed concurrently using SIMD instructions. SIMD is a pure directive, so it can appear in a Fortran PURE procedure.

DECLARE SIMD

Generates a SIMD procedure. DECLARE SIMD is a pure directive, so it can appear in a Fortran PURE procedure.

Loop Transformation Directives

Use these directives to transform or restructure loops.

Directive

Description

TILE (ifx)

Tiles (or blocks) one or more loops in a loop nest. TILE is a pure directive, so it can appear in a Fortran PURE procedure. This feature is only available for ifx.

UNROLL (ifx)

Partially or fully unrolls a DO loop. UNROLL is a pure directive, so it can appear in a Fortran PURE procedure. This feature is only available for ifx.

Cancellation Constructs

Directive

Description

CANCEL

Requests cancellation of the innermost enclosing region of the construct specified, and causes the encountering task to proceed to the end of the cancelled construct.

CANCELLATION POINT

Defines a point at which implicit or explicit tasks check to see if cancellation has been requested for the innermost enclosing region of the type specified.

Memory Space Allocation Directives

Use these declarative directives to allocate memory space.

Directive

Description

ALLOCATE (ifx)

Specifies memory allocators to use for object allocation and deallocation. This feature is only available for ifx.

ALLOCATORS (ifx)

Specifies memory allocators to be used to allocate variables in the associated Fortran ALLOCATE statement and to use in their deallocation. This feature is only available for ifx.

Reduction Directive

Use this directive to declare a user-defined reduction operation.

Directive

Description

DECLARE REDUCTION

Defines a user-defined reduction and associates a reduction identifier with the operation. DECLARE REDUCTION is a pure directive, so it can appear in a Fortran PURE procedure.

Utility and Informational Directives

Use these directives to get utility or informational data.

Utility directives provide information that aids code readability, and may facilitate interactions with the implementation. Utility directives are informational, unless an AT clause specifies EXECUTION, which makes the directive executable.

Informational directives provide implementation information about properties of the code, which may aid in optimization.

Directive

Description

ASSUMES (ifx)

States assumptions about the program unit in which it appears, and all code that can be reached by code in that program unit. Assumptions may aid compiler optimization. ASSUMES is a pure directive, so it can appear in a Fortran PURE procedure. This feature is only available for ifx.

ERROR (ifx)

Causes a compile or runtime message to be displayed; it may terminate compilation of the current program unit, or initiate program termination during runtime. This feature is only available for ifx.

The directive is pure only if COMPILATION is specified for the AT clause, or the AT clause does not appear. Pure directives can appear in Fortran PURE procedures.

NOTHING (ifx)

Provides documentary clarity in conditionally compiled code or conditional OpenMP* code. It has no effect on the semantics or execution of the program. NOTHING is a pure directive, so it can appear in a Fortran PURE procedure. This feature is only available for ifx.

Metadirectives

Use this directive to conditionally select another directive.

Directive

Description

METADIRECTIVE (ifx)

Specifies variant OpenMP directives, one of which may conditionally replace the metadirective based on the OpenMP context enclosing the metadirective. This feature is only available for ifx.

Combined and Composite Directives

Use these directives as shortcuts for multiple directives in sequence. A combined construct is a shortcut for specifying one construct immediately nested inside another construct. A combined construct is semantically identical to that of explicitly specifying the first construct containing one instance of the second construct and no other statements.

A composite construct is composed of two constructs but does not have identical semantics to specifying one of the constructs immediately nested inside the other. A composite construct either adds semantics not included in the constructs from which it is composed or the nesting of the one construct inside the other is not conforming.

Directive

Description

DISTRIBUTE PARALLEL DO1

Specifies a loop that can be executed in parallel by multiple threads that are members of multiple teams.

DISTRIBUTE PARALLEL DO SIMD1

Specifies a loop that will be executed in parallel by multiple threads that are members of multiple teams. It will be executed concurrently using SIMD instructions.

DISTRIBUTE SIMD1

Specifies a loop that will be distributed across the primary threads of the teams region. It will be executed concurrently using SIMD instructions

DO SIMD1

Specifies a loop that can be executed concurrently using SIMD instructions.

MASKED TASKLOOP

Provides an abbreviated way to specify a TASKLOOP construct inside a MASKED construct. This feature is only available for ifx.

MASKED TASKLOOP SIMD

Provides an abbreviated way to specify a TASKLOOP SIMD construct inside a MASKED construct. This feature is only available for ifx.

MASTER TASKLOOP

Deprecated; provides an abbreviated way to specify a TASKLOOP construct inside a MASTER construct. This feature is only available for ifx.

MASTER TASKLOOP SIMD

Deprecated; provides an abbreviated way to specify a TASKLOOP SIMD construct inside a MASTER construct. This feature is only available for ifx.

PARALLEL DO

Provides an abbreviated way to specify a parallel region containing a single DO directive.

PARALLEL DO SIMD

Specifies a loop that can be executed concurrently using SIMD instructions. It provides a shortcut for specifying a PARALLEL construct containing one SIMD loop construct and no other statement.

PARALLEL LOOP

Provides an abbreviated way to specify a parallel region containing a single LOOP construct. This feature is only available for ifx.

PARALLEL MASKED

Provides an abbreviated way to specify a MASKED construct inside a PARALLEL construct. This feature is only available for ifx.

PARALLEL MASKED TASKLOOP

Provides an abbreviated way to specify a MASKED TASKLOOP construct inside a PARALLEL construct. This feature is only available for ifx.

PARALLEL MASKED TASKLOOP SIMD

Provides an abbreviated way to specify a MASKED TASKLOOP SIMD construct inside a PARALLEL construct. This feature is only available for ifx.

PARALLEL MASTER

Deprecated; provides an abbreviated way to specify a MASTER construct inside a PARALLEL construct. This feature is only available for ifx.

PARALLEL MASTER TASKLOOP

Deprecated; provides an abbreviated way to specify a MASTER TASKLOOP construct inside a PARALLEL construct. This feature is only available for ifx.

PARALLEL MASTER TASKLOOP SIMD

Deprecated; provides an abbreviated way to specify a MASTER TASKLOOP SIMD construct inside a PARALLEL construct. This feature is only available for ifx.

PARALLEL SECTIONS

Provides an abbreviated way to specify a parallel region containing a single SECTIONS directive. The semantics are identical to explicitly specifying a PARALLEL directive immediately followed by a SECTIONS directive.

PARALLEL WORKSHARE

Provides an abbreviated way to specify a parallel region containing a single WORKSHARE directive.

TARGET PARALLEL

Creates a device data environment in a parallel region and executes the construct on that device.

TARGET PARALLEL DO

Provides an abbreviated way to specify a TARGET construct that contains a PARALLEL DO construct and no other statement between them.

TARGET PARALLEL DO SIMD

Specifies a TARGET construct that contains a PARALLEL DO SIMD construct and no other statement between them.

TARGET PARALLEL LOOP

Provides an abbreviated way to specify a TARGET region that contains a single PARALLEL LOOP construct and no other statements. This feature is only available for ifx.

TARGET SIMD

Specifies a TARGET construct that contains a SIMD construct and no other statement between them.

TARGET TEAMS

Creates a device data environment and executes the construct on the same device. It also creates a league of thread teams with the primary thread in each team executing the structured block

TARGET TEAMS DISTRIBUTE

Creates a device data environment and then executes the construct on that device. It also specifies that loop iterations will be distributed among the primary threads of all thread teams in a league created by a TEAMS construct.

TARGET TEAMS DISTRIBUTE PARALLEL DO

Creates a device data environment and then executes the construct on that device. It also specifies a loop that can be executed in parallel by multiple threads that are members of multiple teams created by a TEAMS construct.

TARGET TEAMS DISTRIBUTE PARALLEL DO SIMD

Creates a device data environment and then executes the construct on that device. It also specifies a loop that can be executed in parallel by multiple threads that are members of multiple teams created by a TEAMS construct. The loop will be distributed across the teams, which will be executed concurrently using SIMD instructions.

TARGET TEAMS DISTRIBUTE SIMD

Creates a device data environment and then executes the construct on that device. It also specifies that loop iterations will be distributed among the primary threads of all thread teams in a league created by a teams construct. It will be executed concurrently using SIMD instructions.

TARGET TEAMS LOOP

Provides an abbreviated way to specify a TARGET region that contains a single TEAMS LOOP construct with no other statements. This feature is only available for ifx.

TASKLOOP SIMD 1

Specifies a loop that can be executed concurrently using SIMD instructions and that those iterations will also be executed in parallel using OpenMP tasks.

TEAMS DISTRIBUTE

Creates a league of thread teams to execute the structured block in the primary thread of each team. It also specifies that loop iterations will be distributed among the primary threads of all thread teams in a league created by a TEAMS construct.

TEAMS DISTRIBUTE PARALLEL DO

Creates a league of thread teams and specifies that the associated loop can be executed in parallel by multiple threads that are members of multiple teams.

TEAMS DISTRIBUTE PARALLEL DO SIMD

Creates a league of thread teams to execute a structured block in the primary thread of each team. It also specifies a loop that can be executed in parallel by multiple threads that are members of multiple teams. The loop will be distributed across the primary threads of the teams region, which will be executed concurrently using SIMD instructions.

TEAMS DISTRIBUTE SIMD

Creates a league of thread teams to execute the structured block in the primary thread of each team. It also specifies a loop that will be distributed across the primary threads of the teams.

TEAMS LOOP

Provides an abbreviated way to specify a TEAMS region that contains a single LOOP construct with no other statements. This feature is only available for ifx.

Footnotes:

1 This directive specifies a composite construct.