CFD Online Logo CFD Online URL
www.cfd-online.com
[Sponsors]
Home > Forums > General Forums > Main CFD Forum

largest one-dimensional array in fortran 77

Register Blogs Community New Posts Updated Threads Search

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old   October 20, 2008, 23:54
Default largest one-dimensional array in fortran 77
  #1
yfyap
Guest
 
Posts: n/a
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
  Reply With Quote

Old   October 21, 2008, 03:43
Default Re: largest one-dimensional array in fortran 77
  #2
Jed
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 21, 2008, 03:46
Default Re: largest one-dimensional array in fortran 77
  #3
yfyap
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 21, 2008, 03:49
Default Re: largest one-dimensional array in fortran 77
  #4
yfyap
Guest
 
Posts: n/a
i am using compaq visual fortran 2000 currently. the data is double precision. thanks.
  Reply With Quote

Old   October 21, 2008, 07:40
Default Re: largest one-dimensional array in fortran 77
  #5
Richard
Guest
 
Posts: n/a
When you say "the compiler won't work", do you mean that the code will not compile, or the resulting executable will not run?
  Reply With Quote

Old   October 21, 2008, 22:23
Default Re: largest one-dimensional array in fortran 77
  #6
yfyap
Guest
 
Posts: n/a
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.

  Reply With Quote

Old   October 22, 2008, 04:55
Default Re: largest one-dimensional array in fortran 77
  #7
Jed
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 22, 2008, 08:40
Default Re: largest one-dimensional array in fortran 77
  #8
Steve
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 22, 2008, 08:43
Default Re: largest one-dimensional array in fortran 77
  #9
yfyap
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 22, 2008, 08:45
Default Re: largest one-dimensional array in fortran 77
  #10
yfyap
Guest
 
Posts: n/a
hi.. actually i have a few arrays with 5M entries. all these are defined using COMMON, global variables. thanks.
  Reply With Quote

Old   October 22, 2008, 13:58
Default Re: largest one-dimensional array in fortran 77---
  #11
omfg
Guest
 
Posts: n/a
first you should learn fortran and then use dynamic memory.
  Reply With Quote

Old   October 23, 2008, 07:25
Default Re: largest one-dimensional array in fortran 77---
  #12
Steve
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 23, 2008, 10:45
Default Re: largest one-dimensional array in fortran 77
  #13
Steve
Guest
 
Posts: n/a
What kind of machine are you compiling & running on?
  Reply With Quote

Old   October 23, 2008, 10:52
Default Re: largest one-dimensional array in fortran 77
  #14
yfyap
Guest
 
Posts: n/a
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.

  Reply With Quote

Old   October 23, 2008, 13:48
Default Re: largest one-dimensional array in fortran 77
  #15
Jed
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 23, 2008, 23:11
Default Re: largest one-dimensional array in fortran 77
  #16
yfyap
Guest
 
Posts: n/a
hi.. running 32bit os. will try that and will let u know the results. thanks!
  Reply With Quote

Old   October 24, 2008, 04:36
Default Re: largest one-dimensional array in fortran 77
  #17
Steve
Guest
 
Posts: n/a
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.
  Reply With Quote

Old   October 24, 2008, 14:09
Default Re: largest one-dimensional array in fortran 77
  #18
Paul
Guest
 
Posts: n/a
Hello,

try to use a different compiler and see if you have the same problem.

gfortran for Windows is a decent compiler.

Paul

  Reply With Quote

Old   October 27, 2008, 07:48
Default Re: largest one-dimensional array in fortran 77
  #19
yfyap
Guest
 
Posts: n/a
hi thanks!
  Reply With Quote

Old   October 29, 2008, 09:31
Default Re: largest one-dimensional array in fortran 77
  #20
Rami
Guest
 
Posts: n/a
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

  Reply With Quote

Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
An unknown array definition in fortran morteza08 Main CFD Forum 0 June 20, 2011 04:32
CFX11 + Fortran compiler ? Mohan CFX 20 March 30, 2011 18:56
Array Comparison in Fortran 90/95 M Malik Main CFD Forum 4 September 11, 2008 14:14
Compaq Visual Fortran - array, debug CFD Student Main CFD Forum 0 May 10, 2008 07:59
Array Visualizer in Visual Fortran Krishna Main CFD Forum 0 December 6, 2004 03:23


All times are GMT -4. The time now is 10:12.