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

Cannot allocate array - overflow on array size calculation.

beñat_m_
Principiante
3.853 Vistas

I am trying to run a simulation program on my laptop (Linux 3.8.0-25-generic x86_64, with Ubuntu 13.04). it compiles ok but when getting to allocation of some array sizes i get:

forrtl: severe (179): Cannot allocate array - overflow on array size calculation.

what I did is:

Some googling about this message (some links attached) led me to conclude that this is generated because my program is out of memory.

But, then I made my array very small, but still got the same problem.

Some found threads about my error:

http://software.intel.com/en-us/forums/topic/269131

But did not help.

This is the code:

program memoria
implicit none
integer :: n,num
complex, dimension(:,:,:,:,:,:,:,:,:,:,:,&
                   :,:,:,:,:,:,:,:,:,:,&
                   :), allocatable :: ddptrj
n=4
num=21
allocate(ddptrj(n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,n,num))
deallocate(ddptrj)
endprogram memoria

Does anybody see what is the problem?

Thank you

0 kudos
6 Respuestas
Ron_Green
Moderador
3.853 Vistas

So you're asking for:

4^21 x 21 elements, each 8 bytes, or 738,871,813,865,472 bytes of memory - 738 terabytes of RAM.

 I can compile this code with the latest Composer XE 2013 SP1 compiler - what version are you using.  But this will never never never run, not even close.  Even though you can have VIRTUALLY unlimited memory with 64 bit addressing, you have to have on your PC or server (PHYSICAL RAM + PAGE SPACE) in bytes sufficient to hold the array.  Do you have 738TB of Ram, or even 738TB of disk space allocated for paging space?  I doubt it.

One must size a problem to fit their server or PC capacity.  This is RAM + PAGE space, ideally you want about 80% of that MAXIMUM for your arrays or less. And even then, you'll be paging which will grind your code to a crawl.  Best case: take 80% of RAM and target that for all arrays.

ron

Steven_L_Intel1
Empleados
3.853 Vistas

My guess is that the IA-32 compiler is being used.

As also mentioned in the StackOverflow discussion where you also posted this, your use of 20 dimensions is non-standard and non-portable.

beñat_m_
Principiante
3.853 Vistas

Ok, thanks both Ron and Steve, I think I need to figure out something else in order to not allocate such huge array. Because it is obvious from everybodie's comments about this issue, that is not a common thing to do such thing, therefore, there must be another way to do what I want to do.

Thanks wise people!!

Beñat

Casey
Principiante
3.853 Vistas

What is your need for that many dimensions?  Running a typical "3D" simulation that varies in time generally only requires 5 dimensions: x, y, z, time, variable (Often represented as many 3d or 4d array variables and not a single 5d array).  Also keep in mind, as noted above, using more than 7 dimensions (15 in Fortran 2008) is nonconforming to the standard and your code is not guaranteed to compile with other fortran compilers.

beñat_m_
Principiante
3.853 Vistas

Sorry guys,

I need to post a new question and I can't see where, I do not see the option to post a question :(

mecej4
Colaborador Distinguido III
3.853 Vistas

Go back to the forum main page (https://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x) and look for the New Topic button on the left, below the Announcements box.

Responder