[Beowulf] Quick question... on Fortran

Robert G. Brown rgb at phy.duke.edu
Thu May 10 14:01:17 PDT 2007

On Thu, 10 May 2007, Toon Moene wrote:

> Robert G. Brown wrote:
>> I am (as you may well know) extremely fortran averse.  However, a
>> researcher in our department has recently asked what the current limits
>> are on the size of an array in modern fortran(s) under linux.  I suppose
>> he'd like an answer for both 32 and 64 bit systems.  From what I have
>> been able to google out, it looks like the answer is 2^31 bytes in 32
>> bit systems and as big as the hardware permits less maybe a GB in 64 bit
>> systems.  Is this correct?  Any fortran experts out there?  I'd be happy
>> for answers for more than one compiler, of course -- I'd guess that e.g.
>> pathscale might have a greater capacity than e.g. gfortran than g77
>> legacy...
> I think the easiest way is to use the Fortran program I once wrote to test 
> the limits on g77 (attached) and keep enlarging NSIZE until the program 
> complains.

Yeah, I had that handy (thanks for the new copy though:-) but that
requires having a really big memory machine to run it on, though.  Which
begs the question -- which ULTIMATELY is:  Is there any point in Steffen
(Bass) buying a Really Big Memory Machine (RBMM) to run his old fortran
codes if there is some advantage to him in speed or otherwise from being
able to run larger computations?

The answer (from several people now) seems like it is "Yes, if you have
a compiler that supports the medium memory model" e.g. PGI or pathscale,
to name two that do.  And a 64 bit system, of course.  Medium memory
seems to be 32 bit (2GB limit) on code, which (as was recently
discussed on list at length) is enough to handle all but a set of
near-zero measure of all code ever written and 64 bits of data, which is
near enough to being infinite as to make no never mind.  Except that it
really isn't 64 bits -- IIRC it is either 40 or 48 at the moment -- but
what the heck 40 bits is still a terabyte and hence infinite.

I found this site:


which actually answers nearly all of the questions one might have.
64-bit gfortran supports -mcmodel=medium (and 32-bit returns an error if
you try it).  I suspect that all of the g90/g95 compliant compilers will
support at least medium memory models, and only Intel's apparently
supports large (which are the nearly-useless >2GB code programs etc).


> Kind regards,

Robert G. Brown	                       http://www.phy.duke.edu/~rgb/
Duke University Dept. of Physics, Box 90305
Durham, N.C. 27708-0305
Phone: 1-919-660-2567  Fax: 919-660-2525     email:rgb at phy.duke.edu

More information about the Beowulf mailing list