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

Please Help a Simple Minded Engineer

diciano
Beginner
587 Views
Hello,
I am running some simple fortran code on a linux based system and am having problems with the size of arrays that I am allowed to use.

Specifically, when I declare a double precision array with dimension more then 250000000 then it gives me an error like:

ex. DIMENSION DKVECT(270000000)
this gives an ERROR "A variable may not exceed 2147483547 bytes"

I was wondering what I need to do in order to allow me to use larger array sizes. I've read in other posts that the max array sizes can be made bigger by using allocatable arrays but I didn't want to have to do this.

Also, another problem when I use array sizes below dimension 25000000 occurs. I get a segmentation fault occuring during run time. I think it may be due to my computer memory limits (becuase when I again use maximum array sizes of around 25000 my code first fine) but I am not sure. Could you help me out with this also ??


Thanks,
Mass
0 Kudos
4 Replies
Steven_L_Intel1
Employee
587 Views
You're using a 32-bit system and 2GB is the maximum amount of virtual memory you can get. If your problem sizes are larger than that, you need a 64-bit system with an Intel processor including the EM64T (Extended Memory 64 Technology) feature and a 64-bit version of Linux.

Then, using the Intel compiler for EM64T and the "-mcmodel medium" or "-mcmodel large" switch, you will have all the address space you can use.

With your smaller arrays, you may be running into an issue where the compiler needs to make a temporary copy of the array. It puts these on the stack, which is of limited size (the actual size depends on your particular system setup.) You can try raising the stack limit with:

ulimit -s

or

limit stacksize unlimited

depending on your shell. This doesn't actually set it to "unlimited", but it does set it to the maximum as specified by your Linux kernel configuration.
0 Kudos
diciano
Beginner
587 Views
Thanks Steve for the info.
I was a bit confused and this seems to clear up what I need to do in order to fix the problem.

If I cannot upgrade the system right now, do you have any suggestions about how I can get arrays >250000000 dimension ??
0 Kudos
Steven_L_Intel1
Employee
587 Views
You can't. It's a hard limit for this platform.
0 Kudos
joseph-krahn
New Contributor I
587 Views
The problem is not just a limit on array indices, but that you are trying to use up all of the memory your CPU can allocate in a single array, even if you have the maximum memory possible installed.

Traditionally, huge calculations have to be broken up into parts. (Scratch files on tape were once common.) You could create a large random-access binary file to hold the full data set, and work with it one chunk at a time.
0 Kudos
Reply