This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: GCC beaten by ICC in stupid trig test!


Roger Sayle wrote:
> I've heard it argued that people who are serious about floating point
> don't use -ffast-math.  I consider myself serious, and make a very nice
> living from selling software to solve finite-difference Poison-Boltzmann
> electrostatic calculations on regular grids, and molecular minimizations
> using quasi-newtonian numerical optimizers.  Toon does numerical weather
> forecasting, and he seems happy with -ffast-math.  Laurent performs large
> scale Monte-Carlo simulations, and he also seems happy with it.

I would like to add to this one more voice. We distribute our finite element 
code for some 5 years now, with >200 downloads a month. We haven't, ever, 
heard someone complain that we include -ffast-math in our flags for optimized 
builds. I have also not ever heard someone in the finite element community 
think about the effects of correctly treating NaN etc (if your PDE simulator 
generates NaNs, then you have a bug), or worrying about the order of 
execution of a+b+c. In fact, I most often use parenthesis to make code more 
readable, and never to force the order of evaluation in a+b+c. If you start 
to worry whether a+b+c is different than a+c+b, then a simulator must be so 
instable that any prediction it gives must necessarily be almost useless.

Frankly, it makes me angry if people here keep repeating that "any 
self-respecting numerical programmer can't possibly use -ffast-math and must 
necessarily know and care which way a+b+c is evaluated". I claim that this 
is, in almost all cases, wrong. This view is anal, I can't track the order of 
evaluation of operands in a program or a quarter million LOC. Please stop 
asserting these things.

If it were for me, then we should make -ffast-math the default with -O2, and 
allow for reassociating arguments by default. If by things like fused 
multiply-add we can save another 10%, then that's almost one day off my 
week-long computations! Those few who do care about these things are free to 
use the respective flags.

W.

-------------------------------------------------------------------------
Wolfgang Bangerth              email:            bangerth@ices.utexas.edu
                               www: http://www.ices.utexas.edu/~bangerth/


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]