largest one-dimensional array in fortran 77
hi there i have a one-dimensional array in fortran 77: A(N), intended to store a very long list of particles. the largest N that i could have currently is around 1.2 millions. larger than that, the compilier wont work. Is there a way to increase N far beyond 1.2 millions, eg. 5 millions? thanks in advance
|
Re: largest one-dimensional array in fortran 77
Uh, the *compiler* won't work? What compiler? The compiler shouldn't complain up to 2^32. With a 32-bit OS, your program won't be able to address more than 2^31 total bytes. But these are run-time issues, and you need to be orders of magnitude larger to run into them.
|
Re: largest one-dimensional array in fortran 77
hi.. the limit is around 5 millions entry in the array, but still think of getting it even larger. regret for the wrong info of 1.2 millions.
|
Re: largest one-dimensional array in fortran 77
i am using compaq visual fortran 2000 currently. the data is double precision. thanks.
|
Re: largest one-dimensional array in fortran 77
When you say "the compiler won't work", do you mean that the code will not compile, or the resulting executable will not run?
|
Re: largest one-dimensional array in fortran 77
hi.. the compiler does compile, but gives warning message:
for five million entries: warning LNK4084: total image size 1813958656 exceeds max (268435456); image may not run for six million entries: warning LNK4084: total image size -2137006080 exceeds max (268435456); image may not run the generated exe file for 5 million entries is ok, but that with six million entries does not run. any light cast on the matter is deeply appreciated. |
Re: largest one-dimensional array in fortran 77
Could you post the code that triggers this? Somehow your program is putting this array in the text segment (the actual executable image) many times. An array of 5M double precision values should be 40MB, but your image is more than 2GB (hence 32-bit signed integer indices overflow, or if you're on a 32-bit architecture the OS simply won't run it). Normally the compiler will allocate large arrays on the heap so they don't effect the image size and you are only limited by available memory.
|
Re: largest one-dimensional array in fortran 77
Is your array static (e.g. defined using common or data). Or is it a local variable? If it's a local variable, you'll run into stack size limits quite quickly.
|
Re: largest one-dimensional array in fortran 77
hi the code is a bit too long to be posted here. i have a bunch of arrays with 5M entries. maybe it hits the limit of 2G. will check this. thank you.
|
Re: largest one-dimensional array in fortran 77
hi.. actually i have a few arrays with 5M entries. all these are defined using COMMON, global variables. thanks.
|
Re: largest one-dimensional array in fortran 77---
first you should learn fortran and then use dynamic memory.
|
Re: largest one-dimensional array in fortran 77---
The original poster is using F77. It's in the title of the post. Why he/she is choosing to use this vintage is not mentioned. However, it precludes anything dynamic.
|
Re: largest one-dimensional array in fortran 77
What kind of machine are you compiling & running on?
|
Re: largest one-dimensional array in fortran 77
hi..i am building on top of a flow solver written in fortran 77. the program is running on a machine with intel core 2 processor, 4Gb of memory, window vista. guess the system is sufficient for my purpose. thank you.
|
Re: largest one-dimensional array in fortran 77
64-bit OS? Can you compile a 64-bit binary? How large is the binary? Can you write the 4-line program that allocates a huge array and touches it? How large does the single array have to be to fail (link statically to give yourself the most possible room). If it's close to 2GB, then it's a real OS-level issue and you need to need a real 64-bit system to do better. If it's not close to 2GB, then the compiler is doing something weird.
|
Re: largest one-dimensional array in fortran 77
hi.. running 32bit os. will try that and will let u know the results. thanks!
|
Re: largest one-dimensional array in fortran 77
My question was because some F77 compilers require special switches to control max data size (e.g. xlf on AIX). Similarly, some operating systems have max data size per process hard-coded into the kernel (e.g. HP-UX), requiring a kernel rebuild to change it.
|
Re: largest one-dimensional array in fortran 77
Hello,
try to use a different compiler and see if you have the same problem. gfortran for Windows is a decent compiler. Paul |
Re: largest one-dimensional array in fortran 77
hi thanks!
|
Re: largest one-dimensional array in fortran 77
Here is a very simple f77 code to test the limits. On WinXP/Visual Studio fortran (v6.6) it gave warning at a much lower dimension than expected (I think 2^28 bits ~ 268M real*4) and on slightly larger array - it crashed. On linux/g77 it ran near the theoretical 2^32 bits when the array was in a common block, as explained formerly in this thread. If you play with this code, you may find whether you have a specific fortran/OS limitation.
I hope that helps, Rami __________________________________________________ ___ program zz parameter (m=29) c parameter (i=2**m) parameter (i=536770912) c real*4 a(i) integer a(i) common a print *, 'm, i = ', m, i sum = 0. do k=1,i a(k) = k sum = sum + a(k) enddo print *, 'a(1), a(i), sum = ', a(1), a(i), sum end |
All times are GMT -4. The time now is 19:56. |