Sun Studio 12: Fortran User's Guide

3.4.23 –explicitpar

(Obsolete, SPARC) Parallelize loops explicitly marked by Sun or Cray directives.


Note –

This option enables legacy Sun or Cray parallelization directives. These directives and parallelization model are deprecated and no longer supported. The OpenMP API is the preferred and supported parallelization model. See the -xopenmp option and the OpenMP API User’s Guide for details on converting Sun/Cray directives to OpenMP.


The compiler will generate parallel code even if there are data dependencies in the DO loop that would cause the loop to generate incorrect results when run in parallel. With explicit parallelization, it is the user’s responsibility to correctly analyze loops for data dependency problems before marking them with parallelization directives.

Parallelization is appropriate only on multiprocessor systems.

This option enables Sun and/or Cray explicit parallelization directives. DO loops immediately preceded by parallelization directives will have threaded code generated for them.

To enable OpenMP explicit parallelization directives, do not use -explicitpar. Use -xopenmp instead. See 3.4.155 –xopenmp[={parallel|noopt|none}])

-explicitpar should not be used to compile programs that already do their own multithreading with calls to the libthread library.

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 -explicitpar and compile and link in one step, then linking automatically includes the multithreading library and the thread–safe Fortran runtime library. If you use -explicitpar and compile and link in separate steps, then you must also link with -explicitpar.

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

Use the -mp option (3.4.59 –mp={%none|sun|cray}) to select the style of parallelization directives enabled. The default with -explicitpar is Sun directives. Use -explicitpar -mp=cray to enable Cray directives.

If the optimization level is not -O3 or higher, it is raised to -O3 automatically.

For details, see the “Parallelization” chapter in the Fortran Programming Guide.