public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* Re: Somewhat OT: gcc, x86, -ffast-math, and Linux
@ 2004-03-27 14:48 Nick Warne
  0 siblings, 0 replies; 8+ messages in thread
From: Nick Warne @ 2004-03-27 14:48 UTC (permalink / raw)
  To: linux-kernel

I had very funny results building a Quake2 MOD I am coder on (Quake2 
dday).

Using -ffast-math made the HMG (e.g.) fire off aim by say 25º.  Do a 
recompile with NO code change, and the HMG would be OK... but then 
the pistol starting firing all over the show.  Do another rebuild (NO 
code change) and then the rifle showed this... etc. etc.

Every new build produced a different result, although the code was 
untouched.

I had to build leaving `--fast-math' option out in the end to get it 
to work correctly.

Maybe bad coding here, but what I didn't understand was why the 
result was so random (like each weapon has it's own code - so why one 
routine worked then after a rebuild didn't and vice versa, I don't 
know).

Nick
(Not subscribed to list).

-- 
"When you're chewing on life's gristle,
Don't grumble, Give a whistle..."


^ permalink raw reply	[flat|nested] 8+ messages in thread
* Somewhat OT: gcc, x86, -ffast-math, and Linux
@ 2004-03-26 20:54 Daniel Forrest
  2004-03-26 21:26 ` Richard B. Johnson
                   ` (4 more replies)
  0 siblings, 5 replies; 8+ messages in thread
From: Daniel Forrest @ 2004-03-26 20:54 UTC (permalink / raw)
  To: linux-kernel

I've tried Googling for an answer on this, but have come up empty and
I think it likely that someone here probably knows the answer...

We are testing and breaking in 6 racks of compute nodes, each rack
containing 30 1U boxes, each box containing 2 x 2.8GHz Xeon CPUs.
Each rack contains identical hardware (single purchase) with the
exception that one rack has double the memory per node.  The 6 racks
are located in six different labs across our campus.  It is available
to me only as a "black box" queueing system.

I am running one of our applications that has been compiled using gcc
with the -ffast-math option.  I am finding that the identical program
using the same input data files is producing different results on
different machines.  However, the differences are all less than the
precision of a single-precision floating point number.  By this I mean
that if the results (which are written to 15 digits of precision) are
only compared to 7 digits then the results are the same.  Also, most
of the time the 15 digit values are the same.

My question is this: Why aren't the results always the same?  What is
the -ffast-math option doing?  How are the excess bits of precision
dealt with during context switches?  Shouldn't the same binary with
the same inputs produce the same output on identical hardware?

I have run the same test with the program compiled without -ffast-math
enabled and the results are always identical.

Any insight would be appreciated.

-- 
Daniel K. Forrest	Laboratory for Molecular and
forrest@lmcg.wisc.edu	Computational Genomics
			University of Wisconsin, Madison

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2004-03-31  7:15 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-03-27 14:48 Somewhat OT: gcc, x86, -ffast-math, and Linux Nick Warne
  -- strict thread matches above, loose matches on Subject: below --
2004-03-26 20:54 Daniel Forrest
2004-03-26 21:26 ` Richard B. Johnson
2004-03-26 21:45 ` Andy Isaacson
2004-03-27 14:24 ` Jamie Lokier
2004-03-27 15:13   ` Jakub Jelinek
2004-03-29  8:47 ` Eric W. Biederman
2004-03-31  7:14 ` J.A. Magallon

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox