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
Use compiler commentary to check autoscoping results and to see whether any parallel regions were serialized because autoscoping failed.
The compiler produces an inline commentary when compiled with the -g debug option that can be viewed with the er_src command, as shown in the following example. The er_src command is provided as part of the Oracle Solaris Studio software. For more information, see the er_src(1) man page or the Oracle Solaris Studio Performance Analyzer manual.
A good place to start is to compile with the -xvpara option. Compiling with —xvpara will give you a general idea about whether autoscoping for a particular construct was successful.
Example 6-1 Autoscoping With -vpara
%cat source1.f INTEGER X(100), Y(100), I, T C$OMP PARALLEL DO DEFAULT(__AUTO) DO I=1, 100 T = Y(I) X(I) = T*T END DO C$OMP END PARALLEL DO END %f95 -xopenmp -xO3 -vpara -c -g source1.f "source1.f", line 2: Autoscoping for OpenMP construct succeeded. Check er_src for details
If autoscoping fails for a particular construct, a warning message is issued (with -xvpara) as shown in the following example.
Example 6-2 Autoscoping Failure With -vpara
%cat source2.f INTEGER X(100), Y(100), I, T C$OMP PARALLEL DO DEFAULT(__AUTO) DO I=1, 100 T = Y(I) CALL FOO(X) X(I) = T*T END DO C$OMP END PARALLEL DO END %f95 -xopenmp -xO3 -vpara -c -g source2.f "source2.f", line 2: Warning: Autoscoping for OpenMP construct failed. Check er-src for details. Parallel region will be executed by a single thread.
More detailed information appears in the compiler commentary displayed by er_src:
Example 6-3 Using er_src
% er_src source2.o Source file: source2.f Object file: source2.o Load Object: source2.o 1. INTEGER X(100), Y(100), I, T Source OpenMP region below has tag R1 Variables autoscoped as SHARED in R1: y Variables autoscoped as PRIVATE in R1: t, i Variables treated as shared because they cannot be autoscoped in R1: x R1 will be executed by a single thread because autoscoping for some variable s was not successful Private variables in R1: i, t Shared variables in R1: y, x 2. C$OMP PARALLEL DO DEFAULT(__AUTO) Source loop below has tag L1 L1 parallelized by explicit user directive L1 autoparallelized L1 parallel loop-body code placed in function _$d1A2.MAIN_ along with 0 inne r loops L1 could not be pipelined because it contains calls 3. DO I=1, 100 4. T = Y(I) 5. CALL FOO(X) 6. X(I) = T*T 7. END DO 8. C$OMP END PARALLEL DO 9. END 10.