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
Sun Directive |
Equivalent OpenMP Directive |
---|---|
C$PAR DOALL [qualifiers] |
!$omp parallel do [qualifiers] |
C$PAR DOSERIAL |
No exact equivalent. You can use: !$omp master loop !$omp end master |
C$PAR DOSERIAL* |
No exact equivalent. You can use: !$omp master loopnest !$omp end master |
C$PAR TASKCOMMON block[,...] |
!$omp threadprivate (/block/[,...]) |
The DOALL directive can take the following optional qualifier clauses.
Table B–2 DOALL Qualifier Clauses and OpenMP Equivalent Clauses
Sun DOALL Clause |
OpenMP PARALLEL DO Equivalent Clauses |
---|---|
PRIVATE(v1,v2,...) |
private(v1,v2,...) |
SHARED(v1,v2,...) |
shared(v1,v2,...) |
MAXCPUS(n) |
num_threads(n). No exact equivalent. |
READONLY(v1,v2,...) |
No exact equivalent. You can achieve the same effect by using firstprivate(v1,v2,...). |
STOREBACK(v1,v2,...) |
lastprivate(v1,v2,...). |
SAVELAST |
No exact equivalent. You can achieve the same effect by using lastprivate(v1,v2,...). |
REDUCTION(v1,v2,...) |
reduction(operator:v1,v2,...) Must supply the reduction operator as well as the list of variables. |
SCHEDTYPE(spec) |
schedule(spec) (See Table B–3) |
The SCHEDTYPE(spec) clause accepts the following scheduling specifications.
Table B–3 SCHEDTYPE Scheduling and OpenMP schedule Equivalents
SCHEDTYPE(spec) |
OpenMP schedule( spec) Clause Equivalent |
---|---|
SCHEDTYPE(STATIC) |
schedule(static) |
SCHEDTYPE(SELF(chunksize)) |
schedule(dynamic,chunksize) Default chunksize is 1. |
SCHEDTYPE(FACTORING(m)) |
No exact equivalent. |
SCHEDTYPE(GSS(m)) |
schedule(guided, m) Default m is 1. |
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.