The combined parallel/worksharing constructs provide an abbreviated way to specify a parallel region that contains a single worksharing construct. The combined parallel/worksharing constructs are:
Use the PARALLEL DO directive to specify a parallel region that implicitly contains a single DO directive.
You can specify one or more of the clauses for the PARALLEL and the DO directives.
The following example shows how to parallelize a simple loop. The loop iteration variable is private by default, so it is not necessary to declare it explicitly. The END PARALLEL DO directive is optional:
!$OMP PARALLEL DO
B(I) = (A(I) + A(I-1)) / 2.0
!$OMP END PARALLEL DO
Use the PARALLEL SECTIONS directive to specify a parallel region that implicitly contains a single SECTIONS directive.
You can specify one or more of the clauses for the PARALLEL and the SECTIONS directives.
The last section ends at the END PARALLEL SECTIONS directive.
In the following example, subroutines X_AXIS, Y_AXIS, and Z_AXIS can be executed concurrently. The first SECTION directive is optional. Note that all SECTION directives must appear in the lexical extent of the PARALLEL SECTIONS/END PARALLEL SECTIONS construct:
!$OMP PARALLEL SECTIONS
!$OMP END PARALLEL SECTIONS