JavaScript is required to for searching.
Skip Navigation Links
Exit Print View
Oracle Solaris Studio 12.2: OpenMP API User's Guide
search filter icon
search icon

Document Information

Preface

1.  Introducing the OpenMP API

2.  Compiling and Running OpenMP Programs

3.  Implementation-Defined Behaviors

4.  Nested Parallelism

5.  Tasking

6.  Automatic Scoping of Variables

7.  Scope Checking

7.1 Using the Scope Checking Feature

7.2 Restrictions

8.  Performance Considerations

A.  Placement of Clauses on Directives

B.  Converting to OpenMP

Index

Chapter 7

Scope Checking

Autoscoping can help the programmer decide how to scope variables. However, for some complicated programs, autoscoping may not be successful or the result of autoscoping may not be what the programmer expects. Incorrect scoping may cause many inconspicuous yet serious problems. For example, incorrectly scoping some variable as SHARED may cause a data race; incorrectly privatizing a variable may result in an undefined value for the variable outside the construct.

Solaris Studio C, C++, and Fortran compilers provide a compile-time scope-checking feature where the compiler determines whether variables in an OpenMP program are correctly scoped.

Based on the compiler's capabilities, scope checking can discover potential problems including data races, inappropriate privatization or reduction of variables, and other scoping issues. During scope checking, the data-sharing attributes specified by the programmer, the implicit data-sharing attributes determined by the compiler, and autoscoping results are all checked by the compiler.