The following table summarizes commonly used OpenMP directoves. For more information and detailed descriptions of the directives, see the OpenMP specifications.
| Directive | Description |
|
parallel end parallel |
Defines a parallel region. |
| do end do |
Identifies an iterative worksharing construct in which the iterations of the associated loop should be executed in parallel. |
| sections end sections |
Identifies a non-iterative worksharing construct that specifies a set of structured blocks that are to be divided among the threads in a team. |
| section | Indicates that the associated structured block should be executed in parallel as part of the enclosing sections construct. |
| single end single |
Identifies a construct that specifies that the associated structured block is executed by only one thread in the team. |
| parallel do end parallel do |
A shortcut for a parallel region that contains a single do
directive.
Note: The parallel do or do OpenMP directive must be immediately followed by a do statement (do-stmt as defined by R818 of the ANSI Fortran standard). If you place another statement or an OpenMP directive between the parallel do or do directive and the do statement, the Compiler will issue a syntax error. |
| parallel sections end parallel sections |
Provides a shortcut form for specifying a parallel region containing a single sections construct. |
| master end master |
Identifies a construct that specifies a structured block that is executed by only the master thread of the team. |
| critical [lock] end critical [lock] |
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 lock argument. |
| 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 end ordered |
The structured block following an ordered directive is executed in the order in which iterations would be executed in a sequential loop. |
| threadprivate (list) |
Makes the named common blocks or variables private to a thread. The list argument consists of a comma-separated list of common blocks or variables. |