Fortran error: Big array size, solution?

In summary, Sarah's program is not able to create a matrix with a size larger than 2GB because of the limit on the amount of memory that her computer has. She might be able to work around this by using sparse techniques or by switching to using modules instead of common blocks.
  • #1
Sarahberg
2
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
  • #2
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.
 
  • #3
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:
 
  • #4
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.
 
  • #5


I understand the frustration of encountering errors in your program, especially when it relates to the size of your matrices. Fortran has a limit on the size of common blocks or variables, which in your case, has exceeded the maximum allocatable bytes. This can be a common issue when working with large datasets or complex calculations.

One solution to this problem could be to optimize your code and try to reduce the size of your matrices. This could involve using more efficient data structures or algorithms, or breaking down your calculations into smaller chunks.

Another solution could be to upgrade your system to have more RAM and a 64-bit operating system. This would allow for larger memory allocation and potentially solve your issue.

I would also recommend reaching out to other Fortran programmers or seeking help from a computer expert to see if there are any other possible solutions or workarounds for your specific problem.

In summary, the Fortran error you are encountering is due to the size of your matrices exceeding the maximum allocatable bytes. Consider optimizing your code or upgrading your system to potentially solve this issue. It may also be helpful to seek assistance from other experts in the field. Best of luck with your thesis.
 

FAQ: Fortran error: Big array size, solution?

What does the error message "Fortran error: Big array size, solution?" mean?

The error message "Fortran error: Big array size, solution?" means that the size of the array being used in the Fortran code is too large for the available memory in the system. This can happen if the array is defined to be larger than the maximum allowed size or if there is not enough memory available to store the array.

How can I fix the "Fortran error: Big array size, solution?" error?

To fix the error, you can try reducing the size of the array or optimizing your code to use less memory. You can also try running the code on a system with more memory available. If the array size is necessary for your code, you may need to find alternative solutions or consider using a different programming language.

Can I increase the maximum allowed array size in Fortran?

Yes, you can increase the maximum allowed array size in Fortran by changing the compiler settings or using compiler directives. However, keep in mind that this may not be a feasible solution if your system does not have enough memory to support the increased array size.

Why am I getting this error even though my array size is within the maximum allowed limit?

There are a few potential reasons for this. It could be that your system does not have enough memory to support the array size, or there may be other variables or arrays in your code that are also using significant amounts of memory. It is also possible that there is a bug in your code that is causing it to allocate more memory than necessary for the array.

Is it possible to prevent the "Fortran error: Big array size, solution?" from occurring?

It is possible to prevent the error from occurring by being mindful of the memory limitations of your system and carefully optimizing your code to use memory efficiently. However, depending on the complexity of your code and the size of the array required, it may not always be possible to completely avoid this error.

Similar threads

Replies
4
Views
2K
Replies
4
Views
2K
Replies
4
Views
3K
Replies
4
Views
2K
Replies
4
Views
16K
Replies
2
Views
8K
Back
Top