Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.* 1 > Newsgroup comp.lang.fortran

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 11-14-2010, 02:06 PM
Daniel Carrera
Guest
 
Posts: n/a
Default gfortran or ifort?

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.
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

  #2 (permalink)  
Old 11-14-2010, 02:26 PM
Tobias Burnus
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

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/~tb...benchmark/iff/ ; The
"IMF" columns use Intel's math library libimf.so.
Reply With Quote
  #3 (permalink)  
Old 11-14-2010, 02:48 PM
Arjan
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

> 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
Reply With Quote
  #4 (permalink)  
Old 11-14-2010, 03:19 PM
Daniel Carrera
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

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.
Reply With Quote
  #5 (permalink)  
Old 11-14-2010, 03:25 PM
Tim Prince
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

On 11/14/2010 7:48 AM, Arjan 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!
>
> For my application ifort is substantially faster than gfortran,
> but this may be a coincidence.
>
> Arjan

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
Reply With Quote
  #6 (permalink)  
Old 11-14-2010, 04:46 PM
Daniel Carrera
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

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.
Reply With Quote
  #7 (permalink)  
Old 11-14-2010, 04:58 PM
Arjan
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

> > 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
Reply With Quote
  #8 (permalink)  
Old 11-14-2010, 05:40 PM
Olivier Marti
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

Arjan <arjan.van.dijk@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
Reply With Quote
  #9 (permalink)  
Old 11-14-2010, 08:02 PM
Gib Bogle
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

On 15/11/2010 4:48 a.m., Arjan 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!
>
> For my application ifort is substantially faster than gfortran,
> but this may be a coincidence.
>
> Arjan


On the kinds of programs I run ifort is usually about 30% faster than gfortran.
Reply With Quote
  #10 (permalink)  
Old 11-14-2010, 08:42 PM
Tobias Burnus
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

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.
Reply With Quote
  #11 (permalink)  
Old 11-14-2010, 09:12 PM
Gib Bogle
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

On 15/11/2010 10:42 a.m., Tobias Burnus wrote:
> 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.


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
Reply With Quote
  #12 (permalink)  
Old 11-14-2010, 10:48 PM
Sebastian Rooks
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

On Sun, 14 Nov 2010 09:58:04 -0800 (PST), Arjan
<arjan.van.dijk@rivm.nl> 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...

>
>
>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


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
Reply With Quote
  #13 (permalink)  
Old 11-14-2010, 11:00 PM
Daniel Carrera
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

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.
Reply With Quote
  #14 (permalink)  
Old 11-15-2010, 07:18 PM
Gib Bogle
Guest
 
Posts: n/a
Default Re: gfortran or ifort?

On 15/11/2010 12:48 p.m., Sebastian Rooks wrote:
> On Sun, 14 Nov 2010 09:58:04 -0800 (PST), Arjan
> <arjan.van.dijk@rivm.nl> 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...

>>
>>
>> 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

>
> 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?


Code::Blocks
Reply With Quote
  #15 (permalink)  
Old 11-16-2010, 08:41 AM
Adrien Haxaire
Guest
 
Posts: n/a
Default Re: gfortran or ifort?


> > 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.


Reply With Quote
 
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off




All times are GMT. The time now is 10:09 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.