- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I have a question about OpenMP attribute of index variables in a Region but not in constant.
The specification of OpenMP3.0 said,
2.9.1.2 Data-sharing Attribute Rules for Variables Referenced in a
Region but not in a Construct
Fortran
implied-do indices, forall indices, and other local variables declared in called
routines in the region are private.
I believe index i in the comp subroutine as follows should be private, but it is shared.
program test
parameter (N=400)
common/tmp/i,j,k
real a(N,N),b(N,N),c(N,N)
!$omp parallel do
do j=1,N
do i=1,N
a(i,j)=real(i)
b(i,j)=real(i+j)
c(i,j)=0.0
enddo
enddo
!$omp parallel do
do j=1,N
do k=1,N
call comp(a,b,c,N)
enddo
enddo
write(*,*) c(N,N)
stop
end
subroutine comp(a,b,c,N)
common/tmp/i,j,k
real a(N,N),b(N,N),c(N,N)
integer omp_get_thread_num
do i=1,N
write(omp_get_thread_num()+200,*) i
c(i,j)=c(i,j)+a(i,k)*b(k,j)
enddo
return
end
After this program was launched with 32 threads, I checked the head of fort.2?? files.
==> fort.223 <==
1
222
223
224
225
The correct values are
1
2
3
4
5
compiler version : Intel 64 13.0 Build 20120731
processors : E7-8837@2.67GHz
OS : SLES 11SP1
Could you check out this issue, please?
Best rergards,
Akiko MATSUMOTO
Link Copied

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