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

stack overflow

luca_lombardi
Beginner
1,182 Views

Hi, I have a problem with Intel Fortran Compiler.

My program works well when I use little dimension for bidimensional logical array variables; when I increase dimension, it gives me this error" Program Exception - Stack Overflow " when I pass these variables to subroutines. I need to increase dimension of this variabiles for my research. What can I do? I'm using a Intel Fortran Compiler Integration for Microsoft Visual Studio .NET 2003, Version 8.1.2790.2003, Copyright (C) 2002-2004 Intel Corporation.

Please help me.

Thank you

0 Kudos
6 Replies
Steven_L_Intel1
Employee
1,182 Views
If you were using a current compiler (10.1 is current) you could use the /heap-arrays option, but that is not in 8.1. Why are you using a compiler from 2004?

See this article for more information on stack overflows and what to do about them.
0 Kudos
luca_lombardi
Beginner
1,182 Views

Ok,

I read the article but I can't deallocate variables becouse Ialways use them in my program . I'm using acompiler from 2004 becouse I'm working in a company. Can you help me?

0 Kudos
Steven_L_Intel1
Employee
1,182 Views
The suggestion was not to deallocate variables, but rather to use ALLOCATABLE variables instead of automatic arrays, but I don't think that will help in your particular case.

Show us the call that is getting the error, the declarations of all variables used in the call and the header (subroutine/function and declaration of all arguments) of the routine being called.
0 Kudos
luca_lombardi
Beginner
1,182 Views

OK,

so in the main program Ideclare theselogical variables

logical

,allocatable :: popimping(:,:),popfilm(:,:),popimpingPC(:,:),popfilmPC(:,:), &

popimpingPM(:,:),popfilmPM(:,:),popimpingMPOOL(:,:),popfilmMPOOL(:,:), &

popimping_1(:,:),popfilm_1(:,:),popimpingPC_1(:,:), popimpingPM_1(:,:),popfilmPM_1(:,:), &

popfilmPC_1(:,:),popimpingMPOOL_1(:,:),popfilmMPOOL_1(:,:)

And then I allocate them:

allocate

(popimping(numbitmaximp,popiniz),popfilm(numbitmaxfilm,popiniz),popimpingPC(numbitmaximp,popiniz), &

popfilmPC(numbitmaxfilm,popiniz), &

popimpingPM(numbitmaximp,popiniz),popfilmPM(numbitmaxfilm,popiniz),popimpingMPOOL(numbitmaximp,popiniz),&

popfilmMPOOL(numbitmaxfilm,popiniz))

and

allocate

(popimping_1(numbitmaximp_1,popiniz),popfilm_1(numbitmaxfilm_1,popiniz),popimpingPC_1(numbitmaximp_1,popiniz), &

popfilmPC_1(numbitmaxfilm_1,popiniz), &

popimpingPM_1(numbitmaximp_1,popiniz),popfilmPM_1(numbitmaxfilm_1,popiniz), &

popimpingMPOOL_1(numbitmaximp_1,popiniz),popfilmMPOOL_1(numbitmaxfilm_1,popiniz))

where numbitmaximp=1450, numbitmaxfilm=2300, numbitmaximp_1=1550,numbitmaxfilm_1=2450; popiniz is the dimension that I would change, if it is 20 my program works, if it is 30 it does't work. I'd like it was 200 or more.

Then I call some of these variabiles in this subroutine:

call

crossover(0,nbit_imping,nbit_film,popiniz,pm,pc,nummax,numbitmaximp, &

popimping,ndimimp,popfilm,numbitmaxfilm, &

ndimfil,ndimfilm,ndimimping,dimimpingPC,popimpingPC,dimfilmPC,popfilmPC)

and I declare them in this subroutine

logical

:: popimping(numbitmaximp,popiniz),helpimpin(numbitmaximp,popiniz), &

popimpingPC(numbitmaximp,popiniz),helpfilm(numbitmaxfilm,popiniz), &

popfilmPC(numbitmaxfilm,popiniz),popfilm(numbitmaxfilm,popiniz)

This is the first subroutine that call these variabiles and then my program stops in this point when I pass variables.

What can I do?? Must I set something in visual studio to increase memory? Must I set something about logical variable?

thank you

popimpingPM(:,:),popfilmPM(:,:),popimpingMPOOL(:,:),popfilmMPOOL(:,:)

0 Kudos
Steven_L_Intel1
Employee
1,182 Views
In crossover, do you declare any arrays that are not arguments but which have bounds that are arguments? If so, you could change those to be ALLOCATABLE with dimension (:) or (:,:) and allocate them to the correct size.

The alternative is to change the stack size. Right click on the project, select Properties, Linker, System. Change "Stack Reserve Size" to a large value - start with 10000000 and see if that works. If not, double it. Repeat as needed.
0 Kudos
luca_lombardi
Beginner
1,182 Views
thak you a lot!!! Now it works well!!! great
0 Kudos
Reply