Sun Studio 12 Update 1: OpenMP API User's Guide

2.1 Compiler Options To Use

To enable explicit parallelization with OpenMP directives, compile your program with the cc, CC, or f95 option flag -xopenmp. (The f95 compiler accepts both -xopenmp and -openmp as synonyms.)

The -xopenmp flag accepts the following optional keyword sub-options.


-xopenmp=parallel

Enables recognition of OpenMP directives.  

The minimum optimization level for -xopenmp=parallel is -xO3.

The compiler changes the optimization from a lower level to -xO3 if necessary, and issues a warning.


-xopenmp=noopt

Enables recognition of OpenMP directives.  

The compiler does not raise the optimization level if it is lower than -xO3.

If you explicitly set the optimization level lower than -xO3, as in -xO2 -openmp=noopt the compiler will issue an error.

If you do not specify an optimization level with -openmp=noopt, the OpenMP directives are recognized, the program is parallelized accordingly, but no optimization is done.


-xopenmp=stubs

This option is no longer supported.  

An OpenMP stubs library is provided for users’ convenience.  

To compile an OpenMP program that calls OpenMP library routines but ignores the OpenMP directives, compile the program without an -xopenmp option, and link the object files with the libompstubs.a library.

For example, % cc omp_ignore.c -lompstubs

Linking with both libompstubs.a and the OpenMP runtime library libmtsk.so is unsupported and may result in unexpected behavior.


-xopenmp=none

Disables recognition of OpenMP directives and does not change the optimization level. 

Additional Notes: