Prev: Error LNK2019
Next: stack overflow
From: sarahimi1983 on 25 Sep 2007 17:56 Dear all, what are differences between 32bit and 64bit mode fortran. explicitly, I need to know what differences there are about their limitations. I think that fortran in 32-bit mode can run a program which contains up to 2^32 bite of memory and there is a limitation on each array up about 256MB. It's very important for me to know how many bite of memory can use in 64bit fortran and are there any limitations on each array about memory in 64bit gfortran. regards, sara
From: Terence on 25 Sep 2007 18:15 Sara, you don't need to assume the Fortran compiler limits the size of an array you conceptually want to use. You can always devise a method of having huge arrays over several open real files. You can also consider the uses of sparce array processing if you data does not fill all the array position with non-zero values. In fact, it might be good advice to assume you relly are severely limited in array space and so devise a method which will work with any CPU and compiler that a fiture user may possess.
From: Steven G. Kargl on 25 Sep 2007 21:41 In article <1190757383.758245.267460(a)d55g2000hsg.googlegroups.com>, sarahimi1983(a)gmail.com writes: > Dear all, > what are differences between 32bit and 64bit mode fortran. > explicitly, I need to know what differences there are about their > limitations. > I think that fortran in 32-bit mode can run a program which contains > up to 2^32 bite of memory and there is a limitation on each array up > about 256MB. It's very important for me to know how many bite of > memory can use in 64bit fortran and are there any limitations on each > array about memory in 64bit gfortran. If you 1) are using a 64-bit OS (such as FreeBSD on opteron processors); 2) have properly configured the kernel; 3) and, have properly set shell limits you can in principle allocate something like 2**63-1 bytes of memory. In reality, system limits will impose some cap in in amount you can allocate. On my opteron systems, I have allocated 12 to 15 GB of memory with a single process and I know in a toy application I allocated a single array that exceeded 8 GB. -- Steve http://troutmask.apl.washington.edu/~kargl/
From: Tim Prince on 25 Sep 2007 22:40 Steven G. Kargl wrote: > In article <1190757383.758245.267460(a)d55g2000hsg.googlegroups.com>, > sarahimi1983(a)gmail.com writes: >> Dear all, >> what are differences between 32bit and 64bit mode fortran. >> explicitly, I need to know what differences there are about their >> limitations. >> I think that fortran in 32-bit mode can run a program which contains >> up to 2^32 bite of memory and there is a limitation on each array up >> about 256MB. It's very important for me to know how many bite of >> memory can use in 64bit fortran and are there any limitations on each >> array about memory in 64bit gfortran. > > If you > 1) are using a 64-bit OS (such as FreeBSD on opteron processors); > 2) have properly configured the kernel; > 3) and, have properly set shell limits > you can in principle allocate something like 2**63-1 bytes of > memory. In reality, system limits will impose some cap in > in amount you can allocate. > > On my opteron systems, I have allocated 12 to 15 GB of memory > with a single process and I know in a toy application I allocated > a single array that exceeded 8 GB. > No compiler replaces the built-in limitations of the CPU. AFAIK the virtual memory addressing capacity of AMD or Intel Xeon "64-bit" CPUs does not exceed a 48 bit address. It's 64-bit only in the sense that 64-bit arithmetic and storage is used for pointers. As the OP asked for a generalization for 64-bit Fortran, we may as well ask OP to survey the architectures of interest, whichever they may be, and report the range involved. One guide I saw recently advised us not to allocate more than 125% of the available physical RAM. A colleague recently tried to run a fairly large linux application under VM under Windows. The limit seems to be much smaller in this case. Most 32-bit Fortrans nowadays support objects (including arrays) approaching 2GB in size (but likely only one object of the maximum size). The most common 64-bit OS have limitations of 2GB for static objects in default or small memory model. As Steve said, it should be possible to ALLOCATE at least 8GB.
From: Janne Blomqvist on 26 Sep 2007 12:00
On 2007-09-25, sarahimi1983(a)gmail.com <sarahimi1983(a)gmail.com> wrote: > Dear all, > what are differences between 32bit and 64bit mode fortran. > explicitly, I need to know what differences there are about their > limitations. > I think that fortran in 32-bit mode can run a program which contains > up to 2^32 bite of memory and there is a limitation on each array up > about 256MB. It's very important for me to know how many bite of > memory can use in 64bit fortran and are there any limitations on each > array about memory in 64bit gfortran. For 64-bit gfortran, the limits ought to be higher than whatever amount of memory you can afford for the foreseeable future. If static data size is a problem, look at the -mcmodel option. There might be problems with the operating system refusing to give a huge chunk in a single allocation request, though. For 32-bit gfortran, addressing is obviously limited to 32 bits, but operating systems limit this further (typically Linux 3 GB, windows 2 GB). On top of that, somewhere in the middle of the virtual address space are the .so:s taking up space, so you can't, say, allocate all of that. Here's a simple test program: ! Test how much memory can be allocated program alloctest2 implicit none integer :: i real(8), allocatable :: a(:,:) do i = 10000, huge(i), 1000 print *, 'Trying to allocate: ', i**2*8._8 / 1024._8/1024_8, ' MB.' allocate (a(i,i)) deallocate (a) end do end program alloctest2 Trying to run this on a 32-bit Linux machine gives: Trying to allocate: 762.939453125000 MB. Trying to allocate: 923.156738281250 MB. Trying to allocate: 1098.63281250000 MB. Trying to allocate: 1289.36767578125 MB. Trying to allocate: 1495.36132812500 MB. Trying to allocate: 1716.61376953125 MB. Trying to allocate: 1953.12500000000 MB. Fortran runtime error: ALLOCATE: Out of memory. So, you can allocate a little bit less than 2 GB for a single array (out of 3 GB total address space at your disposal). You might be able to allocate a little bit more if you allocate it directly in the beginning of the program rather than in a loop as the test program above (if libc doesn't return it all to the OS upon deallocation or somesuch). -- Janne Blomqvist |