Friday, October 14, 2011

Compiling .f95/.F95 code with Intel compilers

> From various bits of documentation, it is obvious that the
> Intel compiler will handle F95 and even parts of F03 but I
> seem to be blind as I cannot find how to make the compiler
> recognize .f95/.F95 files as valid fortran files and compile
> them. As I am using my files across compilers and platforms
> I am loath to rename the files to .f90 (though when I did the
> compiler does work). Any suggestions for what compile option
> will make these files (.f95/.F95) files recognized?

In my opinion, the use of .f95 to mean "Fortran 95 source" is misguided.
It is unfortunate that the industry settled on .f90 to mean "free-form
source" as many people mistakenly assumed that this was somehow tied to
the particular variant of the language. Some compilers do recognize
.f95 (and perhaps even now .f03?), but some do not.

For the Intel compiler, the way to do this is:

ifort -Tf filemane.f95 -free

The -Tf tells the ifort driver that the following filename is a Fortran
source file, no matter what the file type. By default, such files are
treated as fixed-form source, so you would then add -free to have it be
recognized as free-form source (assuming that it is.)

My advice is to use the .f90 file type consistently, as it is pretty
much universally implemented.

No comments:

Post a Comment