To enable explicit parallelization with OpenMP directives, compile your program with the cc, CC, or f95 option flag -xopenmp. This flag can take an optional keyword argument. (The f95 compiler accepts both -xopenmp and -openmp as synonyms.)
The -xopenmp flag accepts the following keyword sub-options.
|
Enables recognition of OpenMP pragmas. 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 pragmas. 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 pragmas 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 pragmas, 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 pragmas 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 pragmas).
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 200505L for C/C++ and 200505 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 option or the —vpara Fortran 95 option to display compiler parallelization messages.
For best performance and functionality, make sure that the latest OpenMP runtime library, libmtsk.so, is installed on the running system.