User and Reference Guide for the Intel® C++ Compiler 14.0

OpenMP* Pragmas and Clauses Summary

This is a summary of the OpenMP* pragmas and clauses supported in the Intel compiler. For detailed information about the OpenMP API, see the OpenMP Application Program Interface Version 4.0 specification, which is available from the OpenMP web site (http://www.openmp.org/).

PARALLEL Pragma

Use this pragmas 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.

WORKSHARING Pragmas

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

Pragma

Description

omp for

Specifies a parallel loop. Each iteration of the loop is executed by one of the threads in the team.

omp sections

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

omp single

Specifies a structured block that will be executed only once by a single thread in the team.

Combined PARALLEL and WORKSHARING Pragmas

Use these pragmas as a shortcut for a PARALLEL pragma followed by a WORKSHARING pragmas.

Pragma

Description

omp parallel for

Specifies a parallel construct containing one or more associated loops.

omp parallel sections

Specifies a parallel construct that contains a single sections construct.

TASKING Pragmas

Use these pragmas for deferring execution.

Pragma

Description

omp task

Specifies the beginning of a code block whose execution may be deferred.

omp taskyield

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

MASTER and 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 the view of the memory by the thread becomes consistent with the memory.

omp master

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

omp ordered

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

omp taskgroup

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

omp taskwait

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

Data Environment Pragma

Use this pragma to give threads global private data.

Pragma

Description

omp threadprivate

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

Coprocessor Control Pragmas

Use these pragmas to control execution on one or more coprocessors.

Pragma

Description

omp declare target

Creates a device-specific version of a function that can be called from a target region. This pragma only applies to Intel® MIC Architecture.

omp distribute

Specifies that the iterations of one of more loops should be shared among the master threads of all thread teams in a league.

omp target

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

omp target data

Creates a device data environment by making a mapping of variables from the host to the target device.

omp target update

Makes the items listed in the device data environment consistent between the device and host, in accordance with the motion clauses on the pragma.

omp teams

Creates a league of thread teams to execute the structured block in the master 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 Single Instruction Multiple Data (SIMD) instructions.

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

Specifies the beginning of a loop that can be executed concurrently using Single Instruction Multiple Data (SIMD) instructions. Each iteration of the loop is executed by one of the threads in the team.

omp parallel for simd

Specifies a parallel region that contains a loop to execute with Single Instruction Multiple Data (SIMD) instructions.

OpenMP Clauses

Use these clauses to specify options in the pragmas.

Clause

Description

collapse ( n )

Specifies how many nested loops of a for loop associated with the OpenMP* for construct should be collapsed into a single loop for running in parallel.

copyin ( list )

Provides a mechanism to copy the data values of the master thread to the threadprivate variables of the thread team within the construct.

copyprivate ( list )

Provides a mechanism to use a private variable in list to broadcast a value from the data environment of one implicit task to the data environments of the other implicit tasks belonging to the parallel region.

final ( expr )

The expr is evaluated, and if the value is true, then this task and all its descendant tasks are not deferred (not executed in parallel).

firstprivate ( list )

Provides a superset of the functionality provided by the private clause. Each private data object is initialized with the value of the original object.

if ( expression )

If the if(expression)clause is present, the enclosed code block is executed in parallel only if the expression evaluates to TRUE. Otherwise the code block is serialized.

The expression must be a scalar of type logical.

lastprivate ( list )

Provides a superset of the functionality provided by the private clause. When exiting the region, the original object is updated with the value of the private copy from the last sequential iteration of the associated loop, or the lexically last section construct.

mergeable

Indicates that the task defined by this task pragma need not create a private data environment for the task, but if the task execution is deferred, then the private data environment is created.

nowait

Indicates that an implementation may omit the barrier at the end of the worksharing region.

private ( list )

Declares variables to be private to each thread in a team. Private copies of the variable are not initialized before they are used.

reduction ( {operator | intrinsic}:list )

Performs a reduction on scalar variables.

schedule ( type[, chunk] )

Specifies how iterations of the for loop are divided among the threads of the team.

shared ( list )

Shares variables in list among all the threads in a team.

untied

Indicates that a resumed task does not have to be executed by same thread executing it before it was suspended.

See Also


Submit feedback on this help topic