Re: Help: IFC stack overflow
- From: Joe Krahn <krahn-at-niehs.nih.gov@xxxxx>
- Date: Thu, 30 Mar 2006 13:55:32 -0500
Ben wrote:
Hi,
I have a module with many global arrays,
!------------------------------------------------------
module Global
integer, save :: dims(4)=(/0,0,0,0/)
real (kind = 8), save, allocatable :: A(:,:,:,:)
! save data read from a file
real (kind = 8), save, allocatable :: B(:,:,:,:) ! B to E
have the same size
real (kind = 8), save, allocatable :: C(:,:,:,:) ! as A
real (kind = 8), save, allocatable :: D(:,:,:,:)
real (kind = 8), save, allocatable :: E(:,:,:,:)
. . .
. . .
. . .
logical, save, allocatable :: L(:,:,:,:)
contains
!
! subroutines here
!
end module Global
!--------------------------------------------------------
When I read in the dimensional information to dims, these arrays can
be allocated.
The process is
* read in dimensions
* allocate A, populate A using file stream I/O
* allocate B, save intermediate results in B (e.g. sub1(B,A))
* allocate C, do something like sub2(C,B)
etc
Everything works fine when I compile the codes with g95.
However, when I tried to use Intel Fortran compiler 9, it only works
when the data size is relatively small, say dims= (/30,30,8,30/). For
large dimensions like dims=(/256,256,25,30/), it crashes when I call
sub3 to allocate D array. The error report is stack overflow:
forrtl: severe (170): Program Exception - stack overflow
( I have not found the error code 'severe (170)' in Intel docs)
The computer has plenty of memory (4GB). I also check the status
after each allocate statement.
I am wondering why the data size matters.
Is it related to the 'save' attribute?
Will it be helpful if I reduce the number of those global arrays?
Any suggestions and comments are welcome.
Thanks.
Ben
Some array operations use a lot of stack space when it is necessary to create a temporary array. Array allocations should not need much stack space, but it is not unusual for a default stack limit to be rather small. Assuming a POSIX environment, what do you get from the command "limit stack"? You can try a larger number, or just try "limit stack unlimited".
As for the SAVE attributes, they probably have no effect, but it is a good practice. It is possible (but unlikely) for values to become undefined if a module is not USEed from the main program.
Joe
.
- Follow-Ups:
- Re: Help: IFC stack overflow
- From: Ben
- Re: Help: IFC stack overflow
- References:
- Help: IFC stack overflow
- From: Ben
- Help: IFC stack overflow
- Prev by Date: Re: status of quadruple precision arithmetic in g95 and gfortran?
- Next by Date: Re: Help: IFC stack overflow
- Previous by thread: Re: Help: IFC stack overflow
- Next by thread: Re: Help: IFC stack overflow
- Index(es):
Relevant Pages
|