Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

gfortran or ifort?

5,729 views
Skip to first unread message

Daniel Carrera

unread,
Nov 14, 2010, 10:06:24 AM11/14/10
to
Hello,

I'm quite new at Fortran, I hope this isn't a stupid question. Can
someone summarize the pros and cons of gfortran vs ifort?

The obvious one that I can think of is that gfortran is free and open
source, while ifort is proprietary and only gratis for non-commercial
use, which does not include academic use. Any other highlights? Does
one have better standard compliance? Is one faster? Anything else I
should know?

For what it's worth, my OS is Ubuntu Linux.

Thanks for the help.

Cheers,
Daniel.

Tobias Burnus

unread,
Nov 14, 2010, 10:26:31 AM11/14/10
to
Daniel Carrera wrote:
> I'm quite new at Fortran, I hope this isn't a stupid question. Can
> someone summarize the pros and cons of gfortran vs ifort?
> The obvious one that I can think of is that gfortran is free and open
> source, while ifort is proprietary and only gratis for non-commercial
> use, which does not include academic use.

I think that summaries the most obvious differences.

> Any other highlights? Does
> one have better standard compliance? Is one faster? Anything else I
> should know?

I think both compilers are relatively similar - aiming at being general
purpose compilers. In terms of Fortran 2003/2008 support [1], ifort is
slightly ahead but also not much. Similarly in terms of performance: for
the Polyhedron benchmark I find that ifort is about 1.5% faster
(geometric mean) on a Core2, though for single benchmarks ifort needs
between 170% and 49% of gfortran's run time [2]. Hence, it really
depends on the program.

If you are eligible for the non-commercial licence - or have for other
reasons a licence, I would recommend to install both. That way you can
find out which compiler is faster for your program. And as a developer,
having multiple compilers helps to find programming bugs as the
compile-time and run-time diagnostic catches different problems.
Actually, in the latter case, you could consider to install even more
compilers (g95, Sun [free on Linux/Solaris], Open64, ...).

Tobias

Disclaimer: I work on the gfortran compiler in my spare time

[1] Cf. ACM Fortran Forum or the wiki pages at
http://fortranwiki.org/fortran/show/Fortran+2003+status and
http://fortranwiki.org/fortran/show/Fortran+2008+status
[2] Benchmark
http://users.physik.fu-berlin.de/~tburnus/gcc-trunk/benchmark/iff/ ; The
"IMF" columns use Intel's math library libimf.so.

Arjan

unread,
Nov 14, 2010, 10:48:21 AM11/14/10
to
> reasons a licence, I would recommend to install both. That way you can
> find out which compiler is faster for your program. And as a developer,
> having multiple compilers helps to find programming bugs as the
> compile-time and run-time diagnostic catches different problems.
> Actually, in the latter case, you could consider to install even more
> compilers (g95, Sun [free on Linux/Solaris], Open64, ...).


Totally agree with this! The more the merrier!

For my application ifort is substantially faster than gfortran,
but this may be a coincidence.

Arjan

Daniel Carrera

unread,
Nov 14, 2010, 11:19:54 AM11/14/10
to
Hi Tobias,

Thanks. That was very informative. In summary: (1) A priori there is
no speed difference between ifort and gfortran, either could be faster
depending on the program. (2) Having multiple compilers is good
anyway, because it helps you find bugs.

Sounds good. I'll install ifort. I won't install the Sun compiler
because they want too much personal information. They want my phone
number, job title, company name, and complete mailing address, and I
think that's none of their business.

I didn't know about g95. Is there a particular reason why there are
two FOSS fortran compilers? Hmm... g95 appears to be a one-man
effort...

Cheers,
Daniel.

Tim Prince

unread,
Nov 14, 2010, 11:25:08 AM11/14/10
to
ifort is capable of better auto-vectorization for loops involving a
large number of arrays, and for cases which need the special directives,
such as VECTOR ALIGNED, or the new SIMD. Default compilation options are
not at all comparable, so require study in both cases.
Disclaimer: I have work-related responsibility for promoting ifort, but
can state only personal opinions.

--
Tim Prince

Daniel Carrera

unread,
Nov 14, 2010, 12:46:21 PM11/14/10
to
On Nov 14, 5:19 pm, Daniel Carrera <dcarr...@gmail.com> wrote:
> I didn't know about g95. Is there a particular reason why there are
> two FOSS fortran compilers? Hmm... g95 appears to be a one-man
> effort...

