Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Declare a large arary!

Status
Not open for further replies.

truongthinhs

Programmer
Feb 13, 2008
2
0
0
KR
I want to declare a array 2 demensions with large size. Exam: A(1000000,1000000). Can I make it in Fortran? if can how I must declare? Please, help me.
Thank you very much!
 
Depends on how much memory you have. Is it possible to use a disk file?
 
I cant declare it, the program give the error like as:

Error: The size of the array dimension is too large, and overflow occurred when computing the array size. [A]
REAL,DIMENSION(0:100000,0:100000)::A.

 
You're talking 10^6x10^6x4 which is about 4x10^12 i.e 4Tb. Not likely that your machine has that much space. I don't even have that much disk space! Do you really need an array that size?
 
Hi

I occationally use MS-Fortran 5.10 (for DOS) and there you can specify huge arrays. This declaration is in one of my programs:

byte vBits[HUGE] (2000000)

In your case it would be:

real A[HUGE] (1000000,1000000)

But maybe you are not using MS-Fortran?

Best wishes
gullipe
 
Huge will cope with an addressing range of a flat addressing 32 bit machine. That is outside the addressing range of a flat addressing 32 bit machine. It is just on the limit of a segmented addressing 32 bit machine which the 386 could handle but nobody ever used because it was "too difficult". As I mentioned earlier, you can dump it to disk but you would need a 4Tb disk.

The question is do you really need an array that size or can you get away with a sparse array.
 
What is the reason you're trying to create such a large array? There are other ways to work with large arrays other than in an array that would be too large for available memory.

For instance, you could implement a sparse array (look at a data structures book) and put the array elements in a database table as (x coordinate, Y coordinate, value). Whatever you were planning to do with the array will be slower, but you will be able to do work with it.

Pat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top