big bug on ifc openmp compiler when using complex arrays

big bug on ifc openmp compiler when using complex arrays

I found a big bug on ifc openmp compiler when using
complex arrays. The simple following code runs serial but not with openmp. Placing comments on declaration of a variable and on a=(0.d0,1d0) and write(*,*) a(1,1) runs parallel correctly with openmp.
I runned with a dual Xeon machine 3.06Ghz, with Linux redhat 9.0. ifc -openmp -o test test.f
Used 2 threads with command setenv OMP_NUM_THREADS 2.

Arnaldo
****************************************************

program main
parameter(nx=512,np=512)

implicit real*8 (A-H,O-Z)
real*8 u(nx,np),f(nx,np)
complex*16 a(nx,np)

a=(0.d0,1.d0)

write(*,*) 'passed 1'
write(*,*) a(1,1)

!$omp parallel do private(xx,yy)
do j = 1,nx
do i = 1,np
xx = -1.0 + dx * dble(i-1) ! -1 yy = -1.0 + dy * dble(j-1) ! -1 u(i,j) = 0.0
f(i,j) = -alpha *(1.0-xx*xx)*(1.0-yy*yy)
& - 2.0*(1.0-xx*xx)-2.0*(1.0-yy*yy)
enddo
enddo
!$omp end parallel do

write(*,*) 'passed 2'

END

2 posts / novo 0
Último post
Para obter mais informações sobre otimizações de compiladores, consulte Aviso sobre otimizações.

Hi Arnaldo,
I reproduced the bug but I don't think it has anything to do with complex variables. The program is overflowing stack. Replace the complex*16 declaration with two real*8 arrays and the program still crashes, i.e.:

      real*8 u(nx,np), f(nx,np)
!      complex*16 a(nx,np)
      real*8 a(nx,np), b(nx,np)

For some reason, the compiler is putting the arrays on the stack instead of the heap. The program works if you declare your arrays ALLOCATABLE, i.e.:

      real*8, allocatable :: u(:,:), f(:,:)
      complex*16, allocatable :: a(:,:)
      allocate (u(nx,np), f(nx,np), a(nx,np))

Dynamically allocated arrays go on the heap. Please submit this bug to Intel Premier Support.

Thanks,
Henry

Deixar um comentário

Faça login para adicionar um comentário. Não é membro? Inscreva-se hoje mesmo