Fortran error: Big array size, solution?

  • Context: Fortran 
  • Thread starter Thread starter Sarahberg
  • Start date Start date
  • Tags Tags
    Array Error Fortran
Click For Summary

Discussion Overview

The discussion revolves around a Fortran programming issue related to memory limitations when handling large matrices, specifically a 61,000x61,000 array. Participants explore potential solutions and techniques to manage memory effectively in the context of a thesis project.

Discussion Character

  • Technical explanation
  • Debate/contested
  • Exploratory

Main Points Raised

  • One participant identifies that the error arises from exceeding the maximum allocatable bytes for a matrix due to system memory limitations.
  • Another participant suggests that the matrix size could require up to 15GB of memory, depending on the data type used (e.g., REAL or double precision).
  • There is a proposal to use sparse techniques to manage memory more effectively.
  • A suggestion is made to transition from using COMMON blocks to MODULES and the USE command, contingent on the use of Fortran 90 or later.
  • One participant expresses uncertainty about heap and stack memory concepts and how to implement them in Fortran.
  • A participant indicates a lack of experience with heap and stack memory, suggesting that they may not be the right person to provide guidance on that topic.

Areas of Agreement / Disagreement

Participants generally agree on the memory limitations posed by the large matrix size, but there is no consensus on the best approach to resolve the issue, as different techniques and strategies are proposed without definitive agreement.

Contextual Notes

Participants mention the need for a deeper understanding of heap and stack memory, as well as the implications of using allocatable arrays, but do not resolve these concepts within the discussion.

Sarahberg
Messages
2
Reaction score
0
Hi everybody;
I'm not programmer or computer expert, but during working with my thesis got serious problem with my program seemingly about big size of matrices. I'm working with meshes and using Fortran to analyze entire of my mesh including nodes and elements. The biggest size of my matrix has around 61,000x61,000 arrays. During debugging of my program, following common message and highlighted ERROR are appearing every time:

--------------------Configuration: Ali-0 - Win32 Debug--------------------
Compiling Fortran...
D:\Thesis\Fortran programming\Copy of shin yokohama fortran\Ali-0.for
D:\Thesis\Fortran programming\Copy of shin yokohama fortran\Ali-0.for(25) : Error: A common block or variable may not exceed 2147483647 bytes
& nfix(5000),r1(61000),sk(61000,61000)
----------------------------------^
Error executing df.exe.

Ali-0.exe - 1 error(s), 0 warning(s)

I know the reason is because size of my matrix in bytes outnumbers maximum allocatable bytes for each matrix. I have no choice to use this matrix. I've searched the web for reasons and solutions. It seems that this error relates to ram and operating system as well.
I have 2 system: window 32 bit 2GB ram, other windows 64 bit, 6.00 GB.
Could anybody help me resolving this problem!
 
Technology news on Phys.org
Sarah:

Well, at least you have realized that the reason why you cannot have this matrix size is simply because your computer does not have that kind of memory. As you can tell, your 61000x61000 matrix puts you up there in 3.7GB, IF the matrix has been declared as a 1-byte short integer...but if it is REAL and possibly double prescision...then it is HUGE.

I think the only way to get around some of these calculations is to start using sparse techniques.

Also, regarding the COMMON block just being too big...maybe you should stop using common block and start using MODULES and the USE command...are you in fortran 90 at least? or still f77? You need fortran 90 for modules.
 
Thanks for commenting, gsal;
My compiler is Fortran 90 installed on platform 32 bits, 2GB RAM;
Other one is Microsoft Visual Studio 2008, version 3.5 Sp1 installed on platform 64 bits, 6GB RAM.
Yeah, you are right, my matrix sk takes about 61000x61000x4 bytes ≈ 15GB memory.
Even if I want to use sparse techniques, still I need to use another way to overcome memory shortage.
During these days which I posted my problem, I was reading about my problem from various posts and forums. I came across to heap and stack memory, and allocatable arrays discussions which is exactly related to switching the memories when one is limited.
As I'm not good with heap arrays ans stack memory concepts, still kind of unfamiliar how exactly utilize these concepts in Fortran language? how much do I have to change the allocation of stack memory in my case ?? :)) still :frown:
 
Sorry...I don't know much about heaps and stacks; I have certainly never used them instead of matrices in my problems.

Hopefully somebody else will come along; otherwise, there are other fortran forums you may want to try. This one is pretty active.
 

Similar threads

  • · Replies 4 ·
Replies
4
Views
3K
  • · Replies 4 ·
Replies
4
Views
3K
Replies
7
Views
3K
  • · Replies 4 ·
Replies
4
Views
4K
  • · Replies 3 ·
Replies
3
Views
2K
  • · Replies 4 ·
Replies
4
Views
17K
Replies
11
Views
2K
Replies
5
Views
4K
  • · Replies 3 ·
Replies
3
Views
5K
  • · Replies 2 ·
Replies
2
Views
9K