|Skip Navigation Links|
|Exit Print View|
|Oracle Solaris Studio 12.3: OpenMP API User's Guide Oracle Solaris Studio 12.3 Information Library|
Declaring the data sharing attributes of variables referenced in an OpenMP construct is called scoping. A description of each of the data sharing attributes can be found in Data-Sharing Attribute Clauses section (Chapter 2) of the OpenMP specification.
In an OpenMP program, every variable referenced in an OpenMP construct is scoped. Generally, a variable referenced in a construct may be scoped in one of two ways. Either the programmer explicitly declares the scope of a variable with a data sharing attribute clause, or the implementation of the OpenMP API in the compiler automatically applies rules for predetermined or implicitly determined scopes according to the Data Environment: Data Scoping Rules section (Chapter 2) of the OpenMP specification.
Most users find scoping to be the hardest part of using the OpenMP paradigm. Explicitly scoping variables can be tedious and error-prone, especially with large and complicated programs. Moreover, the rules for implicitly determined and predetermined scopes of variables specified in the OpenMP 3.0 specification can yield some unexpected results. The task directive, which was introduced in OpenMP Specification 3.0, added to the complexity and difficulty of scoping.
The automatic scoping feature (called autoscoping)supported by the Oracle Solaris Studio compilers can be a very helpful tool, as it relieves the programmer from having to explicitly determine the scopes of variables. With autoscoping, the compiler determines the scopes of variables by using some smart rules in a very simple user model.
Earlier compiler releases limited autoscoping to variables in a parallel construct. Current Oracle Solaris Studio compilers extend the autoscoping feature to variables referenced in a task construct as well.