Analyzers
Talk to fellow users of Intel Analyzer tools (Intel VTune™ Profiler, Intel Advisor)

Inspector finds data races in libm functions (asin, acos, atan)

mjw63
Beginner
524 Views

HI,

I have an openMP code that takes 8 instances of a class and uses them in parallel (the class itself is a well known particle physics simulation code). It runs slower on multiple cores than on a single core however.

When using Intel Inspector, I find data races in various functions of the class that seem to be related to basic maths functions in libm. See this screenshot for an example involving atan:

https://dl.dropboxusercontent.com/u/52286446/inspector_libm.png

Is this genuine or a false positive? In which case, do I need to find an alternate thread safe implementation of these functions? I have checked the class itself and there are no static or global variables, so the objects themselves should be private in the omp parallel block.

Cheers,

Martin

A simple version of  my code is this (the init function calls lots of other functions that heavily use the maths functions)

#pragma omp parallel
  {

   Pythia pythiaTmp(xmlPath.str(),0);

   pythiaTmp.init();

   } 

0 Kudos
6 Replies
Peter_W_Intel
Employee
524 Views

Did you use Inspector 2016 version to find these data race? There are some problems fixed in latest version.

I feel strange that functions (asin, acos, atan) might use local variables, they should have no global (shared) variable to cause data race when used by multiple threads.  I cannot see your screen-shot, why you didn't attach picture on this thread? It's better to send me small test case to run this on my side. Thank you.

0 Kudos
mjw63
Beginner
524 Views

Hi,

I had to shrink the image, but it now is embedded ok. I repeated my test in the 2016 version of Inspector and I still see the data races (the screenshot below is from the earlier version however).

Unfortunately, it is rather hard to make a small example. It requires building and running the entire Pythia program. This is not too difficult, but you might consider it beyond the call of duty.

I can send a tarball with instructions if you are willing?

Cheers,

Martin

Screenshot from 2015-11-04 17:09:03.png

0 Kudos
Peter_W_Intel
Employee
524 Views

If it was read/read race - that was acceptable, I saw it was read/write data race.

Please send me a private message with a tarbar file and instructions. Thank you.

0 Kudos
Peter_W_Intel
Employee
524 Views

Dear Martin,

Thanks for your tarbar file, after I extracted this then do:

1) ./configure

2) make

3) go to examples, and "make main24"

4) inspxe-cl -c ti3 -- ./main24

I found Read/Write data race (P3) in line #263 of ParticleData.cc, which called atan() in different thread. "double m0Save, mWidthSave, mMinSave, mMaxSave..." are defined include file. It seemed there was only read of these data, why was there read/write data race.

I will escalate this issue to developer and get back to your soon.

Regards, Peter

 

0 Kudos
mjw63
Beginner
524 Views

Hi

Thanks Peter. That is indeed what I see (and there are similar errors through the code, usually related to libm functions).

What puzzles me is that the variables (m0Save, etc) should be private member variables of the Pythia class, and hence there should be no overlap between the threads.

Cheers,

Martin

0 Kudos
Peter_W_Intel
Employee
524 Views

You are right these variables (m0Save, etc) are private in class ParticleDataEntry.

0 Kudos
Reply