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

Detection of a data race in OpenMP

Ami_M_
Beginner
266 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
Honored Contributor III
266 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.

0 Kudos
Reply