ThreadChecker reporting race conditions in OpenMP critical section

ThreadChecker reporting race conditions in OpenMP critical section

Hi,

I've just installed the Intel ThreadChecker and was trying out the Samples program Primes.exe that's bundled together with the tool.

However, I found some problems using the ThreadChecker with OpenMP
(#pragma omp critical) directive. Not sure there are other issues as well.

Anyway, the following code snippet from the samples folder works fine in both the actual executable and Thread Checker i.e. no race conditions detected during execution as well in Thread Checker

EnterCriticalSection( &Primes_CS );

Primes[ PrimeCount ] = number;
PrimeCount++;

LeaveCriticalSection( &Primes_CS );

But using the OpenMP directive version

#pragma omp critical
{
Primes[ PrimeCount ] = number;
PrimeCount++;
}

It runs fine but the ThreadChecker would report that there's a Read Write race condition on PrimeCount++;

FYI, I compiled this using Visual Studio 2005 Professional Edition on the machine with the specs:

OS : Windows XP Professional SP 2
Pentium 4 HT 3.60 GHz
1 GHz RAM

Pls feedback whether this is an issue with the tool or something else. This could be a major problem for me in the future because I may need to develop a complex multithreaded app using OpenMP (due to porting issues).

Thanks.

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.