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

Array sizes

jcl2
Beginner
331 Views
In an earlier version of a program, the majority of the data was held in a single blank common. Under Windows, it was possible to dimension this to 491000000, i.e. just under the 2GB limit.
The current version of the program has the same array in a module, allocated dynamically using an ALLOCATE. The largest size I can allocate is always much less than the old static allocation. Perversely, I can allocate a larger array on a 1GB machine (about 300000000)than on a 2GB machine (< 200000000).
A simple test program which just has:
real, allocatable :: a(:)
allocate(a(491000000),stat=ierr)
if(ierr.eq.0) a=0.0
works fine! Does anyone have a clue what is going on?
0 Kudos
3 Replies
jim_dempsey
Beginner
331 Views

When you place the memory block in COMMON it becomes part of the program space prior to initialization of the program. When you use allocate it occures after program initialization. Part of the program initialization is finish loading the core image into virtual memory then asses how much virtual memory is remaining and then divide that into stack space and heap space and while leaving some address space undecided. If you use allocate then the allocation occures after the decision to divide the memory. This is kind of like pre-tax income or after-tax income.

Part of the virtual addres space is dedicated to the operating sytem. On a larger physical memory system the sum of the parts of the operating system can be larger so MS decided to dedicate a larger portion of the address space to the operating system. There may be a knowledge base article on how to reduce the operating system portion of memory. Look under WinXP and 3GB. I think the option will be inserted into BOOT.INI.

Jim Dempsey

0 Kudos
jcl2
Beginner
331 Views

Thanks - thats very helpful. The /3GB switch (+ /largeaddressaware) doesn't actually help much.

I find it bizarre that to get the most out of a PC I have to go back to an 'old-fashioned' way of allocating memory, as the new way cannot get to as much.

Is there any way of manipulating stack/heap space (or anything else)to allow these large arrays to allocate at run time? Increasing the /heap: parameter does not seem to do anything.

0 Kudos
jim_dempsey
Beginner
331 Views

How much memory do you require? Just a little more, a whole bunch more?

What type of data are you storeing? Can the storageformat be altered to conserve memory?

Is there unused memory in your array? Can a sparse array be used?

Is there a performance issue? Can you use a virtual array?

Can you change platforms? Can you migrate to a 64bit O/S?
Without a better description of the circumstances it is hard for anyone on this forum to give good advice.
Can you supply a short description of your requirements?
Jim Dempsey
0 Kudos
Reply