Skip Navigation Links | |
Exit Print View | |
![]() |
Oracle Solaris Studio 12.3: OpenMP API User's Guide Oracle Solaris Studio 12.3 Information Library |
2. Compiling and Running OpenMP Programs
2.2 OpenMP Environment Variables
2.2.1 OpenMP Environment Variables Defaults
2.2.2 Oracle Solaris Studio Environment Variables
2.2.2.5 SUNW_MP_MAX_POOL_THREADS
2.2.2.6 SUNW_MP_MAX_NESTED_LEVELS
2.3.1 Virtual and Logical Processor IDs
2.3.2 Interpreting the Value Specified for SUNW_MP_PROCBIND
2.3.3 Interaction With OS Processor Sets
2.5 Checking and Analyzing OpenMP Programs
3. Implementation-Defined Behaviors
6. Automatic Scoping of Variables
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 keyword sub-options.
|
Additional Notes:
For best performance and functionality on Oracle Solaris platforms, make sure that the latest OpenMP runtime library, libmtsk.so, is installed on the running system.
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 201107L for C/C++ and 201107 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. See 2.4 Stacks and Stack Sizes.
When compiling and linking an OpenMP program in separate steps, include -xopenmp on each of the compile and the link steps.
Use the —xvpara option with —xopenmp, —xopenmp=parallel, or —xopenmp=noopt to display compiler warnings about potential OpenMP programming related problems and messages related to autoscoping (see Chapter 6, Automatic Scoping of Variables) and scope checking (see Chapter 7, Scope Checking). For example, warning messages will be emitted if the compiler detects the situations in the following list:
Loops are parallelized using OpenMP directives when there are data dependencies between different loop iterations
OpenMP data-sharing attributes-clauses are problematic. For example, declaring a variable shared whose accesses in an OpenMP parallel region may cause data race, or declaring a variable private whose value in a parallel region is used after the parallel region.