Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
Announcements
Welcome to the Intel Community. If you get an answer you like, please mark it as an Accepted Solution to help others. Thank you!

Detection of a data race in OpenMP

Ami_M_
Beginner
72 Views

In the following code, there is a data race.

I would like to know which compiler option must be turn on in order to see that Intel C++ compiler detects this data race. And what will be the expected message from the compiler.

 # pragma omp parallel for {

for ( i=1; i< N; i++){

          a(i) = a(i) + a(i – 1)

 }

Thanks in advance

Ami

   

0 Kudos
1 Reply
TimP
Black Belt
72 Views

If you compile with -parallel -opt-report this should be flagged as a dependency preventing parallelization and vectorization.  OpenMP per se is weak on this point of diagnostics.

Intel Inspector tool should diagnose this at run time.  Ideally, with static analysis, it should also be diagnosed without running.  Advisor tool should flag this as ineligible for parallelism as it stands.

Reply