For Programmers: Free Programming Magazines  


Home > Archive > Fortran > May 2005 > gprof and optimization









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author gprof and optimization
Jean-Baptiste FAURE

2005-05-26, 3:59 pm

Dear all,

I have a curious problem with my code using gprof profiler with g95 compiler :
if I compile using -pg option the code run faster, iterative computations are
more stable (less iterations) and results are different. The other options are
-O3 -malign-double -march=pentium4m.

I don't know where I can search, compiler options, optimization, in the source
code ?

Any idea ?

JBF
Andy Vaught

2005-05-26, 9:00 pm

On Thu, 26 May 2005, Jean-Baptiste FAURE wrote:

> Dear all,
>
> I have a curious problem with my code using gprof profiler with g95
> compiler : if I compile using -pg option the code run faster,
> iterative computations are more stable (less iterations) and results
> are different. The other options are -O3 -malign-double
> -march=pentium4m.
>
> I don't know where I can search, compiler options, optimization, in
> the source code ?


I've noticed that -O2 is often faster than -O3 with g95. Clearly what
is happening in your situation is that the profiling hooks are changing
the program (surprisingly) to make it faster. I would have to say this is
due to the relatively new gcc backend. The version currently being used
is only a month or two old, so I wouldn't expect dramatic improvements.

I would be concerned about how different the results are and the
stability of the algorithms involved. Ideally, things should converge to
the same thing.

Andy


Jean-Baptiste FAURE

2005-05-27, 8:57 am

Le 27/05/2005 01:15, Andy Vaught a écrit :
> On Thu, 26 May 2005, Jean-Baptiste FAURE wrote:
>
>
>
>
> I've noticed that -O2 is often faster than -O3 with g95. Clearly what
> is happening in your situation is that the profiling hooks are changing
> the program (surprisingly) to make it faster. I would have to say this is
> due to the relatively new gcc backend. The version currently being used
> is only a month or two old, so I wouldn't expect dramatic improvements.
>
> I would be concerned about how different the results are and the
> stability of the algorithms involved. Ideally, things should converge to
> the same thing.
>
> Andy
>
>

I am very sorry. I have done a new clean installation of g95 in MinGW directory
and now all works fine, compilation with or without -pg option produces codes
which give same results and consume almost the same time, pg option being very
little less fast.

So it seems very important to install last mingw versions of g95 in mingw
directory as proposed by installer.

JBF
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2009 codecomments.com