OpenMP* Directives and Clauses

OpenMP Directives

Directive Name Description
parallel Defines a parallel region.
for Identifies an iterative work-sharing construct that specifies a region in which the iterations of the associated loop should be executed in parallel.
sections Identifies a non-iterative work-sharing construct that specifies a set of constructs that are to be divided among threads in a team.
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. 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.
parallel sections Provides a shortcut form for specifying a parallel region containing a single sections directive.
master Identifies a construct that specifies a structured block that is executed by the master thread of the team.
critical[lock] Identifies a construct that restricts execution of the associated structured block to a single thread at a time.
barrier Synchronizes all the threads in a team.
atomic Ensures that a specific memory location is updated atomically.
flush 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.
ordered The structured block following an ordered directive is executed in the order in which iterations would be executed in a sequential loop.
threadprivate Makes the named file-scope or namespace-scope variables specified private to a thread but file-scope visible within the thread.

OpenMP Clauses

Clause Description
private Declares variables to be private to each thread in a team.
firstprivate Provides a superset of the functionality provided by the private clause.
lastprivate Provides a superset of the functionality provided by the private clause.
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 If the if(scalar_logical_expression) clause is present, the enclosed code block is executed in parallel only if the scalar_logical_expression evaluates to TRUE. Otherwise the code block is serialized.
schedule Specifies how iterations of the for loop are divided among the threads of the team.
copyin Provides a mechanism to assign the same name to threadprivate variables for each thread in the team executing the parallel region.