Increase of array memory in gfortran compiler

Click For Summary
SUMMARY

The maximum size of arrays in the gfortran compiler is limited by the CPU architecture, specifically whether it is 32-bit or 64-bit. To allocate larger arrays, users can utilize the "kind" parameter in Fortran, such as "real(kind=4)", "real(kind=8)", or "real(kind=16)". This method is applicable in Fortran 90 and 95, but not in Fortran 77. Understanding these specifications allows for effective memory management in Fortran programming.

PREREQUISITES
  • Understanding of Fortran programming language
  • Familiarity with gfortran compiler settings
  • Knowledge of CPU architecture (32-bit vs 64-bit)
  • Experience with Fortran 90/95 array handling
NEXT STEPS
  • Research memory allocation techniques in Fortran 90/95
  • Explore the implications of CPU architecture on array sizes
  • Learn about the "kind" parameter in Fortran for data types
  • Investigate compiler flags in gfortran for optimizing memory usage
USEFUL FOR

This discussion is beneficial for Fortran developers, particularly those working with large data sets, as well as anyone looking to optimize memory allocation in gfortran.

Cleiton
Messages
1
Reaction score
0
Dear colleagues

My code in Fortran passes all data in one large vector. I increased the size of this vector for the maximum that the compiler accepts but still need more positions allocable to it. Is there any way I can increase the memory allocation of the compiler?

Thank's
 
Technology news on Phys.org
Hi, do not forget that the maximum size for an array is determined by the CPU architecture, i.e. 32bit or 64bit. Anyhow, you can use the word "kind" to allocate very large arrays, e.g

real(kind=4) :: var
You can also use kind=8 or even kind=16. One last thing, the parameter kind is used in Fortran 90/95 not 77
 

Similar threads

  • · Replies 17 ·
Replies
17
Views
4K
  • · Replies 5 ·
Replies
5
Views
2K
  • · Replies 3 ·
Replies
3
Views
2K
Replies
6
Views
3K
  • · Replies 20 ·
Replies
20
Views
3K
  • · Replies 9 ·
Replies
9
Views
4K
  • · Replies 2 ·
Replies
2
Views
3K
  • · Replies 29 ·
Replies
29
Views
4K
  • · Replies 1 ·
Replies
1
Views
4K
Replies
1
Views
3K