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

Stack Overflow with Open MP

rafadix08
Beginner
649 Views
Dear Steve and Intel team,

I have been having this problem for a while, and was never able to solve it.
I am consistently receiving a stack overflow message when I try to parallelize a portion of my code. I already tried to set many parameters (stack size, KMP_STACKSIZE, etc...)in order to deal with it, but never successfully.

The code runs well serially, but 2 threads is enough to cause the problem.

For this reason, I am attaching my code together with the necessary data and wonder whether you could have a look at it and shed some light on the issue.

Here are the details of my settings:

Intel Visual Fortran Compiler Professional Edition 11.1
Microsoft Visual Studio 2008
4GB of RAM
Windows XP

Stack Reserve Size set to 1000000000 (any smaller value makes the program crash in another parallelization portion line 202 of Parallel_Emax_MOD.f90)

Running under debug mode I receive the following error message:
Unhandled exception at 0x004bae37 in Estimation_IndInf.exe: 0xC00000FD: Stack overflow.

The error occurs at Line 793 inLoss_Function_IndInf_MOD.f90, where the parallelization is.

I really appreciate any help.

All the best,
Rafael
0 Kudos
1 Solution
Andrew_Smith
Valued Contributor I
649 Views
Not had time to study your code but try using /heap-arrays:n where n is a minimum number of kilobytes. It should allocate youre larger local arrays on the heap and require less stack.

Andy Smith

View solution in original post

0 Kudos
2 Replies
Andrew_Smith
Valued Contributor I
650 Views
Not had time to study your code but try using /heap-arrays:n where n is a minimum number of kilobytes. It should allocate youre larger local arrays on the heap and require less stack.

Andy Smith
0 Kudos
rafadix08
Beginner
649 Views
Quoting - Andrew Smith
Not had time to study your code but try using /heap-arrays:n where n is a minimum number of kilobytes. It should allocate youre larger local arrays on the heap and require less stack.

Andy Smith

Andrew,
Many thanks, that worked.
0 Kudos
Reply