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
3. Implementation-Defined Behaviors
6. Automatic Scoping of Variables
6.1 Autoscoping Data Scope Clause
6.2 Scoping Rules for a Parallel Construct
6.2.1 Scoping Rules for Scalar Variables
6.2.2 Scoping Rules for Arrays
6.3 Scoping Rules for a task Construct
6.3.1 Scoping Rules for Scalar Variables
6.3.2 Scoping Rules for Arrays
6.4 General Comments About Autoscoping
6.6 Checking the Results of Autoscoping
To enable autoscoping, the program must be compiled with -xopenmp at an optimization level of -xO3 or higher. Autoscoping is not enabled if the program is compiled with just -xopenmp=noopt.
Parallel and task autosoping in C and C++ can handle only basic data types: integer, floating point, and pointer.
Task autoscoping cannot handle arrays.
Task autoscoping in C and C++ cannot handle global variables.
Task autoscoping cannot handle untied tasks.
Task autoscoping cannot handle tasks that are lexically enclosed in some other tasks. For example:
#pragma omp task /* task1 */ { ... #pragma omp task /* task 2 */ { ... } ... }
In the example, the compiler does not attempt autoscoping for task2 because it is lexically nested in task1. The compiler will scope all variables referenced in task2 as SHARED and treat task2 as if an IF(.FALSE.) or if(0) clause is specified on the task.
Only OpenMP directives are recognized and used in the analysis. Calls to OpenMP runtime routines are not recognized. For example, if a program uses omp_set_lock() and omp_unset_lock() to implement a critical section, the compiler is not able to detect the existence of the critical section. Use CRITICAL and END CRITICAL directives if possible.
Only synchronizations specified by using OpenMP synchronization directives, such as BARRIER and MASTER, are recognized and used in data race analysis. User-implemented synchronizations such as busy-waiting are not recognized.