Is it possible to determine which Fortran compiler generated the ".mod" file?

Let's say I have a package already installed on my machine, and I want to find out if I need to update modules, including files ( .mod ), to make them compatible with the rest of my compilation. Is there any way to do this?

+6
source share
3 answers

If the module is built using gfortran, then using the lines in the mod file (on Linux) will provide the compiler name and version number. However, for Intel, the strings command will only show the compiler version number.

+7
source

At some point, I had a similar problem with libraries and module files, but without source. Since it’s easier to get the right compiler than to get the source code to recompile in some cases, or recompile just a few things, as indicated in the OP, I found it useful to get the version of the gfortran module somewhere in SO. Unfortunately, this information is not easy to find, so there is a need for reverse engineering, and anyone can edit and add more.

I googled a little, and here is the starting point: for gfortran version control of the module appeared on gfortran 4.4, according to this page . It is important to say that the version number is for the module, not the compiler. I guess this changes when the module file format changes to allow for some new features.

Combining the information from this page , this page , this and the answer from Mathieu-VERSTRAETE, I came up with this list of correspondence.

 GCC version module file version ----------------------------------- up to 4.3.2 unversioned 4.4 0 4.5.1 4 4.6.3 6 4.7.0pre 8 4.7.1 9 4.8.[1-3] 10 4.9.2 12 5.1.0 14 8.1.0 15 

Starting with version 4.8 , the gfortran command includes a small message in the release notes when changing the module version. The message looks like this

Module files: the version of module files (.mod) has been increased

how can I read this link . They do not give a version number, and it seems that when they say it increases, it increases by 2 . The module version update in gfortran version 8 is increased by 1, and the gfortran wiki says nothing about this at the time of this writing. Thanks to Matthew Verstraete for digging it.

+5
source

For the latest versions of Gfortran:

  1. cp mymodule.mod test.mod.gz
  2. gunzip test.mod.gz
  3. read the test.mod file - the first line will contain the version of the module, which is an internal counter for gfortran developers. See the post above for a list of matches. For Gfort 8.1.0 we are in version 15.
+1
source

All Articles