OpenMP* Directives 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 2.5 specification, which is available from the OpenMP web site (http://www.openmp.org/).

OpenMP Pragmas

Pragma

Description

parallel

Defines a parallel region.

task

Indicates that the associated structured block should be executed in parallel as part of the enclosing parallel construct.

sections

Identifies a non-iterative worksharing construct that specifies a set of structured blocks that are to be divided among threads in a team.

section

Indicates that the associated structured block should be executed in parallel as part of the enclosing sections construct.

single

Identifies a construct that specifies that the associated structured block is executed by only one thread in the team.

parallel for

A shortcut for a parallel region that contains a single for directive.

Note iconNote

The parallel or for OpenMP directive must be immediately followed by a for statement. If you place other statement or an OpenMP directive between the parallel or for directive and the for statement, the Intel C++ Compiler issues a syntax error.

for

Identifies an iterative work-sharing construct that specifies a region in which the iterations of the associated loop should be executed in parallel. Each iteration is executed by one of the threads in the team.

parallel sections

Provides a shortcut form for specifying a parallel region containing a single sections construct.

master

Identifies a construct that specifies a structured block that is executed by only the master thread of the team.

critical[name]

Identifies a construct that restricts execution of the associated structured block to a single thread at a time. Each thread waits at the beginning of the critical construct until no other thread is executing a critical construct with the same name argument.

taskwait

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

barrier

Synchronizes all the threads in a team. Each thread waits until all of the other threads in that team have reached this point.

atomic

Ensures that a specific memory location is updated atomically, rather than exposing it to the possibility of multiple, simultaneously writing threads.

flush [(list)]

Specifies a cross-thread sequence point at which the implementation is required to ensure that all the threads in a team have a consistent view of certain objects in memory. The optional list argument consists of a comma-separated list of variables to be flushed.

ordered

The structured block following this directive is executed in the order in which iterations would be executed in a sequential loop.

threadprivate (list)

Makes the named file-scoped, namespace-scoped, or static block-scoped variables specified private to a thread.

OpenMP Clauses

Clause

Description

private

Declares variables to be private to each thread in a team. Private copies of the variable are initialized from the original object when entering the region.

firstprivate

Provides a superset of the functionality provided by the private clause.

lastprivate

Provides a superset of the functionality provided by the private clause. 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, when exiting the region.

shared

Shares variables among all the threads in a team.

default

Enables you to affect the data-scope attributes of variables.

reduction

Performs a reduction on scalar variables.

ordered

The structured block following an ordered directive is executed in the order in which iterations would be executed in a sequential loop.

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 scalar logical.

schedule

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

collapse(n)

Specifies how many loops are associated with the OpenMP loop construct for collapsing.

copyin

Provides a mechanism to copy the data values of the master thread to the variables used by the threadprivate copies at the beginning of the parallel region.

copyprivate

Provides a mechanism to use a private variable 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.

nowait

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

untied

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