Oracle® Solaris Studio 12.4: OpenMP API ユーザーズガイド

印刷ビューの終了

更新: 2014 年 12 月
 
 

6.7 自動スコープ宣言結果の確認

自動スコープ宣言の詳細な結果はコンパイラ解説に表示されます。ソースが -g オプションを指定してコンパイルされている場合、コンパイラはインライン解説を生成します。解説は次の例に示すように er_src コマンドを使用すると表示できます。er_src コマンドは、Oracle Solaris Studio ソフトウェアの一部として提供されています。詳細は、er_src(1) のマニュアルページまたはOracle Solaris Studio 12.4: パフォーマンスアナライザ を参照してください。

自動スコープ宣言の結果を簡単に確認するには、-xvpara オプションを指定してコンパイルします。—xvpara を使用してコンパイルすると、特定の構文の自動スコープ宣言が成功したかどうかを把握することができます。

使用例 6-1  -xvpara を指定した場合の自動スコープ宣言の結果の確認
% 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 -xvpara -c -g source1.f
"source1.f", line 2: Autoscoping for OpenMP construct succeeded. 
Check er_src for details

-xvpara を指定した場合、特定の構文の自動スコープ宣言が失敗すると、次の例に示すような警告メッセージが発行されます。

使用例 6-2  -xvpara を指定した場合の自動スコープ宣言の失敗
% 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 -xvpara -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.

自動スコープ宣言のより詳細な情報は、次の例に示すように、er_src によって表示されるコンパイラ解説に表示されます。

使用例 6-3  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 inner 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.