Intel® Moderncode for Parallel Architectures
Support for developing parallel programming applications on Intel® Architecture.

false sharing with thread checker?

umar
Beginner
332 Views
I have a large program that is working fine with OMP using Intel Fortran
compilers. When I run the code inside thread checker 3.1 it repors that
one of the OMP DO's gives me the following error:

|6 |Read -> |Erro|376|"shf3d_om|Memory write at xtdhf conflicts |xtdh|xtdh|
| |Write |r |320|p.f90":38 |with a prior memory read at xtdhf |f |f |
| |data-race | |0 |4

The section corresponding to the error message is:

!$OMP PARALLEL NUM_THREADS(2) DEFAULT(SHARED) PRIVATE(ido,tpsi)
!$OMP DO
do ido = 1, 2
call schmid (ido, lpsi, ncolx, ncoly, ncolz, npsi, npmin, spnorm(1,ido),&
psi(1,1,1,1,1,ido), tpsi, itimrev, wxyz)
end do
!$OMP END DO
!$OMP END PARALLEL

I am running on a QX6700 Quad. Other omp sections use all 4 processors but this
one I can only use 2. In soubroutine schmid only "spnorm" and "psi" are changed
and "tpsi" is a work array. As you can see these two arrays are explicitly indexed
with variable ido that is declared private.

All other arrguments are declared intent(in) in the subroutine. As
I said earlier the code works fine.

Any ideas?
0 Kudos
2 Replies
David_M_Intel3
Employee
332 Views

Umar,

Are you compiling this fortran code with the Intel Fortran Compiler and using -tcheck compiler option? When you do this Intel Thread Checker will run the code in thread count independent analysis mode (also known as projection mode). In this mode, Intel Thread Checker actually runs the application with one thread, but within each openmp* parallel region it projects whether the parallel region is safe for multiple threads. So even through you specified openmp parameters that no more than 2 threads will execute this parallel region, because Intel Thread Checker is running a thread count independent analysis model - it considers what would happen if "n" threads were active (where n could be more than 2).

This is probably what is happening and why you see the diagnostic report for this region and none of the other openmp* parallel regions. The thread count independent analysis model is very useful analysis technic we encourage people to try when prototyping new code or checking for thread safety. Please see the following article for more information on why this analysis model can be so useful: http://www3.intel.com/cd/ids/developer/asmo-na/eng/253244.htm?prn=y You have to read the full article though.

Hopes this helps.

drmackay

0 Kudos
umar
Beginner
332 Views
Yes..you nailed it. I am doing exactly what you describe and yes it is running on
a single processor with theck option. I have read all of the pages above and now
I can rest with ease.
Thanks
Umar
0 Kudos
Reply