using -ffast-math for bot
Has anyone used the -ffast-math gcc compilation flag for a bot? Is it safe? I haven't benchmarked but it does seem a bit iffy to use it.
|
Re: using -ffast-math for bot
Personally...no and also
Code:
-O3 Also have you used Code:
-static-libstdc++ |
Re: using -ffast-math for bot
The flag fast-math is breaking standard compliance regarding floating point calculations and some other mathematical operations. Basically you should get pretty close results regarding floating point numbers, but they will not be 100% correct. Depending on the code, this might not be a problem.
Other thing which is disabled are traps(unix/linux) and async exceptions(Windows) when you try to do some architecture specific invalid math operation like division by zero. In that case the program will directly crash(you will not be able to trap/catch the signal). So it really depends on your code and use cases. About -O3. This optimization flag does not break the compliance, on the contrary it will follow it more strictly regarding undefined behavior stuff. I.e. if your code is well written and does not rely on undefined behavior working in "specific" way then you will get a free performance boost. However, in large codebases that do not use linters and high warning levels, this is usually not the case so it may seems like -O3 is breaking your code. |
Re: using -ffast-math for bot
Quote:
And not yet - I was having some trouble with VirtualBox continually corrupting my VM but not I have it sorted so I should reinstall Steam and try it. Quote:
Anyway, not that the extra speed is needed but I thought it was worth investigating. |
Re: using -ffast-math for bot
Also, I've just noticed that some or most of your float variable values don't have "f" suffixed for example:-
https://github.com/tschumann/sandbot...s/bot.cpp#L385 Code:
pBot->f_waypoint_time = 0.0; Code:
pBot->f_waypoint_time = 0.0f; |
Re: using -ffast-math for bot
Yeah I think the compiler figures it out - I know I've had to change a few at times to avoid a warning or error but it seems like newer versions of Visual Studio assume it's a double literal by default, even when assigning to a float.
|
All times are GMT +2. The time now is 23:07. |
Powered by vBulletin® Version 3.8.2
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.