ifort stack problem
Posted: Wed Apr 21, 2010 12:20 pm
Hi to all,
I was compiling and running ABINIT with different compiler and on
many platforms and everything worked fine.
Now I tried to compile ABINIT on my laptop with both IFORT AND GFORTRAN but
I found that when I increase the size of the system (in recursion method it corresponds to the size of the ngfft grid)
the IFORT compiled version gives a segmentation fault where GFORTRAN gives the good result
(but GFORTRAN is much more slow: I compiled with the "aggressive" compilation option for which IFORT is very fast).
As it was impossible for me to detect where was the error (gdb, compilation options) so I goggled a little bit
and I found that this error is explained by the behavior of these two compilers with respect to allocating automatic arrays.
IFORT allocates automatic arrays on the stack by default while GFORTRAN allocates them on the heap.
As in my subroutines I have a lots of automatic arrays I tried to increase my stack memory by "ulimit" and I compiled
IFORT with the extra-flags:
FCFLAGS_EXTRA="-heap-arrays 1024"
CFLAGS_EXTRA="-heap-arrays 1024"
Finally the IFORT compiled version works fine.
Now I ask me if I have to replace automatic arrays (more faster) with allocatable array.
Do you have a better idea to resolve this problem?
bye
Marco
I was compiling and running ABINIT with different compiler and on
many platforms and everything worked fine.
Now I tried to compile ABINIT on my laptop with both IFORT AND GFORTRAN but
I found that when I increase the size of the system (in recursion method it corresponds to the size of the ngfft grid)
the IFORT compiled version gives a segmentation fault where GFORTRAN gives the good result
(but GFORTRAN is much more slow: I compiled with the "aggressive" compilation option for which IFORT is very fast).
As it was impossible for me to detect where was the error (gdb, compilation options) so I goggled a little bit
and I found that this error is explained by the behavior of these two compilers with respect to allocating automatic arrays.
IFORT allocates automatic arrays on the stack by default while GFORTRAN allocates them on the heap.
As in my subroutines I have a lots of automatic arrays I tried to increase my stack memory by "ulimit" and I compiled
IFORT with the extra-flags:
FCFLAGS_EXTRA="-heap-arrays 1024"
CFLAGS_EXTRA="-heap-arrays 1024"
Finally the IFORT compiled version works fine.
Now I ask me if I have to replace automatic arrays (more faster) with allocatable array.
Do you have a better idea to resolve this problem?
bye
Marco