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.


program main

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


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 < x < 1
yy = -1.0 + dy * dble(j-1) ! -1 < y < 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)
!$omp end parallel do

write(*,*) 'passed 2'


2 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

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.


Leave a Comment

Please sign in to add a comment. Not a member? Join today