This is the mail archive of the
fortran@gcc.gnu.org
mailing list for the GNU Fortran project.
Re: GNU FORTRAN implementation v4.3.2
- From: Tobias Burnus <burnus at net-b dot de>
- To: "Fuentes, Adolfo" <A dot Fuentes at liverpool dot ac dot uk>
- Cc: "fortran at gcc dot gnu dot org" <fortran at gcc dot gnu dot org>
- Date: Mon, 22 Feb 2010 11:56:05 +0100
- Subject: Re: GNU FORTRAN implementation v4.3.2
- References: <DEBB97EA3EEF8E489B88CEFA9B3F36E255F22E6784@STAFFMBX2.livad.liv.ac.uk>
On 02/22/2010 10:20 AM, Fuentes, Adolfo wrote:
> I'm trying to compile the file <nbody.f90> from <http://shootout.alioth.debian.org/> [The Computer Language Benchmarks Game]
I could not find the source code there; I have now used:
http://people.brunel.ac.uk/~eesridr/nbody.f90
http://go.googlecode.com/hg/test/bench/nbody.c
I do not know whether they a match the latest code at s.a.d.o.
> The problem I've got is that when I compile the file with GNU FORTRAN 95 4.3.2-1-1 and G95 FORTRAN 0.91, and the options shown below, the difference in computing time between the binaries created by both compilers is huge.
No real idea - here the differences are relatively small. Tested on AMD
Athlon(tm) 64 X2 Dual Core Processor 4800+ with GCC (gcc, gfortran) 4.5
of today and with ifort 11.1.046.
ifort is 5% faster than gfortran and gfortran is about 6% faster than
gcc; those differences are too small to draw a real conclusion -
especially not about Fortran vs. C.
$ gcc -march=native -O3 -ffast-math -flto -fwhole-program nbody.c -lm
$ time ./a.out 50000000
-0.169075164
-0.169059907
real 0m22.357s
user 0m21.885s
sys 0m0.000s
$ gfortran -march=native -O3 -ffast-math -flto -fwhole-program
-fno-protect-parens nbody.f90
$ time ./a.out 50000000
-0.169075164
-0.169059907
real 0m21.005s
user 0m20.217s
sys 0m0.004s
$ ifort -fast -O3 nbody.f90
$ time ./a.out 50000000
-0.169075164
-0.169059907
real 0m19.912s
user 0m19.237s
sys 0m0.012s
Tobias