Developer Guide and Reference

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

OpenMP* Fortran Compiler Directives

Intel® Fortran supports OpenMP* Fortran compiler directives that comply with OpenMP Fortran Application Program Interface (API) specification 5.0, most of the OpenMP Version 5.1 and OpenMP Version 5.2 specifications, and some of the OpenMP 6.0 Version TR12 specification.

To use these directives, you must specify compiler option -qopenmp (Linux*) or /Qopenmp (Windows*). Offloading directives are enabled with option -fopenmp-targets (Linux) or /Qopenmp-targets (Windows).

OpenMP directives are specially formatted Fortran comment lines embedded in the source file that provide the compiler with hints and suggestions for parallelization, optimization, vectorization, and offloading code to accelerator hardware.

The compiler uses the information specified in the directives with compiler heuristic algorithms to generate more efficient code. At times, these heuristics may choose to ignore or override the information provided by a directive. If the directive is ignored by the compiler, no diagnostic message is issued.

Options that use OpenMP are available for both Intel® microprocessors and non-Intel microprocessors, but these options may perform additional optimizations on Intel® microprocessors than they perform on non-Intel microprocessors.

The list of major, user-visible OpenMP constructs and features that may perform differently on Intel® microprocessors vs. non-Intel microprocessors includes locks (internal and user visible), the SINGLE construct, barriers (explicit and implicit), parallel loop scheduling, reductions, memory allocation, thread affinity, and binding.

Unless denoted as a pure directive, OpenMP directives are not allowed in Fortran procedures declared to be PURE.

The following is an alphabetical list of supported OpenMP Fortran directives:

ALLOCATE

Specifies memory allocators to use for object allocation and deallocation.

ALLOCATORS

Specifies memory allocators to use for object allocation in Fortran ALLOCATE statements and for their deallocation.

ASSUMES

Provides hints to the optimizer about the current compilation unit and all the code it can reach through procedure calls. It is a pure directive.

ATOMIC

Specifies that a specific memory location is to be updated atomically.

BARRIER

Synchronizes all the threads in a team.

CANCEL

Requests cancellation of the innermost enclosing region of the type specified, and causes the encountering implicit or explicit task to proceed to the end of the canceled 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.

CRITICAL

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

DECLARE MAPPER

Declares a user-defined data mapper for derived types and local variables that can subsequently be used in MAP clauses. It is a pure directive.

DECLARE REDUCTION

Declares a user-defined reduction for one or more types. It is a pure directive.

DECLARE SIMD

Generates a SIMD procedure. It is a pure directive.

DECLARE TARGET

Causes the creation of a device-specific version of a named routine that can be called from a target region. It is a pure directive.

DECLARE VARIANT

Identifies a variant of a base procedure and specifies the context in which this variant is used. It is a pure directive.

DEPOBJ

Initializes, updates, or uninitializes an OpenMP depend object.

DISPATCH

Determines if a variant of a base procedure is to be called for a given subroutine or function call.

DISTRIBUTE

Specifies that loop iterations will be executed by thread teams in the context of their implicit tasks.

DISTRIBUTE PARALLEL DO

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

DISTRIBUTE PARALLEL DO SIMD

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 SIMD

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

DO

Specifies that the iterations of the immediately following DO loop must be executed in parallel.

DO SIMD

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

ERROR

Causes the compiler or runtime system to process an error condition. It is a pure directive if COMPILATION is specified for the AT clause, or the AT clause does not appear.

FLUSH

Specifies synchronization points where the threads in a team must have a consistent view of memory.

GROUPPRIVATE

Specifies that a variable is replicated once per group of threads participating in a parallel region.

INTEROP

Identifies a foreign runtime context and identifies runtime characteristics of that context, enabling interoperability with it.

LOOP

Specifies that the iterations of the associated loops can execute concurrently.

MASKED

Specifies a block of code to be executed by a subset of threads of the current team.

MASKED TASKLOOP

Provides an abbreviated way to specify a TASKLOOP construct inside a MASKED construct.

MASKED TASKLOOP SIMD

Provides an abbreviated way to specify a TASKLOOP SIMD construct inside a MASKED construct.

MASTER construct

Deprecated; see MASKED. Specifies a block of code to be executed by the master thread of the team.

MASTER TASKLOOP

Deprecated; provides an abbreviated way to specify a TASKLOOP construct inside a MASTER construct.

MASTER TASKLOOP SIMD

Deprecated; provides an abbreviated way to specify a TASKLOOP SIMD construct inside a MASTER construct.

METADIRECTIVE

Specifies variant OpenMP directives, one of which may conditionally replace the metadirective based on the OpenMP context enclosing the metadirective.

NOTHING

Provides documentary clarity in conditionally compiled code or conditional OpenMP* code. It has no effect on the semantics or execution of the program. It is a pure directive.

ORDERED

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

PARALLEL

Defines a parallel region.

PARALLEL DO

Defines a parallel region that contains 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

Specifies a shortcut for indicating that a loop or loop nest can execute concurrently across multiple threads.

PARALLEL MASKED

Provides an abbreviated way to specify a MASKED construct inside a PARALLEL construct.

PARALLEL MASKED TASKLOOP

Provides an abbreviated way to specify a MASKED TASKLOOP construct inside a PARALLEL construct.

PARALLEL MASKED TASKLOOP SIMD

Provides an abbreviated way to specify a MASKED TASKLOOP SIMD construct inside a PARALLEL construct.

PARALLEL MASTER

Deprecated; provides an abbreviated way to specify a MASTER construct inside a PARALLEL construct.

PARALLEL MASTER TASKLOOP

Deprecated; provides an abbreviated way to specify a MASTER TASKLOOP construct inside a PARALLEL construct.

PARALLEL MASTER TASKLOOP SIMD

Deprecated; provides an abbreviated way to specify a MASTER TASKLOOP SIMD construct inside a PARALLEL construct.

PARALLEL SECTIONS

Defines a parallel region that contains a single SECTIONS directive.

PARALLEL WORKSHARE

Defines a parallel region that contains a single WORKSHARE directive.

PREFETCH DATA

Suggests to the compiler to preload data into cache. Preloading data in cache minimizes the effects of memory latency. It is a pure directive.

REQUIRES

Lists the features that an implementation must support so that the program compiles and runs correctly.

SCAN

Specifies a scan computation that updates each list item in each iteration of the loop the directive appears in.

SCOPE

Specifies a block of code to be executed by all threads in a team.

SECTIONS

Specifies that the enclosed SECTION directives define blocks of code to be divided among threads in a team.

SIMD

Requires and controls SIMD vectorization of loops. It is a pure directive.

SINGLE

Specifies a block of code to be executed by only one thread in a team at a time.

TARGET

Creates a device data environment and executes the construct on the same device.

TARGET DATA

Creates a device data environment for the extent of the region.

TARGET ENTER DATA

Specifies that variables are mapped to a device data environment.

TARGET EXIT DATA

Specifies that variables are unmapped from a device data environment.

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 directive containing a PARALLEL DO directive and no other statements.

TARGET PARALLEL DO SIMD

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

TARGET PARALLEL LOOP

Specifies a shortcut for specifying a parallel loop inside a TARGET construct that contains no other statements than the parallel loop.

TARGET SIMD

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

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 executes the construct on the same device. It also specifies that loop iterations will be shared 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 executes the construct on the same device. It also specifies that loop iterations will be shared among the master threads of all thread teams in a league created by a teams construct. It will be executed concurrently using SIMD instructions.

TARGET TEAMS LOOP

Specifies a shortcut for specifying a TEAMS LOOP construct inside a TEAMS construct that contains no other statements.

TARGET UPDATE

Makes the list items in the device data environment consistent with their corresponding original list items.

TASK

Defines a task region.

TASKGROUP

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

TASKLOOP

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

TASKLOOP SIMD

Specifies a loop that can be executed concurrently using SIMD instructions and that those iterations will also be executed in parallel using OpenMP* 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.

TEAMS construct

Creates a group of thread teams to be used in a parallel region.

TEAMS DISTRIBUTE

Creates a league of thread teams to execute a structured block in the primary thread of each team. It also specifies that loop iterations will be shared 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 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.

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 region. The loop will be executed concurrently using SIMD instructions.

TEAMS LOOP

Specifies a shortcut for specifying a LOOP construct inside a TEAMS construct.

THREADPRIVATE

Makes named common blocks private to each thread, but global within the thread.

TILE

Tiles (or blocks) one or more loops in a loop nest. It is a pure directive.

UNROLL

Partially or fully unrolls a DO loop. It is a pure directive.

WORKSHARE

Divides the work of executing a block of statements or constructs into separate units.

The OpenMP Fortran directives can be grouped into categories. For more information about the categories for these directives, see Categories for OpenMP* Fortran Directives.

Product and Performance Information

Performance varies by use, configuration and other factors. Learn more at www.Intel.com/PerformanceIndex.

Notice revision #20201201