Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 12/16/2022
Public

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

Document Table of Contents

OpenMP* Pragmas

This is a summary of the OpenMP* pragmas supported in the Intel® C++ Compiler Classic. 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.

PARALLEL Pragma

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

Pragma

Description

omp parallel

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

TASKING Pragma

Use these pragmas for deferring execution.

Pragma

Description

omp task

Specifies a code block whose execution may be deferred.

omp taskloop

Specifies that the iterations of one or more associated for 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 Pragmas

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

Pragma

Description

omp for

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

omp sections

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

omp single

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

SYNCHRONIZATION Pragmas

Use these pragmas to synchronize between threads.

Pragma

Description

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 critical

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

omp flush

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

omp master

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

Data Environment Pragmas

Use these pragmas to affect the data environment.

Pragma

Description

omp scan

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

omp threadprivate

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

Offload Target Control Pragmas

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

Pragma

Description

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 target enter data

 

omp target exit data

 

omp teams

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

Vectorization Pragmas

Use these pragmas to control execution on vector hardware.

Pragma

Description

omp simd

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

The early_exit clause is an Intel-specific extension of the OpenMP* specification.

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

assert

Specifies that the compiler generates an error message if the loop is not vectorized by whatever reason.

early_exit

Allows vectorization of multiple exit loops. When this clause is specified:

  • Each operation before last lexical early exit of the loop may be executed as if early exit were not triggered within the SIMD chunk.

  • After the last lexical early exit of the loop, all operations are executed as if the last iteration of the loop was found.

  • Each list item specified in the linear clause is computed based on the last iteration number upon exiting the loop.

  • The last value for linear clauses and conditional lastprivates clauses are preserved with respect to scalar execution.

  • The last value for reductions clauses are computed as if the last iteration in the last SIMD chunk was executed up on exiting the loop.

  • The shared memory state may not be preserved with regard to scalar execution.

  • Exceptions are not allowed.

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.

Cancellation Constructs

Pragma

Description

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.

User-Defined Reduction Pragma

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

Pragma

Description

omp declare reduction

Declares User-Defined Reduction (UDR) functions (reduction identifiers) that can be used as reduction operators in a reduction clause.

Combined and Composite Pragmas

Use these pragmas as shortcuts for multiple pragmas 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.

Pragma

Description

omp distribute parallel for 1

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

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

omp distribute simd 1

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

omp for simd1

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 parallel for

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

Footnotes:

1 This directive specifies a composite construct.