In this step, you will analyze the results to determine if you want to implement the report recommendations.
The report applies to the following loop in the source code file scalar_dep.cpp:
for (i=0; i<n; i++) {
if (A[i] > 0) {b=A[i]; A[i] = 1 / A[i]; }
if (A[i] > 1) {A[i] += b;}
}
The report recommends the following:
You can add the -parallel option and then run another analysis to see the result.
In the sample code directory, compile the source code with the following command:
icpc -c -parallel -guide scalar_dep.cpp
Find the following in the compiler output.
scalar_dep.cpp(79) remark #30523: (PAR) Assign a value to the variable(s) "b" at the beginning of the body of the loop in line 79. This will allow the loop to be parallelized. [VERIFY] Make sure that, in the original program, the variable(s) "b" read in any iteration of the loop has been defined earlier in the same iteration. [ALTERNATIVE] Another way is to use "#pragma parallel private(b)" to parallelize the loop. [VERIFY] The same conditions described previously must hold. scalar_dep.cpp(79): remark #30525: (PAR) Insert a "#pragma loop count min(256)" statement right before the loop at line 79 to parallelize the loop. [VERIFY] Make sure that the loop has a minimum of 256 iterations.
In the next step, you will implement the recommendations.