GCC special optimization options for double precision floating point arithmetics?

Dual-Xeon" is not a precise specification of the processors you're targetting - "Xeon" is more a marketing brand name than a specific model. "Xeon" doesn't even tell you if you're targetting the IA32 or x86-64 architecture.

Up vote 1 down vote favorite share g+ share fb share tw.

Do you know which of the GCC optimization flags are the most appropriate to build an application, which uses double floating point and calculates a lot in real-time and it uses -lm. A target hardware is two Dual-Xeons with Linux on-board. Thanks in advance!

C optimization gcc build-process link|improve this question asked Jun 15 '10 at 15:26psihodelia3,764956 94% accept rate.

Dual-Xeon" is not a precise specification of the processors you're targetting - "Xeon" is more a marketing brand name than a specific model. "Xeon" doesn't even tell you if you're targetting the IA32 or x86-64 architecture. This is important, because the optimisation can be significantly improved by targetting a specific CPU family.

There are many options described in the GCC documentation; in particular, start with -march to generate code for a particular instruction set. If you are not targetting x86-64, then use -mfpmath=sse (if supported by your CPU type) to use SSE instructions for floating point, rather than 387 (this option is the default on x86-64). Likewise, -malign-double can give a speedup (but is only default on x86-64).

Also, if the functions you use in libmath are shown as a hotspot when you profile, then recompiling that library with more specific optimisation flags may be of benefit.

Thank you, -mfpmath=sse has helped. Now my application is about 10 times faster. – psihodelia Jun 16 '10 at 14:39.

Depending on whether it is safe and appropriate for your given application you could consider -ffast-math. Please read the warnings on the man page for this before using it though. I know from experience that it can make quite a difference with programs running numerical simulations.

Of course you have to do some sanity checks to make sure the output is not altered.

1 gcc 4.1 Optimization Flag docs: gcc.gnu.org/onlinedocs/gcc-4.1.0/gcc/Opt... – Brian Jun 15 '10 at 15:52 I don't think that's a good idea... just -O2 is probably fine – Spudd86 Jun 15 '10 at 17:46 @Brian: Not sure why you commented with just that link. – Troubadour Jun 15 '10 at 18:30 @spudd86: Yes, -O2 is probably fine, hence my answer. I didn't explicitly mention the -O options because even the most cursory inspection of the documentation will reveal these options so I assumed wasn't really what was being asked about.

I was simply pointing out a more esoteric option that seemed pertinent to this specific question. – Troubadour Jun 15 '10 at 18:32 "Please read the warnings on the man page" made me feel the urge to post a link to something that had such warnings. – Brian Jun 15 '10 at 19:24.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions