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.
|
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. |
|
|
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. |
|
|
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. |
|
|
Disables recognition of OpenMP directives and does not change the optimization level. |
Additional Notes:
If you do not specify —xopenmp on the command line, the compiler assumes —xopenmp=none (disabling recognition of OpenMP directives).
If you specify —xopenmp but without a keyword sub-option, the compiler assumes —xopenmp=parallel.
Specifying -xopenmp=parallel or noopt will define the _OPENMP preprocessor token to be YYYYMM (specifically 200805L for C/C++ and 200805 for Fortran 95).
When debugging OpenMP programs with dbx, compile with -xopenmp=noopt -g
The default optimization level for -xopenmp might change in future releases. Compilation warning messages can be avoided by specifying an appropriate optimization level explicitly.
With Fortran 95, -xopenmp , -xopenmp=parallel, -xopenmp=noopt will add -stackvar automatically.
When compiling and linking an OpenMP program in separate steps, include -xopenmp on each of the compile and the link steps.
Use the -xvpara C/C++/Fortran option to display compiler parallelization messages.
For best performance and functionality on Solaris platforms, make sure that the latest OpenMP runtime library, libmtsk.so, is installed on the running system.