Re: gprof and optimization



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


.



Relevant Pages

  • Re: gprof and optimization
    ... 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 and results ... 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. ...
    (comp.lang.fortran)
  • gprof and optimization
    ... 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 and results are different. ...
    (comp.lang.fortran)