Intel® oneAPI DPC++/C++ Compiler Developer Guide and Reference

ID 767253
Date 6/24/2024
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Supported OpenMP* Pragmas

This is a summary of the OpenMP* pragmas supported in the Intel® oneAPI DPC++/C++ Compiler. For detailed information about the OpenMP API, see the OpenMP Application Program Interface Version 5.1 specification, which is available from the OpenMP web site.

This topic has an alphabetical list of supported OpenMP pragmas and after that list, it shows categories for the supported OpenMP pragmas.

Alphabetical List of Supported OpenMP* Pragmas

The Intel oneAPI DPC++/C++ Compiler currently supports OpenMP* 5.0 Version TR4, and some OpenMP Version 5.1 pragmas. Supported pragmas are listed below. For more information about these pragmas, reference the OpenMP* Version 5.1 specification.

Intel-specific clauses, if any, are noted in the affected pragma description.

Pragma

Description

omp allocate

Specifies memory allocators to use for object allocation and deallocation.

omp atomic

Specifies a computation that must be executed atomically.

omp barrier

Specifies a point in the code where each thread must wait until all threads in the team arrive.

omp cancel

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

omp 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. This construct does not implement a synchronization between threads or tasks.

omp critical

Specifies a code block that is restricted to access by only one thread at a time.

omp declare reduction

Declares user-defined reduction (UDR) functions (reduction identifiers) that can be used as reduction operators in a reduction clause.

omp declare simd

Creates a version of a function that can process multiple arguments using Single Instruction Multiple Data (SIMD) instructions from a single invocation from a SIMD loop.

omp declare target

Specifies functions and variables that are created or mapped to a device.

omp declare variant

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

omp dispatch

Determines if a procedure variant is called for a given procedure.

omp distribute

Specifies that the iterations of one or more loops should be distributed among the initial threads of all thread teams in a league.

omp distribute parallel for

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

omp distribute parallel for 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.

omp 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.

omp flush

Identifies a point at which a thread's temporary view of memory becomes consistent with the memory.

omp for

Specifies a work-sharing loop. Iterations of the loop are executed in parallel by the threads in the team.

omp for simd

Specifies that the iterations of the loop will be distributed across threads in the team. Iterations executed by each thread can also be executed concurrently using SIMD instructions.

omp interop

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

omp loop

Specifies that the iterations of the associated loops can execute in any order or concurrently.

omp masked

Specifies a structured block that is executed by a subset of the threads of the current team.

omp master (deprecated; see omp masked)

Specifies a code block that must be executed only once by the primary thread of the team.

omp ordered

Specifies a block of code that the threads in a team must execute in the natural order of the loop iterations, or as a stand-alone directive, specifies cross-iteration dependences in a doacross loop-nest.

The following clauses are available as Intel-specific extensions to the OpenMP* specification:

  • ompx_monotonic

    Specifies a block of code in which the value of the new list item on each iteration of the associated SIMD loop(s) corresponds to the value of the original list item before entering the associated loop, plus the number of the iterations for which the conditional update happens prior to the current iteration, times linear-step.

    The value corresponding to the sequentially last iteration of the associated loop(s) is assigned to the original list item. Use with the simd clause.

  • ompx_overlap

    Specifies a block of code that has to be executed scalar for overlapping inx values and parallel for different inx values within SIMD loop. Use with the simd clause.

omp parallel

Specifies that a structured block should be run in parallel by a team of threads.

omp parallel for

Provides an abbreviated way to specify a parallel region containing only a FOR construct.

omp parallel for simd

Specifies a parallel construct that contains one for simd construct and no other statement.

omp parallel sections

Specifies a parallel construct that contains only a sections construct.

omp requires

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

omp scan

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

omp scope

Defines a structured block that is executed by all threads in a team but where additional OpenMP* operations can be specified.

omp sections

Defines a set of structured blocks that will be distributed among the threads in the team.

omp simd

Transforms the loop into a loop that will be executed concurrently using SIMD instructions.

The following clause is available as Intel-specific extensions tothe OpenMP* specification:

  • ompx_assert

    Specifies that the compiler generates an error message if the loop is not vectorized for any reason.

omp single

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

omp target

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

omp target data

Maps variables to a device data environment for the extent of the region.

omp target enter data

Specifies that variables are mapped to a device data environment.

