Software Archive
Read-only legacy content
17060 Discussions

Thread Inspector and Fortran subroutines

gert_massa
Beginner
1,045 Views
Hi,

I've put some openmp directives on a do loop in fortran. Inside this do loop I call other subroutines. But when I run parallelel inspector to find data races it is giving a lot of data races on the local variables of the subroutines I call inside my do loop. I was suspecting that these were local to each thead because that are created in the thread local stack. But if this is correct than parallel inspecting is giving a lot of false positives and becomes useless because of the high number of these data race reports. Or is parallel inspector correct and this the normal behaviour for fortran code?
0 Kudos
8 Replies
gert_massa
Beginner
1,045 Views
Hi All,

I found the solution to my problem. In fortran local variable are static by default but by adding the /automatic compiler flag these local variables are allocated on the stack by default. This solves a lot of race conditions but I still have quite some false positive in my opinion. I illustrated this below

allocate variable !allocation site

!$omp parallal do
read shared variable !read
!$omp end parallel do

write shared variable !date race. but why????
0 Kudos
David_A_Intel1
Employee
1,045 Views
Hi:

In order to better address your question, can you tell us which version of the Intel Fortran compiler you are using and whether or not you are statcally linking the OpenMP runtime library?
0 Kudos
jimdempseyatthecove
Honored Contributor III
1,045 Views
Is the paarallel do inside a parallel region?
This can occure if you have nested parallel regions.


(nested enabled)

!$omp parallel sections
call foo
!$omp section
call fee
!$omp end parallel sections
-------------
subroutine foo
...
!$omp parallel do
read shared variable xx in module yy or in common
!$omp end parallel do
write shared variable xx
...
end subroutine foo

------------------------

subroutine fee
...
!$omp parallel do
read shared variable xx in module yy or in common
!$omp end parallel do
write shared variable xx
...
end subroutine fee


The two writes to same shared xx could occure by two threads

Jim Dempsey
0 Kudos
gert_massa
Beginner
1,045 Views
I'm using intel fortran compiler version 11.0.072 and using staticaly linked libraries for openmp.

I do not have nested parrallel in my code and it is also not enabled (by default it is disable if I'm correct). In fact I only have one parallel region in my code at the moment.
0 Kudos
gert_massa
Beginner
1,045 Views
Following the copiler option guidelines discribed in http://software.intel.com/en-us/articles/compiler-settings-for-threading-error-analysis-in-intel-parrallel-inspector/ I could remove all the false positive mentioned above. Only one data race reported now in on a local variable (CHARACTER*5) in a fortran function. The /automatic does not seem to work in this case.
0 Kudos
David_A_Intel1
Employee
1,045 Views
That's the problem! We currently don't support statically linking the OpenMP libraries and it will cause many false positives!
0 Kudos
gert_massa
Beginner
1,045 Views
Indeed, This was also guidelines I mentioned in my previous post. BUt I still have one strange data race reported on a local CHARACTER(*) variable.
0 Kudos
David_A_Intel1
Employee
1,045 Views
Please submit a sample app that demonstrates the problem. If you can create a sample project and zip it up and attach it to this thread, that would allow us to investigate the reported behavior.
0 Kudos
Reply