This is the mail archive of the fortran@gcc.gnu.org mailing list for the GNU Fortran 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: -ffast-math and gfortran


On Sun, Jun 04, 2006 at 05:55:00PM -0400, Iwan Kawrakow wrote:
> On Sunday 04 June 2006 17:43, Steve Kargl wrote:
> > On Sun, Jun 04, 2006 at 05:37:55PM -0400, Iwan Kawrakow wrote:
> > > 
> > >> What bothers me about all this discussion on -ffast-math is
> > >> what is the driver for using it?  What is the percentage gain
> > >> in execution speed?  Is it really that important that a
> > >> computation gets done in 30 minutes rather than 35 minutes?
> > >> 
> > >
> > > my group spends on average ~$20k/year to keep our computing
> > > cluster up do date. -ffast-math gives ~10% faster execution for
> > > our type of problem (Monte Carlo simulation of coupled electron-
> > > photon transport). I.e., -ffast-math is worth ~$2000/year to us.
> > > 
> > 
> > How much are correct answer worth?
> >
> Correct answer meaning what?

As oppose to a wrong answer.

> A Monte Carlo-computed answer is subject to statistical 
> uncertainty. For our time of problem it takes a *very* long time to 
> obtain an uncertainty of better than, say, 0.01% (i.e. one part in 10000).
> Naturally, we have verified that our codes produce the same 
> results with and without -ffast-math within the statistical uncertainties.

I do some Monte Carlo work myself.  There is a clear difference
between statistical uncertainty and a wrong answer for the result
of any single realization.  Of course, I allow the physics to guide
my understanding of uncertainty and wrong answer.

> Not using -ffast-math is of course handy and necessary while 
> developing a code. Apart from that,  I personally think that
> a program that does not work with -ffast-math is broken, not the
> other way around. 

Go back in the thread and see the very simple program I wrote.
It is well-behaved without -ffast-math but generates NaNs with
this option.  Apparently, you do not use complex data types.
Or, do you expand all multiplications and divisions into the
well-known numerically stable algorithms?  

> Or do you think that people could bot compute 
> anything with their computers before the IEEE came along and invented 
> a standard of how math functions should behave?

This is a red herring.  I never wrote anything about IEEE.
Of course, people could do computations before IEEE.
-ffast-math has absolutely nothing to do with IEEE.  It is
concerned with potential unsafe mathematical transformations
or numerically faster but less stable algorithms.  Indeed,
IEEE has nothing to say about complex arithmetic.

The fact that -ffast-math works for you is great. Now, can
you tell me what transformations and algorithms that -ffast-math
triggers?


-- 
Steve


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