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
Débutant
936 Visites

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 Compliments
3 Réponses
jimdempseyatthecove
Contributeur émérite III
936 Visites

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 Compliments
jimdempseyatthecove
Contributeur émérite III
936 Visites

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 Compliments
Steven_L_Intel1
Employé
936 Visites
I would suggest trying the option /heap-arrays.
0 Compliments
Répondre