Sun Studio 12: Fortran User's Guide

D.4 Sun Parallelization Directives


Note –

Legacy Sun and Cray parallelization directives are now deprecated. Use of the OpenMP API for parallelization on Solaris SPARC and x86 platforms is preferred. See the OpenMP API User’s Guide for information on migrating legacy applications to OpenMP.


OpenMP parallelization is the preferred parallelization model with Fortran 95. Sun-style parallelization directives are described here for legacy applications, and are detailed in the chapter on parallelization in the Fortran Programming Guide.

Table D–3 Sun-Style Parallelization Directives Summary

Format

C$PAR directive [optional_qualifiers] : initial lineC$PAR& [more_qualifiers] : continuation line

Fixed format, the directive-indicator may be C (as shown), c, *, or !. Separate multiple qualifiers with commas. Characters beyond column 72 ignored unless -e compiler option specified.

TASKCOMMON Directive

C$PAR TASKCOMMON block_name

Declares variables in common block block_name as thread-private: private to a thread, but global within the thread. Declaring a common block TASKCOMMON requires that this directive appear after every common declaration of that block.

DOALL Directive

C$PAR DOALL [qualifiers]

Parallelize DO loop that follows. Qualifiers are: 

PRIVATE(list) declare names on list PRIVATE

SHARED(list) declare names on list SHARED

MAXCPUS(n) use no more than n threads

READONLY(list) listed variables not modified in loop

SAVELAST save last value of all private variables

STOREBACK(list) save last value of listed variables

REDUCTION(list) listed variables are reduction variables

SCHEDTYPE(type) use scheduling type: (default is STATIC)

STATIC

SELF(nchunk)

FACTORING[(m)]

GSS[(m)]

DOSERIAL Directive

C$PAR DOSERIAL

Disables parallelization of the loop that follows. 

DOSERIAL* Directive

C$PAR DOSERIAL*

Disables parallelization of the loop nest that follows.