2

Have anyone tried to compile glibc with -march=corei7 to see if there's any performance improvement over the version that comes by default with any Linux x68_64 distribution? GCC is compiled with -march=i686. I think (not sure) that the mathematical library is also compiled the same way. Can anybody confirm this?

Joe DF
  • 5,438
  • 6
  • 41
  • 63
pcremades
  • 83
  • 1
  • 5
  • I'd point out that any x86-64 build *can't* use `-march=i686` by definition. At a minimum, any x86-64 build can assume SSE, SSE2, and 16 SSE registers. My gut feeling is that the gains from further specifying the micro-architecture will be small; especially with scalar, rather than SIMD, math functions. – Brett Hale Mar 10 '14 at 07:32

1 Answers1

2

Most Linux distributions for x86 compile using only i686 instructions, but asking for scheduling them for later processors. I haven't really followed later developments.

A long while back different versions of system libraries according to processor lines were common, but the performance differences were soon deemed too small for the cost. And machines got more uniform in performance meanwhile.

One thing that has to be remembered always is that today's machines are memory bound. I.e., today a memory access takes a few hundred times longer than an instruction, and the gap is growing. Not to mention that this machine (an oldish laptop, was top-of-the-line some 2 years back) has 4 cores (8 threads), all battling to get data/instructions from memory. Making the code run a tiny bit faster, so the CPU can wait longer for RAM, isn't very productive.

vonbrand
  • 11,412
  • 8
  • 32
  • 52
  • I work with a numerical meteorological model that is really computer intensive. Most people working with it says that the code compiled with ifort runs 3 to 5 times faster than the code compiled with gfortran. According to Intel web site, gfortran is capable of producing really efficient code. So I thought that the performance difference could be related to the implementation of math functions. What do you think? – pcremades Mar 10 '14 at 04:40
  • That depends on the exact usage. Just calling simple functions can't make much of a difference, more so if not too frequently. Profile the code, see where the time is spent. If you have access to e.g. intel's compiler, try that one on the main code (compiling system libraries is calling for trouble, thrice; to be done only in dire circumstances – vonbrand Mar 10 '14 at 04:56
  • 1
    In the context of mathematical (esp. transcendental) functions, this is simply not the case. They are almost always entirely CPU bound, using range reduction, polynomial evaluation, etc., with the exception of the occasional lookup table for magic constants. – Brett Hale Mar 10 '14 at 07:44
  • @BrettHale, *calls* into the library will be mostly doing the operation then, so trying to shave off the setup in the library will have little (if any) effect. – vonbrand Mar 10 '14 at 09:30