[Beowulf] Re:Fortran Array size question

Gus Correa gus at ldeo.columbia.edu
Tue Nov 3 12:38:36 PST 2009


Hi Prentice, list

Intel Fortran (at least the 10. and 11.something versions I have)
has different "memory models" for compilation.  The default is "small".
The PGI compiler has a similar feature, IIRR.

Have you tried -mcmodel=medium or large?
I never used large, but medium helped a few times on x86_64/i64em.

Of course your available RAM may be restriction,
as David pointed out.

An excerpt from "man ifort" is enclosed below.

I hope this helps,
Gus Correa
---------------------------------------------------------------------
Gustavo Correa
Lamont-Doherty Earth Observatory - Columbia University
Palisades, NY, 10964-8000 - USA
---------------------------------------------------------------------

 From "man ifort":


        -mcmodel= <mem_model> (i64em only; L*X only)
               Tells the compiler to use a specific memory  model  to 
generate
               code  and store data.  This option can affect code size 
and per-
               formance.

               You can specify one of the following values for <mem_model>:

               · small

                 Restricts code and data to the first 2GB of address 
space. All
                 accesses of code and data can be done with Instruction 
Pointer
                 (IP)-relative addressing.  This is the default.

               · medium

                 Restricts code to the first 2GB; it places no memory 
restric-
                 tion  on  data.  Accesses of code can be done with 
IP-relative
                 addressing, but accesses of data must be  done  with 
absolute
                 addressing.

               · large

                 Places  no memory restriction on code or data. All 
accesses of
                 code and data must be done with absolute addressing.

               If your program has COMMON blocks and local data  with  a 
  total
               size  smaller  than  2GB, -mcmodel=small is sufficient. 
COMMONs
               larger  than  2GB  require  -mcmodel=medium  or 
-mcmodel=large.
               Allocation  of  memory larger than 2GB can be done with 
any set-
               ting of -mcmodel.

               IP-relative addressing requires only 32 bits,  whereas 
absolute
               addressing requires 64-bits.  IP-relative addressing is 
somewhat
               faster. So, the small memory model has the least impact 
on  per-
               formance.

               Note:  When the medium or large memory models are 
specified, you
               must also specify option -shared-intel to ensure that 
the  cor-
               rect  dynamic versions of the Intel run-time libraries 
are used.

               When shared objects (.so files) are built, 
position-independent
               code  (PIC)  is  specified so that a single .so file can 
support
               all three memory models. The compiler driver adds  option 
  -fpic
               to implement PIC.

               However,  you must specify a memory model for code that 
is to be
               placed in a static library or code that will  be  linked 
  stati-
               cally.


David Mathog wrote:
> Prentice Bisbal <prentice at ias.edu> wrote:
> 
>> Question: What is the maximum number of elements you can have in a
>> double-precision array in Fortran? I have someone creating a
>> 4-dimensional double-precision array. When they increase the dimenions
>> of the array to ~200 million elements, they get this error:
>>
>> compilation aborted (code 1).
> 
> The two things that come immediately to mind are:
> 
> 1.  The compiler ran out of memory.  (In addition to the size of the
> memory in the machine, check ulimit.)
> 
> 2.  The compiler is trying to build the program with 32 bit pointers and
> it cannot address this array, or perhaps all memory accessed, with a
> pointer of that size.  If that is the issue using 64 bit pointers should
> solve the problem, but I can't tell you what compiler switches are
> needed to do this.
> 
> Regards,
> 
> David Mathog
> mathog at caltech.edu
> Manager, Sequence Analysis Facility, Biology Division, Caltech
> _______________________________________________
> Beowulf mailing list, Beowulf at beowulf.org sponsored by Penguin Computing
> To change your subscription (digest mode or unsubscribe) visit http://www.beowulf.org/mailman/listinfo/beowulf




More information about the Beowulf mailing list