Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7956 Discussions

Parallel lint (/Qdiag-enable:sc-parallel)

peter_silie
Beginner
368 Views
Hi, I compiled the factorial program from http://software.intel.com/en-us/articles/parallel-lint/#IDAUZY0E (see below) with ICC 12.0.1.096 from Parallel Studio 2011 using the options /Qopenmp and /Qdiag-enable:sc-parallel2. According to the manual, the compiler should emit a warning due to a dependency between the loop iterations in the example, but it doesn't. Any ideas why no warning is emitted?

Thanks, Peter


  1. #include
  2. #include"omp.h"
  3. intmain(void)
  4. {
  5. inti;
  6. intfactorial[10];
  7. factorial[0]=1;
  8. #pragmaompparallelfor
  9. for(i=1;i<10;i++){
  10. factorial=i*factorial[i-1];//warning#12246
  11. }
  12. return0;
  13. }

0 Kudos
2 Replies
Mark_S_Intel1
Employee
368 Views
I can reproduce the issue. I will investigate and get back to you.

Thanks,
--mark
0 Kudos
Mark_S_Intel1
Employee
368 Views
There is indeed data dependence in the loop. The reason no dependency is reported is that per OpenMP specification, OpenMP is an assertion-based parallelization model, that is the compiler complies with whatever the user asserts/intends by the use of the OMP pragma so the compiler does not do any dependency checking. That was one of the reasons behind the development of the Intel Inspector XE 2011 available in the Intel Parallel Studio XE. If you run your test case under Intel Parallel Inspector, the inspector will report:

"One or more threads in the application accessed the stack of another thread.
This may indicate one or more bugs in your application. Setting the Intel Inspector XE 2011 to detect data races on stack accesses and running another analysis may help you locate these and other bugs. "

The Intel C++ Compiler Vectorizers will report the data dependency as follows:

> icc -w -vec-report3 -c t.c
t.c(9): (col. 7) remark: loop was not vectorized: existence of vector dependence.
t.c(10): (col. 9) remark: vector dependence: assumed FLOW dependence between factorial line 10 and factorial line 10.

0 Kudos
Reply