Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
-ffast-math
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Gentoo Chat
View previous topic :: View next topic  
Author Message
neuron
Advocate
Advocate


Joined: 28 May 2002
Posts: 2371

PostPosted: Fri Aug 02, 2002 7:44 pm    Post subject: -ffast-math Reply with quote

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
View user's profile Send private message
Niek
Apprentice
Apprentice


Joined: 14 May 2002
Posts: 236
Location: Houten, The Netherlands

PostPosted: Sat Aug 03, 2002 10:23 am    Post subject: Reply with quote

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
View user's profile Send private message
neuron
Advocate
Advocate


Joined: 28 May 2002
Posts: 2371

PostPosted: Sat Aug 03, 2002 12:18 pm    Post subject: Reply with quote

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
View user's profile Send private message
echeslack
Tux's lil' helper
Tux's lil' helper


Joined: 21 Jul 2002
Posts: 131
Location: NJ, USA

PostPosted: Sat Aug 03, 2002 6:19 pm    Post subject: Reply with quote

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
View user's profile Send private message
asimon
l33t
l33t


Joined: 27 Jun 2002
Posts: 979
Location: Germany, Old Europe

PostPosted: Sun Aug 04, 2002 9:27 am    Post subject: Reply with quote

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
View user's profile Send private message
neuron
Advocate
Advocate


Joined: 28 May 2002
Posts: 2371

PostPosted: Sun Aug 04, 2002 12:28 pm    Post subject: Reply with quote

nope, heard from a friend of mine :), and I was reinstalling the system becouse I changed cpu, so no numbers.
Back to top
View user's profile Send private message
Malakin
Veteran
Veteran


Joined: 14 Apr 2002
Posts: 1692
Location: Victoria BC Canada

PostPosted: Tue Aug 06, 2002 10:58 pm    Post subject: Reply with quote

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
View user's profile Send private message
sibn
n00b
n00b


Joined: 15 May 2002
Posts: 36

PostPosted: Thu Aug 15, 2002 8:30 pm    Post subject: Reply with quote

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
View user's profile Send private message
RayVan
n00b
n00b


Joined: 12 Aug 2002
Posts: 40
Location: Houston, Tx

PostPosted: Fri Aug 16, 2002 4:11 pm    Post subject: --fast-math and other optimizations Reply with quote

--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
View user's profile Send private message
rac
Bodhisattva
Bodhisattva


Joined: 30 May 2002
Posts: 6553
Location: Japanifornia

PostPosted: Mon Aug 19, 2002 2:55 am    Post subject: Reply with quote

GCC3 to Gentoo Chat, turned into a discussion.
_________________
For every higher wall, there is a taller ladder
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Gentoo Chat All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum