Sun Studio 12: Fortran User's Guide

3.4.82 –parallel

(Obsolete, SPARC) Parallelize with: -autopar, -explicitpar, -depend

Note –

This option includes -explicitpar which enables legacy Sun and Cray parallelization directives. These directives are now deprecated and no longer supported. The OpenMP API is the preferred and supported parallelization model with Sun Studio compilers. See the Sun Studio OpenMP API User’s Guide for details on migrating legacy Sun/Cray directives to OpenMP.

Parallelize loops chosen automatically by the compiler as well as explicitly specified by user supplied directives. Optimization level is automatically raised to -O3 if it is lower. See also 3.4.23 –explicitpar.

To improve performance, also specify the -stackvar option when using any of the parallelization options, including -autopar.

Sun-style parallelization directives are enabled by default. Use -mp=cray to select Cray style parallelization directives. (Note: For OpenMP parallelization use -xopenmp, not -parallel.)

Avoid -parallel if you do your own thread management. See 3.4.60 –mt.

Parallelization options like -parallel are intended to produce executable programs to be run on multiprocessor systems. On a single–processor system, parallelization generally degrades performance.

To run a parallelized program in a multithreaded environment, you must set the PARALLEL (or OMP_NUM_THREADS) environment variable prior to execution. This tells the runtime system the maximum number of threads the program can create. The default is 1. In general, set the PARALLEL or OMP_NUM_THREADS variable to the number of available virtual processors on the target platform. (See psrinfo(1))

If you use -parallel and compile and link in one step, then linking automatically includes the multithreading library and the thread–safe Fortran runtime library. If you use -parallel and compile and link in separate steps, then you must also link with -parallel.

See the Fortran Programming Guide chapter “Parallelization” for further information.