Possible ifort 11.1 openmp compiler bug

Possible ifort 11.1 openmp compiler bug

I am running ifort 11.1 on a Linux Red Hat 5.3.

I am aware of the problem when you try to allocate a private array with openmp. I tried to scoot around this problem by declaring my arrays firstprivate but nowI seem to be getting erroneous output when Irun the following code.

program bug
use omp_lib
implicit none

integer:: Nprofs,NparG,NparMax,ifor
real :: lat
real, dimension(:), allocatable :: xGes,xGesG
real, dimension(:), allocatable :: xBakG
real, dimension(:,:), allocatable :: umtx

nprofs=500
NparG=205
NParMax=5

allocate(xBakG(NParG),xGesG(NParG),xGes(NParMax),umtx(NParG,nParMax))

!$omp parallel num_threads(8) default(none) shared(NparG,nprofs) &
!$omp& firstprivate(ifor,lat,umtx,xBakG,xGes,xGesG )
!$omp DO schedule(auto)

ProfLoop: do ifor=1,nprofs
if (mod(ifor,100)==0) WRITE(*,'(a13,i5,a9)') '-----Profile#',ifor,'---------'

xGes=2.0
xGesG=0.0
umtx=3.0
xBakG=1.0

xGesG(1:NparG)=MATMUL(umtx(1:NparG,1:5),xGes(1:5))
lat=xGesG(3)

if(lat.lt.1)then
print*,lat,xGesG(3)
endif

end do ProfLoop

!$omp end DO
!$omp end parallel

end program bug

$ ifort -openmp -o bug.out bug.f90
$ bug.out

The output is different each time but this is just a sample of what is returned when the program is executed.

0.0000000E+00 0.0000000E+00
-----Profile# 100---------
-----Profile# 500---------
0.0000000E+00 30.00000
0.0000000E+00 30.00000
-----Profile# 200---------
0.0000000E+00 30.00000
0.0000000E+00 30.00000
-----Profile# 300---------
-----Profile# 400---------

1 contenuto / 0 nuovi
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione