new to gfortran & comparison with g77

Erik Schnetter schnetter@aei.mpg.de
Tue Feb 1 17:00:00 GMT 2005


On Tuesday 01 February 2005 17:14, Philippe Depondt wrote:
> Hello,
>
>   well I'm new to gfortran and have done some comparisons with g77 on
> a (Red-Hat)Linux system.
>
> the results are the following :
>
> free-form f77 code compiled with g77 (g77 -ffree-form -O
> chaine_pendul.f -o chaine_pendul)
> executable file size (as given by ls -l) : 7733
> execution time (time chaine_pendul) real 2.950s, user 2.9275s, sys
> 0.0007s
>
> same code compiled with gfortran (gfortran -ffree-form -0
> chaine_pendul.f -o chaine_pendul)
> executable file size : 665192
> execution time : real 3.672s, user 3.204s, sys 0.468s
>
> f90-style code compiled with gfortran (gfortran -O chain_pendul.f90
> -o chaine_pendul)
> executable file size : 663058
> execution time : real 3.860s, user 3.286s, sys 0.574s
>
> These results tend to make me believe I've got something wrong
> here... Any idea what ?
> I've downloaded the i686 linux binaries from gfortran.org and started
> compiling and that's about it.

There are several things that could be wrong:

1. Are you using different versions of compilers?  It often does not 
make sense to compare different versions of compilers, because they 
have different features.

2. If you compare executable sizes, the standard way of doing so is 
using the "size" command, not ls.  Furthermore, executables are usually 
not loaded completely into memory when they are run.  Additionally, if 
you run them a second time, they will be in a cache and not loaded 
again.  Try running a few times, and look at the median values.

3. Are you producing a lot of screen output?  If so, maybe you measure 
only the performance of your xterm.  Try without screen output.

4. If you want to know where the time is spent, then you should use a 
profiler.  Look at the option "-pg" of gcc.

5. If you want to optimise for speed, then "-O" is probably not the 
right thing to do.  Optimising for speed is not trivial.  Try enabling 
switches that produce code specific to your architecture (the -f and -m 
switches).

-erik

-- 
Erik Schnetter <schnetter@aei.mpg.de>   http://www.aei.mpg.de/~eschnett/

My email is as private as my paper mail.  I therefore support encrypting
and signing email messages.  Get my PGP key from www.keyserver.net.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/fortran/attachments/20050201/d6791554/attachment.sig>


More information about the Fortran mailing list