Oracle® Solaris Studio 12.4: Fortran User's Guide

Exit Print View

Updated: March 2015
 
 

3.4.4 –autopar

Enable automatic loop parallelization.

Finds and parallelizes appropriate loops for running in parallel on multiple processors. Analyzes loops for inter–iteration data dependencies and loop restructuring. If the optimization level is not specified -O3 or higher, it will automatically be raised to -O3.

Also specify the -stackvar option when using any of the parallelization options, including -autopar. The -stackvar option may provide better performance when using -autopar because it may allow the optimizer to detect additional opportunities for parallelization. See the description of the -stackvar option for information on how to set the sizes for the main thread stack and for the slave thread stacks.

Avoid -autopar if the program already contains explicit calls to the libthread threads library. See note in -mt[={yes|no}].

The -autopar option is not appropriate on a single–processor system, and the compiled code will generally run slower.

Use the OMP_NUM_THREADS environment variable to specify the number of threads to use when running a program automatically parallelized by the -xautopar compiler option. If OMP_NUM_THREADS is not set, the default number of threads used is equal to the number of cores on the machine, capped at 32. Set OMP_NUM_THREADS to 1 to run with just one thread. For best performance, the number of threads used should not exceed the number of hardware threads (or virtual processors) available on the machine. On Oracle Solaris systems, this number can be determined by using the psrinfo(1M) command. On Linux systems, this number can be determined by inspecting the file /proc/cpuinfo. See the OpenMP API User's Guide for more information.

In addition to OMP_NUM_THREADS, other environment variables that apply to an OpenMP programs may be used with a program automatically parallelized by the -xautopar compiler option. See the Oracle Solaris Studio OpenMP API User's Guide for descriptions of the environment variables.

If you use -autopar and compile and link in one step, the multithreading library and the thread–safe Fortran runtime library will automatically be linked. If you use -autopar and compile and link in separate steps, then you must also link with -autopar to insure linking the appropriate libraries.

Use the -reduction option in conjunction with -autopar to recognize reduction operations in loops.

Use the -loopinfo option to show which loops were and were not parallelized.

For explicit, user-controlled parallelization, use OpenMP directives and the -xopenmp option.