1

Using ifort, with some HPC code, working on 30-year-old Fortran code with large data arrays stored in COMMON blocks. Is there a way to know, without just compiling and seeing if I get an error, whether or not those arrays are too big for the HPC based on my system's specs? Is there a way to have the compiler inquire what that limit is, if I'm compiling on the same host I plan to run the code on?

Frank
  • 544
  • 2
  • 14
  • What kind of limit do you have in mind? You are most likely to hit the mcmodel issues. https://stackoverflow.com/questions/12916176/gfortran-for-dummies-what-does-mcmodel-medium-do-exactly https://stackoverflow.com/questions/10486116/what-does-this-gcc-error-relocation-truncated-to-fit-mean What other limits do you think you might face? – Vladimir F Героям слава Feb 11 '22 at 16:28
  • 1
    The problem with relying on a compiler diagnostic is that, while it can tell you if a single COMMON is so large that it can't possibly be used, the actual limit is the combined sizes of all the COMMONs, the code, other static variables, pieces of the OS code, sometimes the stack, and more. What I most often see is a program that just dies without an obvious error message. On Windows, the absolute max is 2GB, even on x64. On Linux, you need -mcmodel large to go over that. – Steve Lionel Feb 12 '22 at 14:00
  • @VladimirF I'm refactoring some 30-year-old code that hard-codes in limits on the size of a the main data array (which is stored in a `COMMON` block) based on the type of system (Cray, SGI, etc.) the code compiled for (passed in as a define). The programmer who originated this code is long gone, so I'm trying to work out why they felt the constraint was necessary becuase I'm new to Fortran and I smell a trap. – Frank Feb 15 '22 at 19:24
  • @Frank I do not think the programmer chose the limits because of some hard limits but because he had to choose something. At least that is how it commonly looks like. For static data, you simply have to choose some size at compile time. If you want freedom and no hard limits, use allocatables. They are allocated dynamically to any size you want. – Vladimir F Героям слава Feb 15 '22 at 19:31

0 Answers0