View previous topic :: View next topic |
Author |
Message |
neuron Advocate
Joined: 28 May 2002 Posts: 2371
|
Posted: Fri Aug 02, 2002 7:44 pm Post subject: -ffast-math |
|
|
needs to be stripped from the ntp package, building my entire system with that flag now (and a few others, specificaly -march=athlon-xp -m3dnow -mmmx -msse -mfpmath=sse -fomit-frame-pointer -O3 -pipe -falign-functions=4 -ffast-math), so far I'v actually not had problems with -ffast-math, and I'v got X running with my favorite apps just fine
(for those who doesen't know, it's a quite nice performance increase). |
|
Back to top |
|
|
Niek Apprentice
Joined: 14 May 2002 Posts: 236 Location: Houten, The Netherlands
|
Posted: Sat Aug 03, 2002 10:23 am Post subject: |
|
|
I think -ffast-math is not a very save option to compile your system with. This is noted in the GCC docs (http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Optimize-Options.html#Optimize%20Options) about -ffast-math:
Code: | -ffast-math
Sets -fno-math-errno, -funsafe-math-optimizations, and
-fno-trapping-math.
This option causes the preprocessor macro __FAST_MATH__ to be defined.
This option should never be turned on by any -O option since it can result in incorrect output for programs which depend on an exact implementation of IEEE or ISO rules/specifications for math functions. |
|
|
Back to top |
|
|
neuron Advocate
Joined: 28 May 2002 Posts: 2371
|
Posted: Sat Aug 03, 2002 12:18 pm Post subject: |
|
|
I know it's not, but the amount of times it fails is very low to my experience, and the performance gain is great, if anything crashes I recompile without -ffast-math, but it doesen't, the system is stable |
|
Back to top |
|
|
echeslack Tux's lil' helper
Joined: 21 Jul 2002 Posts: 131 Location: NJ, USA
|
Posted: Sat Aug 03, 2002 6:19 pm Post subject: |
|
|
it won't necessarily crash, it just may give incorrect results, which could be harmful for certain things. if you are just using the machine for regular day to day stuff, its probably not an issue. however, it can really screw things up if you, for instance, use the computer to do some calculations for research. a lot of people also do distributed computing projects which rely on math being done correctly. just because something runs doesn't mean it is running correctly.
-ewen |
|
Back to top |
|
|
asimon l33t
Joined: 27 Jun 2002 Posts: 979 Location: Germany, Old Europe
|
Posted: Sun Aug 04, 2002 9:27 am Post subject: |
|
|
neuron wrote: | I know it's not, but the amount of times it fails is very low to my experience, and the performance gain is great, if anything crashes I recompile without -ffast-math, but it doesen't, the system is stable |
The performance gain is great? Have you any numbers? |
|
Back to top |
|
|
neuron Advocate
Joined: 28 May 2002 Posts: 2371
|
Posted: Sun Aug 04, 2002 12:28 pm Post subject: |
|
|
nope, heard from a friend of mine , and I was reinstalling the system becouse I changed cpu, so no numbers. |
|
Back to top |
|
|
Malakin Veteran
Joined: 14 Apr 2002 Posts: 1692 Location: Victoria BC Canada
|
Posted: Tue Aug 06, 2002 10:58 pm Post subject: |
|
|
I installed my whole system with --fast-math back when gentoo first came out and I've never had a problem with it.
Some testing I did with a program I was working on showed significant speed increases using it. |
|
Back to top |
|
|
sibn n00b
Joined: 15 May 2002 Posts: 36
|
Posted: Thu Aug 15, 2002 8:30 pm Post subject: |
|
|
Niek wrote: | I think -ffast-math is not a very save option to compile your system with. This is noted in the GCC docs (http://gcc.gnu.org/onlinedocs/gcc-3.1/gcc/Optimize-Options.html#Optimize%20Options) about -ffast-math:
Code: | -ffast-math
Sets -fno-math-errno, -funsafe-math-optimizations, and
-fno-trapping-math.
This option causes the preprocessor macro __FAST_MATH__ to be defined.
This option should never be turned on by any -O option since it can result in incorrect output for programs which depend on an exact implementation of IEEE or ISO rules/specifications for math functions. |
|
Reread this, Niek. You have correctly quoted the gcc manual online, but you apparently have not noticed what it said: -ffast-math should never be enabled by a -O flag. It said nothing about enabling them with -O flags; it merely said that -O will not enable -ffast-math. I, for one, have used -O3 -ffast-math for a long time, and not had any problems (that I could detect) over it. _________________ Hey um, this is my signature. |
|
Back to top |
|
|
RayVan n00b
Joined: 12 Aug 2002 Posts: 40 Location: Houston, Tx
|
Posted: Fri Aug 16, 2002 4:11 pm Post subject: --fast-math and other optimizations |
|
|
--fast-math can and does cause errors, but as I understand it (can't remember where I read this) the errors it can create are only single-byte errors. IOW, your answer to a FP calculation /might/ be one least-signifigant digit off.
Unless you're doing important scientific calculations, you're probably never going to notice /or/ care. I would expect that any linux packages that would have a problem with this (ALSA, or GSL and the like) probably tell you not to use it if they don't like it.
Another optimization that gives good results on the Athlon is -funroll-loops. Despite the warning that it might not be a gain, on the Athlon it is because of the big instruction cache, and I have yet to find a single package that it bothers. |
|
Back to top |
|
|
rac Bodhisattva
Joined: 30 May 2002 Posts: 6553 Location: Japanifornia
|
Posted: Mon Aug 19, 2002 2:55 am Post subject: |
|
|
GCC3 to Gentoo Chat, turned into a discussion. _________________ For every higher wall, there is a taller ladder |
|
Back to top |
|
|
|