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

Array size limitation

dfusuedu
Beginner
1,620 Views
I am using the intel Fortran compiler on a quad core Mac OS 10.4.11 with 8GB of memory and 64 bit cores. When I increase my array size above a certain point I get the following error:

ld: /tmp/ifort9IeJKr.o r_value (0x9b640d2f) field of relocation entry 318 in section (__TEXT,__text) out of range

Is there a way to allow array dimensions to be increased to take advantage of having so much memory? I can run the code on a Linux machine that has 2GB of physical memory and the same thing happens with the intel compiler at the same point. So it isn't a question of a physical memory limitation. That is, despite having 4 times the memory on the Mac I can still only use the same array sizes as on the Linux machine with 2GB.

Thanks
0 Kudos
5 Replies
TimP
Honored Contributor III
1,620 Views
In order to use 8GB effectively, you need a 64-bit OS and the 64-bit ifort. Even then, the easiest way to make arrays >2GB would be with ALLOCATABLE. The software doesn't do any magic mode switching simply because you have large physical memory.
0 Kudos
dfusuedu
Beginner
1,620 Views
Thanks - I have the 64 bit set up. I don't follow what you mean by 'the easiest way to make arrays >2GB would be with ALLOCATABLE.' Please could you explain what this involves doing? I can't find a compiler option to do this. Or does this only apply to itanium based systems?

Best,
0 Kudos
TimP
Honored Contributor III
1,620 Views
ALLOCATABLE is a Fortran standard way to declare dynamic arrays, since 15 years ago. There are examples in the documentation of every f90 or newer compiler, including ifort. I don't know of a compiler with an option to disable it.
Are you thinking of -mc-model, which changes x86-64 linkage to allow larger static objects?
Itanium compilers have larger default limits for static arrays, 4GB or more, depending on the compiler.
0 Kudos
Steven_L_Intel1
Employee
1,620 Views
This has to do with the way MacOS lays out memory. Try building with -static-intel (I think that's the one). This will allow some increase in static allocation. Or, as Tim suggests, use dynamic allocation.

MacOS does not have the -mc-model option that Linux does.
0 Kudos
IDZ_A_Intel
Employee
1,620 Views

module YourModule
real, allocatable :: BigArray(:,:)
end module YourModule

program YourProgram
allocate(BigArray(1000,1000000))! 4GB array
...
deallocate(BigArray)
end program YourProgram

Check the documentation regarding allocateable arrays

Jim Dempsey

0 Kudos
Reply