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

.F not recognized by ifort; alternative -ext flag?

cappssl
Beginner
1,408 Views
I am trying to compile source code with the extension .F. Although recognized by Linux machines (which are primarily the ones dealing with CMAQ, the code I am compiling), .F is not recognized as a Fortran file. I've tried adding the -extend-source 132 and -fpp options, but they have not worked. Any recommendations?

Thanks!
0 Kudos
5 Replies
Bonnie_A_Intel
Employee
1,408 Views

Fortran code files with a .F extension should work fine on both Linux* and Mac OS* X since .F, .FOR, or .F90 are all supported as standard Fortran file extensions. A bit more information would be helpful.


Are you running on Linux* or Mac OS* X?
Which specific OS version are you running?
Which Compiler version are you running (a number like 10.1.014).
Are running the IA-32 or Intel 64 Compiler?
Please supply your complete build command.

Please cut and paste the output from the compiler that shows the errors.

Did you obtain the download of CMAQ 4.6 from the website below, or from another source?

http://www.cmaq-model.org/

0 Kudos
TimP
Honored Contributor III
1,408 Views
Intel's fpp doesn't necessarily work the same as gnu tradcpp (the one invoked by gfortran in similar circumstances), although it is similar (when you don't set -openmp). As I think you understood, 'ifort -fpp yourfile.f' is the same as 'ifort yourfile.F' For those who require a pre-processor other than ifort's fpp, Makefile rules are commonly in use, with
gcc -E -traditional -x c yourfile.F > yourfile.f
as a typical command to invoke gnu tradcpp pre-processing.
Among the differences might be that ifort fpp deals with free and fixed formats, while gnu pre-processing doesn't preserve fixed formats.
You could compare the pre-processing of various alternatives on your source files. Besides gnu tradcpp, there is open source sun fpp, and open source coco pre-processor which implements a Fortran standard.
None of the commonly used Fortran pre-processors provide by compilers adhere to a recognized standard.
0 Kudos
cappssl
Beginner
1,408 Views
Thanks for your quick reply.

I am using the Intel 64 compiler version 10.0.016 on a Mac OS 10.5.2 system, a MacBook Pro with a 2.16 GHz Intel Core 2 Duo to be specific.

You would think that "standard Fortran file extensions" would be processed appropriately, but only on a Linux system does the Fortran preprocessor know to act on .F files according to the documentation (.../com.intel.compilers.ifort.docset/Contents/Resources/Documents/ifort/doc_files/index.htm) The other evidence that this is the problem is that manually changing the .F files to .fpp solved the problem. It would be helpful to know how to avoid all of the manual changes if possible. Maybe just writing a script that searches directories for .F and changes them to .fpp would be sufficient.

The compiler basically does not compile the .F files properly and halts at this juncture. Yes, I did download from the site that leads you to download the model from. If you'd like the full build command, I'd be happy to email the file to you.

Thanks!
Shannon

0 Kudos
Bonnie_A_Intel
Employee
1,408 Views
By default, the format (fixed or free format) is determined by the Fortran file extension. Files with an extension of .f90, .F90, or .i90 are free-format source files. Files with an extension of .f, .for, .FOR, .ftn, .FTN, .fpp, .FPP, or .i are fixed-format files. You can also compile with the -free option to specify to the compiler that source files are in free format, or the -fixed option to specify that the source files are in fixed format.
0 Kudos
Kevin_D_Intel
Employee
1,408 Views

ifort 10.1 accepts and handles .F source files properly on Mac OS 10.5.2 (see below).

You indicated version is 10.0.016, which pre-dates our explicit support of Mac OS 10.5. It is hard to know if that is really contributing to your error and without seeing the actual error received it is hard to offer any specific advice on how to address the situation.

I recommend you first install our latest 10.1.14 update (m_fc_p_10.1.014) and try that, plus it officially supports your OS.

Next, it would be helpful and appreciated if you could share the details of the error you received.

$ cat hello.F

program test

#ifdef MAC

print *,"hello"

#endif

end

$ ifort -V -D MAC hello.F

Intel Fortran Compiler for applications running on Intel 64, Version 10.1 Build 20080312 Package ID: m_fc_p_10.1.014

Copyright (C) 1985-2008 Intel Corporation. All rights reserved.

Intel Fortran 10.1-2047

@(#)PROGRAM:ld PROJECT:ld64-77

Library search paths:

/opt/intel/fce/10.1.014/lib

/usr/lib/i686-apple-darwin9/4.0.1/

/usr/lib/

/usr/lib/gcc/i686-apple-darwin9/4.0.1/x86_64

/usr/lib/gcc/i686-apple-darwin9/4.0.1/

/usr/lib/i686-apple-darwin9/4.0.1

/usr/lib

/usr/lib

/usr/local/lib

Framework search paths:

/Library/Frameworks/

/System/Library/Frameworks/

/Network/Library/Frameworks/

$ ./a.out

hello

0 Kudos
Reply