loop count (n)ディレクティブはループカウントがnになるように指定します。このディレクティブの構文は次のとおりです。
#pragma loop count (n)
n は整数定数です。 loop countの値はソフトウェアのパイプライン処理、ベクトル化およびループ変換に使用される手法に影響を与えます。
loop count (n)ディレクティブの例 |
---|
#pragma loop count (10000)
for(i=0; i<m; i++) { //swp likely to occur in this loop a[i]=b[i]+1.2; } |
distribute pointディレクティブはループ分配の実行優先度をコンパイラに指示します。このディレクティブの構文は次のとおりです。
#pragma distribute point
ループ分配は、大きなループを小さなループに分配することがあります。これは、より多くのループにおいてソフトウェアのパイプライン処理を有効にします。ディレクティブをループの内側に置く場合、分配はディレクティブの後で行われ、あらゆるループキャリーの依存性が無視されます。ディレクティブをループの前に置く場合、コンパイラは分配する場所を決定し、データ依存性を監視します。1つのdistributeディレクティブのみが、ループの内側に置かれる際にサポートされます。
distribute pointディレクティブの例 |
---|
#pragma distribute point
for(i=1; i<m; i++) { b[i]=a[i]+1;
...
//Compiler will automatically //decide where to distribute. //Data dependency is observed.
c[i]=a[i]+b[i];
...
d[i]=c[i]+1; }
for(i=1; i<m; i++) { b[i]=a[i]+1;
...
#pragma distribute point
//Distribution will start here, //ignoring all loop-carried dependency.
sub(a,n); c[i]=a[i]+b[i];
...
d[i]=c[i]+1; } |