2. Compiling and Running OpenMP Programs
3. Implementation-Defined Behaviors
6. Automatic Scoping of Variables
A. Placement of Clauses on Directives
B.1 Converting Legacy Fortran Directives
B.1.1 Converting Sun-Style Fortran Directives
B.1.1.1 Issues Between Sun-Style Fortran Directives and OpenMP
B.1.2 Converting Cray-Style Fortran Directives
B.1.2.1 Issues Between Cray-Style Fortran Directives and OpenMP Directives
B.2 Converting Legacy C Pragmas
Legacy Fortran programs use either Sun or Cray style parallelization directives. A description of these directives can be found in the chapter Parallelization in the Fortran Programming Guide.
The following tables give OpenMP near equivalents to Sun parallelization directives and their subclauses. These are only suggestions.
Table B-1 Converting Sun Parallelization Directives to OpenMP
|
The DOALL directive can take the following optional qualifier clauses.
Table B-2 DOALL Qualifier Clauses and OpenMP Equivalent Clauses
|
The SCHEDTYPE(spec) clause accepts the following scheduling specifications.
Table B-3 SCHEDTYPE Scheduling and OpenMP schedule Equivalents
|
Scoping of private variables must be declared explicitly with OpenMP. With Sun directives, the compiler uses its own default scoping rules for variables not explicitly scoped in a PRIVATE or SHARED clause: all scalars are treated as PRIVATE, and all array references are SHARED. With OpenMP, the default data scope is SHARED unless a DEFAULT(PRIVATE) clause appears on the PARALLEL DO directive. A DEFAULT(NONE) clause causes the compiler to flag variables not scoped explicitly. However, see 4.4 Some Tips on Using Nested Parallelism for information on autoscoping in Fortran.
Since there is no DOSERIAL directive, mixing automatic and explicit OpenMP parallelization may have different effects: some loops may be automatically parallelized that would not have been with Sun directives.
OpenMP provides a richer parallelism model by providing parallel regions and parallel sections. It could be possible to get better performance by redesigning the parallelism strategies of a program that uses Sun directives to take advantage of these features of OpenMP.
Cray-style Fortran parallelization directives are identical to Sun-style except that the sentinel that identifies these directives is !MIC$. Also, the set of qualifier clauses on the !MIC$ DOALL is different.
Table B-4 OpenMP Equivalents for Cray-Style DOALL Qualifier Clauses
|
The differences are the same as for Sun-style directives, except that there is no equivalent for the Cray AUTOSCOPE.