- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The following is a simplified test case:
subroutine addv(M, N, a, b, c)
implicit none
integer :: M, N
REAL:: a(M,N), b(M,N), c(M,N)
integer :: i, j
!$OMP PARALLEL DO PRIVATE(j)
DO j=1,N
DO i=1,M
c(i,j) = a(i,j) + b(i,j)
end do
end do
return
end
I understand that loop index j which is the parallel loop will be automatically scoped to be private (of course there may be exceptions).
But what about loop index I?
In the current example, will the compiler treat it as private or shared?
What if there was a scalar temporary inside the parallel loop (that is used only inside the loop) that is not a loop index variable? Would that be treated by the compiler as a private or shared variable?
Is there a way to get a listing from the compiler that indicates whether a particular variable is treated as private or shared?
As far as I know there is no way to get such a listing. Does anyone think it should be possible to get such a listing?
Thanks!
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
OpenMP Fortran makes all the loop indices in the parallel region private by default. That can be a little confusing as it's different from the rule for C. All other variables are shared by default. It's possible when a local scalar is optimized to register variable that it won't matter that you forgot to specify private, but there's no point in taking the chance.
The usual way to diagnose problems with private declaration is to set default(none). Then the compiler will flag and quit on any variables not specified as private or shared.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page