I think I found the answer to my question: http://gcc.gnu.org/wiki/TheOtherGCCBasedFortranCompiler

Cheers,
Daniel.

Arjan

unread,
Nov 14, 2010, 12:58:04 PM11/14/10
to
> > I didn't know about g95. Is there a particular reason why there are
> > two FOSS fortran compilers? Hmm... g95 appears to be a one-man
> > effort...


Though g95 does not yield the fastest code, I particularly like its
feedback in compilation. Many errors I eliminated in an early phase
were reported only by g95.

@Tim: Thanks for the explanation. You won't hear me complain about
ifort! One exception: there is no free ifort for Windows, which is the
only OS I have at home...

Arjan

Olivier Marti

unread,
Nov 14, 2010, 1:40:02 PM11/14/10
to
Arjan <arjan.v...@rivm.nl> wrote:

> > reasons a licence, I would recommend to install both. That way you can
> > find out which compiler is faster for your program. And as a developer,
> > having multiple compilers helps to find programming bugs as the
> > compile-time and run-time diagnostic catches different problems.
> > Actually, in the latter case, you could consider to install even more
> > compilers (g95, Sun [free on Linux/Solaris], Open64, ...).
>
>
> Totally agree with this! The more the merrier!

Not totally sure : if you need to install some software librairies, that
means that you need to compile them with both compilers, and install
them in different directories, etc ... Might bring a few complications.

Nevertheless, using several compilers is very useful to find bugs,
non-conformance to standards, etc ...

>
> For my application ifort is substantially faster than gfortran,
> but this may be a coincidence.
>
> Arjan

Olivier

Gib Bogle

unread,
Nov 14, 2010, 4:02:50 PM11/14/10
to

On the kinds of programs I run ifort is usually about 30% faster than gfortran.

Tobias Burnus

unread,
Nov 14, 2010, 4:42:33 PM11/14/10
to
Gib Bogle wrote:
>> For my application ifort is substantially faster than gfortran,
>> but this may be a coincidence.
>>
>
> On the kinds of programs I run ifort is usually about 30% faster than
> gfortran.

For curiosity, which version of gfortran and which options are you
using? The result of ifort being 1.5% (on geometric average) faster was
with GCC 4.6 and the options:

gfortran -march=native -ffast-math -funroll-loops -flto -fwhole-program
-fno-protect-parens -O3

And the Intel Fortran Compiler, version 11.1, with the options
ifort -O3 -xHost -ipo -ip


In case of single precision, x86-64 CPU and Linux, I would also be
interested in the Linux distribution.*

Tobias

* The not-modified GLIBC's libm has very some slow math functions (e.g.
for the trigonometric functions) in single precision on x86-64 (AMD64,
Intel64); the double-precision functions are much faster. There are
patches for x86-64 which make single-precision calculation as fast or a
bit faster than the double-precision functions, but only few Linux
distributions ship with those.

Gib Bogle

unread,
Nov 14, 2010, 5:12:38 PM11/14/10
to

Hi Tobias,

I haven't gone into this in any detail. With ifort I typically use -Oy or -O3,
while with gfortran I use -O3. This is all Windows. gfortran was build with
GCC 4.4.4. Most of what I do is single precision, and is not very
floating-point intensive.

Gib

Sebastian Rooks

unread,
Nov 14, 2010, 6:48:14 PM11/14/10
to

It does have a nice IDE on Windows though :-) to make up for it.

What is an IDE which plays nice with g95/gfortran, and is good?

Sebastian

Daniel Carrera

unread,
Nov 14, 2010, 7:00:29 PM11/14/10
to
On Nov 15, 12:48 am, Sebastian Rooks <sebastian_ro...@at.lavabit.com>
wrote:

> It does have a nice IDE on Windows though :-) to make up for it.
>
> What is an IDE which plays nice with g95/gfortran, and is good?
>
> Sebastian

I just use the command line on Linux. I find that easy and convenient.
My editor ("IDE") is Geany, which supports gfortran (or any compiler)
but I still find it more convenient to write a Makefile with various
targets.

Daniel.

Paul van Delst

unread,
Nov 15, 2010, 1:32:38 PM11/15/10
to
Hello,

