Software Archive
Read-only legacy content
17060 Discussions

Static Array Allocation

Intel_C_Intel
Employee
533 Views
I am converting a 10 year old Scientific Simulation Fortran Program that was developed most recently on MS PowerStation Fortran. It declares a number of large static arrays of real and complex numbers in the main program totaling to approximately 3GB. The program ran fine on all versions of windows and some flavors of UNIX (not sure of the compiler for UNIX). In all runs of the program, the static arrays were only partially used. The number of elements depended on input parameters for surface dimensions and such.

When I compile it with CVF v6.5, it compiles and links just fine (barring the linker exception for too large a program, which MS PSF gave as well). But, when I run it, the O/S complains that it doesn't have enough virtual memory to execute the program.

This behavior implies that the MS Powerstation did not allocate the full static array at the outset of the program. Rather, it must have allocated the memory based on access to the array. Pretty neat trick, if that is what it is doing.

Has anyone come across this behavior before? Do you have any recommendations or workarounds. The obvious modification is to convert the arrays to dynamically allocated to sizes based on the program input parameters. Any others?

Thanks,
Bob
0 Kudos
1 Reply
Jugoslav_Dujic
Valued Contributor II
533 Views
None other :-). PSF's ability to create a runnable program looks odd to me -- I wouldn't expect it to work. Namely, 32-bit OS is theoretically able to work with 2GB of memory; real limit is somewhat lower. But, ALLOCATABLE arrays are a definite recommendation for such kind of problem.
0 Kudos
Reply