Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

OpenMP problem

fah10
New Contributor I
532 Views
Hi, I'm trying to use the new OpenMP 3.0 features. Unfortunately, the loop collapsing doesn't work when the outer iteration count equals one.
The following test program was compiled with "Version 11.0 Build 20090318 Package ID: l_cprof_p_11.0.083" with "ifort -openmp test.F90"
The execution time on one and two processors is identical, no speed-up is achieavable.
Can anyone reproduce this bug? Is there a workaround?

program test
integer(kind=4), parameter :: n=100000000
integer(kind=4) :: i,j,k
real(kind=8), dimension(n) :: d
k = 1
!$omp parallel do collapse(2)
do i=1,k
do j=1,n
d(j) = sqrt(abs(sin(cos(tan(real(j*i,kind=8))))))
end do
end do
!$omp end parallel do
print*,d(1)
end program test
0 Kudos
1 Reply
jimdempseyatthecove
Honored Contributor III
532 Views

[cpp]program test
integer(kind=4), parameter :: n=100000000
integer(kind=4) :: i,j,k,ij
real(kind=8), dimension(n) :: d
k = 1
!$omp parallel do
do ij = 0, k*n-1
   i=(ij/n)+1
   j=mod(ij,n)+1
   d(j) = sqrt(abs(sin(cos(tan(real(j*i,kind=8))))))
end do
!$omp end parallel do
print*,d(1)
end program test
[/cpp]

Jim
0 Kudos
Reply