Intel® C++ Compiler 16.0 User and Reference Guide
Assign a value to the variable(s) "%s" at the beginning of the body of the loop in line %d. This will allow the loop to be parallelized.
Check to see if you can unconditionally initialize the scalar variables at the beginning of the specified loop. If so, do the code change for such initialization (standard), or list the variables in the private clause of a parallel pragma (advanced). This allows the parallelizer to privatize those variables for each iteration and to parallelize the loop.
Consider the following:
#define N 100000 double A[N], B[N];
void foo(int cond1, int cond2){ int i, t=7; for (i=0; i<N; i++){ if (cond1) { t = i; } if (cond2) { A[i] = t; } } }
In this case, the compiler does not parallelize the loop because it cannot privatize the variable t without further information. If you know that cond2 always implies cond1, then you can assist the parallelizer by ensuring that any iteration that uses t, also writes to t before it is used in the same iteration. One of the ways to do this is to assign a value to t at the top of every iteration. Another way is to list the variables to be privatized in the private clause of a parallel pragma.
If you determine it is safe to do so, you can add the pragma as follows:
#define N 100000 double A[N], B[N]; void foo(int cond1, int cond2){ int i, t=7; #pragma private (t) for (i=0; i<N; i++){ if (cond1) { t = i; } if (cond2) { A[i] = t; } } }
Confirm that in the original program, any variables read in any iteration of the loop have been defined earlier in the same iteration or have been privatized by means of the private clause of a parallel pragma.