1
votes

I'm working with a Fortran90 code that works just fine for small arrays. Unfortunately, if the arrays are too large, the program returns an error when allocating the array: severe (41): Insufficient virtual memory.

What I have is:

real*8, allocatable :: M(:,:), C(:,:), K(:,:)
real*8, allocatable :: t(:)
real*8, allocatable :: X(:,:), DX(:,:), D2X(:,:)
real*8, allocatable :: R(:,:)
integer*4 :: nx, nt
integer :: io_stat
...
nx = 15
nt = 6000001
...
allocate(M(nx,nx), C(nx,nx), K(nx,nx),stat=io_stat)
 if(io_stat) stop
allocate(t(nt),stat=io_stat)
 if(io_stat) stop
allocate(X(nx,nt),DX(nx,nt),D2X(nx,nt),R(nx,nt),stat=io_stat)
 if(io_stat) stop
...

The nt parameter is calculated based on the time increment I want to use on the calculations, and this time increment must be very small (1e-9 or smaller) to make the results converge. If nt=600001, the program runs just fine, but the results are not accurate. The problem is: I can't increase the size of the arrays because the program can't allocate all the arrays I'm using (when trying to allocate the DX array, the program already stops). Those are not the only arrays on the code, just the significant (big) arrays.

I'm using Intel(R) Visual Fortran Compiler Professional Edition 11.1 and Microsoft Visual Studio 2008 Version 9.0.21022.8 RTM. I'm running the code in Windows 8, 64-bit, 16 GB RAM memory. However, Build -> Configuration Manager is set to Win32 Platform, because I use a library that must run on this platform (I can't change it to a x64 platform).

I would like to know how I can increase the virtual memory, so I can run my code with the proper discretization, i.e., I need more memory to allocate all my arrays. How to do it?

P.S. I runned a similar code on Matlab, and it generated almost 2GB of data (of the X, DX and D2X arrays, which are the results I want). But I have 16GB of ram, so I think memory of the computer is not the problem, but something with the compiler/code. Am I right?

1
How much data are you actually generating? How big is your swap space? (Check the computer advanced properties to see the size). Note that if you are using a 32-bit configuration, you cannot address all of your memory (up to 4GB), so your effective memory will be limited to 4GB. - Ryan J
There are a few more matrices and variables, by they occupy no more than 1 MB. The problem is the arrays t, X, DX, D2X and R. They occupy (correct me if I'm wrong): t: 6000001*8 bytes X, DX, D2X, R: 4*6000001*15*8bytes Total: 2,93 GB Since I don't need the R after my calculations, the only arrays I need to save are t, X, DX and D2X (2,21 GB of data to save). I did not knew the 4 GB limitation, but I don't need the 4GB memory (just, let's round it up, 3GB). The swap space I can't check on my computer (it's not my personal computer, so I need administrator privileges to check and change it). - Thales
By the way, how the swap space influences the program? Doesn't the program run on the ram memory? - Thales
2GB is the practical limit on 32-bit Windows. See software.intel.com/en-us/articles/… - Steve Lionel
What is the alternative? break the arrays by half and run the code twice? Will that work? - Thales

1 Answers

0
votes

In general you need to ensure:

  1. Your system supports the amount of virtual memory you need.
  2. That you have adequate page file space.
  3. That your process has a large enough quota for virtual memory and working set.