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

array allocation problem for big arrays

jaeger0
Beginner
940 Views

i have one simple Problem with one subroutine, which hangs up, if an internal static allocated array, is to big, means, n_nodes >32000, somewhere. It makes no problem, if i make the array xn, as an allocatable.

Is there some compiler options to set, for larger arrays, or what should i do. I do not want to make all arrays in my subroutines as allocatable, this is to comples.

subroutine profil(n_nodes)
implicit none
integer(4) n_nodes

real xn(3,n_nodes)
0 Kudos
3 Replies
jimdempseyatthecove
Honored Contributor III
940 Views

Jaeger,

In the example code given the array is allocated from the stack. It would appear that your stack size is too small. See options

/Fn
/STACK:reserve
/STACK:reserve,commit

Jim Dempsey

0 Kudos
jimdempseyatthecove
Honored Contributor III
940 Views

And you may need to specify

real, automatic ::xn(3,n_nodes)

Although in this case since n_nodes is a dummy argument automatic is implicit. (Or it may be allocated from the heap depending on option switches. Note, if the subroutine also contained

real :: tempArray(12345)

And if you wanted to assure that tempArray was on the stack then automatic _may_ be require (dependent on option switches).

Jim Dempsey


0 Kudos
Steven_L_Intel1
Employee
940 Views
I would suggest trying the option /heap-arrays.
0 Kudos
Reply