For ItaniumŪ-based applications, the -ivdep-parallel (Linux*) or /Qivdep-parallel (Windows*) option indicates there is no loop-carried memory dependency in the loop where an IVDEP pragma is specified. This technique is useful for some sparse matrix applications.
For example, the following loop requires the parallel option in addition to the directive ivdep to indicate there is no loop-carried dependencies:
Example |
|---|
|
#pragma ivdep for (i=1; i<n; i++) { e[ix[2][i]] = e[ix[2][i]]+1.0; e[ix[3][i]] = e[ix[3][i]]+2.0; } |
For example, the following loop requires the parallel option in addition to the IVDEP pragma to ensure there is no loop-carried dependency for the store into a().
Example |
|---|
|
#pragma ivdep for (j=0; j<n; j++) { a[b[j]] = a[b[j]] + 1; } |
The prefetch directive is supported on ItaniumŪ-based systems only.
The syntax is
#pragma prefetch var:hint:distance
where hint value can be 0 (T0), 1 (NT1), 2 (NT2), or 3 (NTA).
The following example demonstrates how to use the prefetch directive.
Example |
|---|
|
for (i=i0; i!=i1; i+=is) {
float sum = b[i]; int ip = srow[i]; int c = col[ip];
#pragma noprefetch col #pragma prefetch value:1:80 #pragma prefetch x:1:40
for(; ip<srow[i+1]; c=col[++ip]) sum -= value[ip] * x[c]; y[i] = sum; } |
See also Vectorization support.