Tobias Burnus wrote:
> Daniel Carrera wrote:
>> I'm quite new at Fortran, I hope this isn't a stupid question. Can
>> someone summarize the pros and cons of gfortran vs ifort?
>> The obvious one that I can think of is that gfortran is free and open
>> source, while ifort is proprietary and only gratis for non-commercial
>> use, which does not include academic use.
>

> I would recommend to install both.

Seconded.

The pro of gfortran is: it isn't ifort. The pro of ifort is: it isn't gfortran.

My response may sound flippant, but it isn't meant to be. We have machines with a bunch of different compilers for
testing, e.g. gfortran, g95, ifort, pgi. For some applications, I test down to numerical precision. I've found it quite
rare for different compilers to yield the same results at that level (crikey, even with the same compiler but with
different compilation switches).

> Disclaimer: I work on the gfortran compiler in my spare time

Really? Your *spare* time? I subscribe to the gfortran mailing list and all I can say is, man, you must be
super-efficient with your time management. :o)

cheers,

paulv

Gib Bogle

unread,
Nov 15, 2010, 3:18:15 PM11/15/10
to

Code::Blocks

Adrien Haxaire

unread,
Nov 16, 2010, 4:41:08 AM11/16/10
to

> > What is an IDE which plays nice with g95/gfortran, and is good?

I also like makefiles and command line compilations. And I'm using
emacs.

I also think that having ifort and gfortran is a good idea. Unless you
have very specific needs, both of them will do the same job. and
you'll know them both, which is a good asset.


Ian

unread,
Nov 16, 2010, 9:20:51 AM11/16/10
to
Hi

sunstudio is free for linux. it has suns fortran 95 compiler built in.

have a look at

http://www.oracle.com/technetwork/server-storage/solarisstudio/overview/index.html

we wrote a short article on it for
the April 2009 edition of Fortran Forum.

http://portal.acm.org/citation.cfm?id=J286&CFID=111217228&CFTOKEN=61147801

we (Jane Sleightholme and I) use the following linux compilers

gfortran
g95
nag
sun

we use the following windows compilers

gfortran
g95
intel
nag

we try to develop with as many compilers
as we can.

we've also got the folowing 'older' compilers

cvf - intels previous compiler.
salford/silverfrost - not very actively developed any more
absoft - we have an earlier release.


our fortran home page is

http://www.fortranplus.co.uk/

hope this is of some use.

ian chivers

On Nov 14, 11:48 pm, Sebastian Rooks <sebastian_ro...@at.lavabit.com>
wrote:


> On Sun, 14 Nov 2010 09:58:04 -0800 (PST), Arjan
>

tho...@antispam.ham

unread,
Nov 17, 2010, 9:48:42 AM11/17/10
to
Ian <ian_d_...@yahoo.co.uk> writes:

> our fortran home page is
>
> http://www.fortranplus.co.uk/

Is that in any way related to the Fortran compiler that
NA Software used to sell? They called it Fortran Plus.

Daniel Carrera

unread,
Nov 18, 2010, 5:09:05 AM11/18/10
to
On Nov 15, 7:32 pm, Paul van Delst <paul.vande...@noaa.gov> wrote:
> The pro of gfortran is: it isn't ifort. The pro of ifort is: it isn't gfortran.
>
> My response may sound flippant, but it isn't meant to be. We have machines with a bunch of different
> compilers for testing, e.g. gfortran, g95, ifort, pgi.

Is g95 different enough from gfortran that it is worth installing?
Also, I thought g95 often had installation conflicts with gfortran.

Btw, I've installed ifort on my computer and I've been using it to
double check my work. It's been interesting. I've seen ifort reject
some things that gfortran accepts, like a "rand(0)" call inside a pure
function, which I now know is not part of the F95 standard. I'm
slightly annoyed that ifort won't compile a program with the .f95
extension. You have to use .f90, but my programs use F95 features.


Daniel.

Les Neilson

unread,
Nov 18, 2010, 7:23:56 AM11/18/10
to

"Daniel Carrera" <dcar...@gmail.com> wrote in message
news:c8ac9673-b253-4a04...@q14g2000yqe.googlegroups.com...


The file extension does NOT indicate the Fortran standard number but
distinguishes between fixed format and free format source.
On Windows it is possible to add the f95 file extension to the list of "free
format" source files. I don't know about *nix

Les

Daniel Carrera

