Fortran Fortran error: Big array size, solution?

AI Thread Summary
The discussion centers around a Fortran programming issue related to handling large matrix sizes, specifically a 61,000x61,000 array that exceeds the memory limits of the user's systems. The user is encountering an error indicating that the matrix size surpasses the maximum allocatable bytes, which is compounded by the limitations of their 32-bit and 64-bit systems. Suggestions include using sparse techniques to reduce memory usage and transitioning from common blocks to modules for better memory management. The user expresses confusion about heap and stack memory concepts and seeks guidance on how to implement these in Fortran. The conversation highlights the need for a better understanding of memory allocation to resolve the issue effectively.
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.
 
Dear Peeps I have posted a few questions about programing on this sectio of the PF forum. I want to ask you veterans how you folks learn program in assembly and about computer architecture for the x86 family. In addition to finish learning C, I am also reading the book From bits to Gates to C and Beyond. In the book, it uses the mini LC3 assembly language. I also have books on assembly programming and computer architecture. The few famous ones i have are Computer Organization and...
I had a Microsoft Technical interview this past Friday, the question I was asked was this : How do you find the middle value for a dataset that is too big to fit in RAM? I was not able to figure this out during the interview, but I have been look in this all weekend and I read something online that said it can be done at O(N) using something called the counting sort histogram algorithm ( I did not learn that in my advanced data structures and algorithms class). I have watched some youtube...
Back
Top