For complete information on the OpenMP* standard, visit the http://www.openmp.org
Web site. The Intel Extensions to OpenMP* topic describes the extensions
to the standard that have been added by Intel in the Intel
An OpenMP* directive has the form:
#pragma omp directive [directive clause . . . ]
The following tables list and describe OpenMP* directives and clauses.
Directive | 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 constuct that specifies a set of constucts that are to be divided among threads in a team. |
section | Indicates that the associated code block should be executed in parallel. |
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. |
parallel sections | Provides a shortcut form for specifying a parallel region containing a single sections directive. |
master | Identifies a constuct that specifies a structured block that is executed by the master thread of the team. |
critical | 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. |
threadprivate | Makes the named file-scope or namespace-scope variables specified private to a thread but file-scope visible within the thread. |
ordered | The structured block following an ordered directive |
Clauses | Description |
---|---|
private | Declares variables to be private to each thread in a team. |
firstprivate | A private copy of the private variable is created for each thread. In addition, each new private object is initialized with the value of the original object. |
lastprivate | A private copy of the private variable is created for each thread. In addition, the last iteration's value of each lastprivate is assigned to the original object. |
shared | Shares variables among all the threads in a team. |
default | Allows you to affect the data-scope attributes of variables. |
reduction | Performs a reduction on scalar variables. |
nowait | Specifies that threads that finish the loop early may continue executing code after the loop without waiting for the remaining threads to finish. |
if | If if(scalar_logical_expression) clause is present, the enclosed code block is executed in parallel only if the scalar_logical_expression is true. Otherwise, the code block is serialized. |
ordered | Must be present when ordered directives are contained in the dynamic extent of the for construct. |
schedule | Specifies how iterations of the 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. |
Variable | Description | Default |
---|---|---|
OMP_SCHEDULE | Sets the run-time schedule type and chunk size. | STATIC |
OMP_NUM_THREADS | Sets the number of threads to use during execution. | Number of processors |
OMP_DYNAMIC | Enables or disables the dynamic adjustment of the number of threads. | FALSE |
OMP_NESTED | Enables or disables nested parallelism. | FALSE |