Intel® Fortran Compiler
Build applications that can scale for the future with optimized code designed for Intel® Xeon® and compatible processors.
28657 Discussions

Intel ifort always updates the timestamp of .mod files?

Lee_B_1
Beginner
723 Views

Apologies in advance for the repetitive nature of this question (see "compilation cascade"), but I could not find a definitive answer for my specific use case (linux, using gmake).

It seems that, unlike gfortran, ifort always updates the file timestamp of generated .mod files, even if the contents of the module have not changed. This makes it difficult to write makefiles that are both correct and that do minimal work.  I don't see any compiler options that would control this behavior. Is my understanding of this matter correct?

0 Kudos
3 Replies
Thomas_O_
Beginner
723 Views
Thanks for pointing out that gfortran finally plays nice with that! I assumed all Fortran compilers still make things hard by always overwriting the .mod files. I verified that gfortran even does not touch the .mod file when I change something in the module's code that does not affect the interface. Splendit! This must be a rather recent development (read: during the past 10 years;-). On the other hand, I can confirm that ifort always overwrites the .mod file. The other issue I worked around early on is that the interprocedural analysis of object files sees the object files being modified while linking. It could be that his was only the Sun compiler back then, not sure if Intel does that, too. I have a script in my Makefiles that always copies the objects to a temporary location before linking to ensure that the make process does not get confused by timestamps changing all around, and also to actually enable parallel builds. If both premature .mod file modification and rewriting of object files being linked are gone, my builds really could be simplified. So count me in as interested in an answer.
0 Kudos
Steven_L_Intel1
Employee
723 Views

Submodules are the answer to this. Intel Fortran 16 supports them. See Doctor Fortran in "We All Live in a Yellow Submodule"

0 Kudos
Lee_B_1
Beginner
723 Views

Thanks very much for the quick responses from Thomas O. and Steve Lionel.  I always seem to learn something by posting here.  Submodules do look interesting and useful, especially for new code. For existing code, perhaps not so much.

0 Kudos
Reply