unread,
Nov 18, 2010, 7:50:34 AM11/18/10
to
On Nov 18, 1:23 pm, "Les Neilson" <l.neil...@nospam.co.uk> wrote:
> The file extension does NOT indicate the Fortran standard number but
> distinguishes between fixed format and free format source.

I knew that, but I still like to call them .f95 if I can.

> On Windows it is possible to add the f95 file extension to the list of "free
> format" source files. I don't know about *nix

The documentation seems to say that yes, you can, but I cannot find
any documentation that explains how. I found the config file, and it's
blank. I have no idea what to put in it to make ifort accept .f95 as a
valid extension. :-(

Daniel.

dpb

unread,
Nov 18, 2010, 9:05:10 AM11/18/10
to

I'd still recommend against the nomenclature of anything other than f90
for free form source files. It's simply a technique for creating grief
(as you're discovering) and will cause even more consternation and
confusion w/ compilers as you move to features contained in later
Standard(s)...

--

Daniel Carrera

unread,
Nov 18, 2010, 12:23:31 PM11/18/10
to
On Nov 18, 3:05 pm, dpb <n...@non.net> wrote:
> I'd still recommend against the nomenclature of anything other than f90
> for free form source files.  It's simply a technique for creating grief
> (as you're discovering) and will cause even more consternation and
> confusion w/ compilers as you move to features contained in later
> Standard(s)...

Ok. You're the expert. I'll follow your advice.

Daniel.

reubendb

unread,
Nov 18, 2010, 12:26:02 PM11/18/10
to

Add the command line option "-free -Tf" before the sourcefile.f95.

dpb

unread,
Nov 18, 2010, 12:39:59 PM11/18/10
to
...

As another poster indicated, you can always force the compiler of choice
to treat any file as free or fixed source form, but my view is why make
additional effort required when it isn't?

As for there being some configuration file option w/ any specific
compiler, whether or how such is implemented will be compiler-dependent
so again, one will have to deal with that nuance any time one switches
or uses an alternate compiler. Of course, virtually all compilers will
use an OS environment variable as a way to set compiler options that one
wants fixed to avoid them on every command line, but again the choice of
which variable specifically is compiler dependent. Why add the
complication?

--

Terence

unread,
Nov 18, 2010, 4:25:17 PM11/18/10
to
> Daniel Carrera wrote:
(snipped)

I use MSDOS a great deal, and so use Windows and Fortran compilers
that run on Windows versions that support MSDOS (which NP and Vista
don't - they just pretend to; and version 7 only gets an approximation
of DOS full screen neded for Window simulations and behaviour).

So I have a licenced CVF 6.6C Fortran compiler (which does what I want
and well) and then bought the later Intel ifort as an intended
upgrade, but could not get it to install and run on the Windows NT
professional 2000, or Windows 95 computers I use (as per above). Nor
was there (note: at that time anyway) any real attempt to help me find
what the problem was within the guarantee time; and any replies were
not in good English.

Explanation of MSDOS: with Fortran-compiled text parser programs, I
need to be able to switch languages via text modules and alpahabets
which I can do easiy in MSDOS; far less so in native windows and
cannot go to two-byte coding.

Even on a Macintosh I get accurate MSDOS support.

dpb

unread,
Nov 18, 2010, 6:07:27 PM11/18/10
to
Terence wrote:
...

> Explanation of MSDOS: with Fortran-compiled text parser programs, I
> need to be able to switch languages via text modules and alpahabets
> which I can do easiy in MSDOS; far less so in native windows and
> cannot go to two-byte coding.
>
> Even on a Macintosh I get accurate MSDOS support.

What does any of this have to do w/ the choice of file name extension
for automagic recognition of free/fixed-source form by a compiler?

I'm cornfoozed...

--

Steve Lionel

unread,
Nov 22, 2010, 2:07:21 PM11/22/10
to
On 11/14/2010 10:06 AM, Daniel Carrera wrote:
> Hello,

>
> I'm quite new at Fortran, I hope this isn't a stupid question. Can
> someone summarize the pros and cons of gfortran vs ifort?

Daniel,

I don't have much to add to the comments already given here, but would
like to point you at:

http://software.intel.com/en-us/articles/intel-fortran-compiler-support-for-fortran-language-standards/
- a list of the Fortran 2003 and 2008 features supported by the current
Intel Fortran compiler

http://software.intel.com/en-us/forums/intel-fortran-compiler-for-linux-and-mac-os-x/
- Our user forum for Intel Fortran on Linux and Mac OS - this is a great
place to ask questions about the Intel compiler and to report suspected
problems

--
Steve Lionel
Developer Products Division
Intel Corporation
Merrimack, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Software Development Products Support
http://software.intel.com/sites/support/
My Fortran blog
http://www.intel.com/software/drfortran

Refer to http://software.intel.com/en-us/articles/optimization-notice
for more information regarding performance and optimization choices in
Intel software products.

Daniel Carrera

unread,
Nov 22, 2010, 4:54:02 PM11/22/10
to
Hi Steve,

On Nov 22, 8:07 pm, Steve Lionel <steve.lio...@intel.invalid> wrote:
> Daniel,
>
> I don't have much to add to the comments already given here, but would
> like to point you at:
>

> http://software.intel.com/en-us/articles/intel-fortran-compiler-suppo...
> ...
> http://software.intel.com/en-us/forums/intel-fortran-compiler-for-lin...
> ...


Thanks for the links.


If I may ask a totally unrelated question... I took a look at your
blog:

Says you do "evangelizing". That caught my attention. What do you mean
by that? Is it mainly your Fortran blog (which looks very
interesting)?

Cheers,
Daniel.

Steve Lionel

unread,
Nov 22, 2010, 9:32:39 PM11/22/10
to
On 11/22/2010 4:54 PM, Daniel Carrera wrote:

> If I may ask a totally unrelated question... I took a look at your
> blog:
>
>> My Fortran blog
>> http://www.intel.com/software/drfortran
>
> Says you do "evangelizing". That caught my attention. What do you mean
> by that? Is it mainly your Fortran blog (which looks very
> interesting)?

That's just a small part of it. I am, the way we say it, "the public
face of Intel Fortran" (just as I was for Compaq and Digital Fortran in
years gone by.) That means I blog (my "Doctor Fortran" column actually
predates the blog era), I participate in forums such as this one, I am
active in our user forums, I talk to customers (and potential
customers), and serve as a resource on all things Fortran for Intel
sales, marketing and development. Oh, and my real job is as a member of
Intel's compiler support team. (I was a developer for 24 years.)

It doesn't hurt that I've been involved with Fortran products for 32
years and I'm also an alternate for Intel to the Fortran standards
committee.

This is not to say that I'm the only one Intel has knowledgeable on
Fortran, far from it, but I like doing this and my bosses have all been
pretty happy with the results so far. I work with a couple of guys who
have been at it longer than I have, going back to the DEC-10 and DEC-20,
but they are more than happy for me to take the arrows in public.

Of course I try to promote our Fortran products - for example, I just
returned from Supercomputing '10 where I spoke about our coarray
implementation - but I also promote the Fortran language wherever I can.

Most vendors have someone who does much of what I do - and I've gotten
to know many of them over the years. Styles vary, but we all love
Fortran and want our customers to be happy.

--
Steve Lionel
Developer Products Division
Intel Corporation
Merrimack, NH

For email address, replace "invalid" with "com"

User communities for Intel Software Development Products
http://software.intel.com/en-us/forums/
Intel Software Development Products Support
http://software.intel.com/sites/support/

Refer to http://software.intel.com/en-us/articles/optimization-notice

Jan Gerrit Kootstra

unread,
Nov 23, 2010, 3:19:49 PM11/23/10
to
Steve Lionel schreef:
Steve,


I would say keep evangelizing. We still have not heard all of what there
is to say about Fortran.

As a master in Applied Mathematics I still have a lot to learn about
past Fortran 77 features.


Kind regards,


ir. Jan Gerrit Kootstra

kaffel07

unread,
Jun 27, 2012, 9:23:32 PM6/27/12
to
Dear All,

I would like to use intel ifort command in linux. Could you please help me how to download it for free?

thanks

Ahmed


kaffel07

unread,
Jun 27, 2012, 9:24:48 PM6/27/12
to

Hi everyone

Could you please help me what should I install to use ifort intel command in linux?

Thanks,
Ahmed


e p chandler

unread,
Jun 27, 2012, 10:07:49 PM6/27/12
to
> I would like to use intel ifort command in linux. Could you please help
> me how to download it for free?

Try a web search on "intel fortran compiler non-commercial linux". What
appears near the top should help you almost immediately.

- e


0 new messages