Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.

Stack overflow

bcartolos
初學者
1,942 檢視
Hi all,

I am coding a little fea solver. I use imsl to solve the stiffness matrix but I get a stack overflow error when I refine my solution (The program works well with a limited number of nodes, when I attempt to solve more exact solution the error appears)

The error I get is this:

Unhandled exception at 0x000000014023e1b7 in Problema1.exe: 0xC00000FD: Stack overflow.


The line that is causing the problem is located in a subroutine called from the main program

[fortran]Desp(DI) = Rigidez(DI, DI) .ix. F(DI)[/fortran]


Rigidez, Desp and F are variables declared in a module called Globals

[fortran]real(8), allocatable:: Rigidez(:,:)

real(8), allocatable:: Desp(:)

real(8), allocatable:: F(:)
[/fortran]


DI is a vector declared inside the subroutine and the values are set by another subroutine


[fortran]integer,allocatable:: DI(:)

call DIncognitas(DI, NDI)[/fortran]


Best Regards
0 積分
6 回應
Les_Neilson
傑出貢獻者 II
1,942 檢視
You can, if you wish, increase the stack size in the project settings :

Project->Properties->Linker->System-> Stack Reserve Size

You can also force temporary arrays to be allocated on the heap instead of the stack

Project->Properties->Fortran->Optimization->Heap Arrays 0 (zero)

Les
bcartolos
初學者
1,942 檢視
Thank Les for your reply

How large should the stack reserve be?

and also Changing the stack size will not affect performance?

Best Regards
Les_Neilson
傑出貢獻者 II
1,942 檢視
I just took a quick look at one of our (smaller) projects and it is set to 4,000,000
(another, mixed language project, sets the stack at 8Gb!)

I doubt you will notice any performance issues unless you profile the code.

Les
bcartolos
初學者
1,942 檢視
Thank you very much for your answer

Best Regards
bcartolos
初學者
1,942 檢視
It's me again

I try to keep refining my solution but another error appeared:

[bash]forrtl: severe (41): insufficient virtual memory[/bash]


Can that restriction be circumvented?


Best Regards
Steven_L_Intel1
1,942 檢視
The stack is limited to 1GB in Windows. You may be bumping into the 2GB addressable limit in 32-bit Windows. How much data are you trying to allocate? Are you building a 64-bit application? The exception address in the first post suggests you are.
回覆