- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi all,
I am using Intel Parallel Studio XE 2011 to compile my fortran files (.f90) on VS environment.
To compile some old fortran file (.f) with different syntax I have to use in-built compiler through command prompt (I don't know if it is also available on VS or not). I used "gfortran" and "ifort" and they worked but with two different results! Why?!
I want to know what other compilers are accessible via command line and which one is correct for ".f" files?
Thanks
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Windows doesn't automatically supply any compiler (and no Fortran comes with Visual Studio). Both gfortran and ifort are good choices for .f and .f90. ifort will not work on Windows without a version of Visual Studio or VS Shell, but command line is still a good option.
To begin to discuss your question, we need to know your compiler versions and the options you supplied, e.g. by
ifort -V
ifort youroptions yourfile.f
gfortran -v youroptions yourfile.f
The defaults of ifort and gfortran are entirely different; for example
ifort /assume:protect_parens /QxHost /Qunroll2 /Qprec-div /Qprec-sqrt yourfile.f
may be roughly comparable to
gfortran -O3 -ffast-math -fno-cx-limited-range -march=native -funroll-loops --param max-unroll-times=2 -fno-reciprocal-math yourfile.f
so it's important to read about the options of each. Neither goes out of its way to make this simple.
It's certainly possible to put bugs in a program which will make it run entirely different with changes in compiler or options.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank you Tim!
My compiler versions are:
Mingw32 4.7.2 and ifort 12.0.02
I used the following commands on the Intel 64 VS 2008 command line mode:
ifort -o2 -o [output] [input].f
gfortran -o2 -o [output] [input].f
I checked the Intel fortran user guide and found there are many many options! Which one is usually subjected to change and which one left as default? I need maximum precision and speed is not an issue.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
A catchall option for less aggressive optimization in ifort and better consistency with your gfortran selection is /fp:source, or, for better exception handling, /fp:strict.
/fp:source includes the effects of /assume:protect_parens /Qprec-div /Qprec-sqrt /Qftz- . In addition, it disables optimizations (which gfortran would perform only with -ffast-math) where results depend on data alignment (but may be more accurate with the optimization).
If you are comparing ifort Intel64 (64-bit) against gfortran mingw32 32-bit you will need to add one of the SSE2 options for gfortran. The gfortran 32-bit default -march=i686 promotes all single precision expression evaluation to double. If your application needs that, it should be written in so as not to depend on compile options. All 64-bit compilers for IA default to SSE2.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page