The SMP directives described in this section allow you to exert control over parallelization. For example, the PARALLEL DO directive specifies that the loop immediately following the directive should be run in parallel. All SMP directives are comment form directives. For more information on rules and syntax for comment form directives, see Comment and noncomment form directives .
XL Fortran supports a number of SMP directives, divided as follows. To ensure the greatest portability of code, OpenMP directives are recommended where possible. Use the OpenMP trigger_constant, $OMP for OpenMP directives, but do not use this trigger_constant with any other directive. OpenMP directives must not appear in PURE and ELEMENTAL procedures.
Parallel constructs form the foundation of OpenMP based parallel execution in XL Fortran. The PARALLEL/END PARALLEL directive pair forms a basic parallel construct. Each time an executing thread enters a parallel region, it creates a team of threads and becomes master of that team. This allows parallel execution to take place within that construct by the threads in that team. The following directives are necessary for a parallel region:
PARALLEL | END PARALLEL |
Work-sharing constructs divide the execution of code enclosed by the construct between threads in a team. For work-sharing to take place, the construct must be enclosed within the dynamic extent of a parallel region. For further information on work-sharing constructs, see the following directives:
DO | END DO |
SECTIONS | END SECTIONS |
WORKSHARE | END WORKSHARE |
A combined parallel work-sharing construct allows you to specify a parallel region that already contains a single work-sharing construct. These combined constructs are semantically identical to specifying a parallel construct enclosing a single work-sharing construct. For more information on implementing combined constructs, see the following directives:
PARALLEL DO | END PARALLEL DO |
PARALLEL SECTIONS | END PARALLEL SECTIONS |
PARALLEL WORKSHARE | END PARALLEL WORKSHARE |
The following directives allow you to synchronize the execution of a parallel region by multiple threads in a team:
ATOMIC | |
BARRIER | |
CRITICAL | END CRITICAL |
FLUSH | |
ORDERED | END ORDERED |
SINGLE | END SINGLE |
The following OpenMP directives provide additional SMP functionality:
MASTER | END MASTER |
THREADPRIVATE |
The following directives provide additional SMP functionality:
DO SERIAL | |
SCHEDULE | |
THREADLOCAL |