Sun Studio 12 Update 1: C++ User's Guide

A.2.158.1 Values

The following table lists the values for i:

Table A–41 The -xopenmp Values




Enables recognition of OpenMP pragmas. The minimum optimization level under -xopenmp=parallel is -x03. The compiler changes the optimization from a lower level to -x03 if necessary and issues a warning.

This flag also defines the preprocessor token _OPENMP.


Enables recognition of OpenMP pragmas. The compiler does not raise the optimization level if it is lower than -O3.

If you explicitly set the optimization lower than -O3, as in CC -O2 -xopenmp=noopt, the compiler issues an error. If you do not specify an optimization level with -xopenmp=noopt, the OpenMP pragmas are recognized, the program is parallelized accordingly, but no optimization is done.

This flag also defines the preprocessor token _OPENMP.


This flag is the default and disables recognition of OpenMP pragmas, does not change the optimization level of your program, and does not predefine any preprocessor tokens. 


If you do not specify -xopenmp, the compiler sets the option to -xopenmp=none.

If you specify -xopenmp, but without an argument, the compiler sets the option to -xopenmp=parallel.


If you are debugging an OpenMP program with dbx, compile with -g and -xopenmp=noopt so you can breakpoint within parallel regions and display the contents of variables.


Do not specify -xopenmp, with either -xexplicitpar, or -xparallel.

The default for -xopenmp might change in future releases. You can avoid warning messages by explicitly specifying an appropriate optimization.

If you compile and link in separate steps, specify -xopenmp in both the compilation step and the link step. This is important if you are building a shared object. The compiler which was used to compile the executable must not be any older than the compiler that built the .so with -xopenmp. This is especially important when you compile libraries that contain OpenMP directives. See 3.3.3 Compile-Time and Link-Time Options for a complete list of options that must be specified at both compile time and line time.

Make sure that the latest patch of the OpenMP runtime library,, is installed on the system for best performance.

See also

For a complete summary of the OpenMP Fortran 95, C, and C++ application program interface (API) for building multiprocessing applications, see the Sun Studio OpenMP API User’s Guide.