omp target exit data

Specifies that variables are unmapped from a device data environment.

omp target parallel

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

omp target parallel for

Provides an abbreviated way to specify a target construct that contains an omp target parallel for construct and no other statement between them.

omp target parallel for simd

Specifies a target construct that contains an omp target parallel for simd construct and no other statement between them.

omp target parallel loop

Provides an abbreviated way to specify a target region that contains only a parallel loop construct.

omp target simd

Specifies a target construct that contains an omp simd construct and no other statement between them.

omp 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.

omp 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.

omp target teams distribute parallel for

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.

omp target teams distribute parallel for 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.

omp 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.

omp target teams loop

Provides an abbreviated way to specify a target region that contains only a teams loop construct.

omp target update

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

omp task

Specifies a code block whose execution may be deferred.

omp taskgroup

Causes the program to wait until the completion of all enclosed and descendant tasks.

omp taskloop

Specifies that the iterations of one or more associated for loops should be executed using OpenMP tasks.

omp 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.

omp taskwait

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

omp taskyield

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

omp teams

Creates a league of thread teams inside a target region to execute a structured block in the initial thread of each team.

omp teams distribute

Creates a league of thread teams and specifies that loop iterations will be distributed among the primary threads of all thread teams in the league.

omp teams distribute parallel for

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.

omp teams distribute parallel for simd

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

omp teams distribute simd

Creates a league of thread teams and specifies that the associated loop will be distributed across the primary threads of the teams and executed concurrently using SIMD instructions.

omp teams loop

Provides an abbreviated way to specify a teams construct that contains only a loop construct.

omp threadprivate

Specifies a list of globally-visible variables that will be allocated private to each thread.

Categories of Supported OpenMP* Pragmas

The following tables show the categories of the supported OpenMP pragmas.

Parallelism

OpenMP* Pragma

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

omp parallel

Tasking

OpenMP* Pragmas

Use these pragmas for deferring execution.

omp task

omp taskloop

Worksharing

OpenMP* Pragmas

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

omp for

omp loop

omp scope

omp sections

omp single

Synchronization

OpenMP* Pragmas

Use these pragmas to synchronize between threads.

omp atomic

omp barrier

omp critical

omp flush

omp masked

omp master (deprecated, see omp masked)

omp ordered

omp taskgroup

omp taskwait

omp taskyield

Data Environment

OpenMP* Pragma

Use this pragma to affect the data environment.

omp threadprivate

Offload Target Control

OpenMP* Pragmas

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

omp declare target

omp declare variant

omp dispatch

omp distribute

omp interop

omp requires

omp target

omp target data

omp target enter data

omp target exit data

omp target update

omp teams

Use these pragmas to control execution on vector hardware.

Vectorization

OpenMP* Pragmas

Use these pragmas to control execution on vector hardware.

omp scan

omp simd

omp declare simd

Cancellation

OpenMP* Pragmas

Use these pragmas to cancel an innermost enclosing region or to check if cancellation is in effect.

omp cancel

omp cancellation point

User-Defined Reduction

OpenMP* Pragma

Use this pragma to define reduction identifiers that can be used as reduction operators in a reduction clause.

omp declare reduction

Memory Space Allocation

OpenMP* Pragma

Use this declarative directive to allocate memory space.

omp allocate

Combined and Composites

OpenMP* Pragmas

Use these pragmas as shortcuts for multiple pragmas in sequence.

Combined constructs: These are shortcuts for specifying one construct immediately nested inside another construct. This kind of construct is semantically identical to that of explicitly specifying the first construct containing one instance of the second construct and no other statements.

Composite construct: These constructs are composed of two constructs but they do not have identical semantics to specifying one of the constructs immediately nested inside the other. This kind of 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.

omp distribute parallel for 1

omp distribute parallel for simd1

omp distribute simd 1

omp for simd1

omp parallel for

omp parallel for simd

omp parallel sections

omp target parallel

omp target parallel for

omp target parallel for simd

omp target parallel loop

omp target simd

omp target teams

omp target teams distribute

omp target teams distribute parallel for

omp target teams distribute parallel for simd

omp target teams distribute simd

omp target teams loop

omp taskloop simd 1

omp teams distribute

omp teams distribute parallel for

omp teams distribute parallel for simd

omp teams distribute simd

omp teams loop

1 This is a composite construct.