View previous topic :: View next topic |
Author |
Message |
lekto Apprentice
Joined: 20 Sep 2014 Posts: 207 Location: Ancient Rome
|
Posted: Sat Aug 31, 2024 9:40 am Post subject: How to choose the best march for two CPUs? |
|
|
Hi, I have two CPUs:
- Xeon E5-2650 (SR0KQ) – 8C16T 2GHz 95W Sandy Bridge from 2012
- Xeon E5-1680 v2 (SR1MJ) – 8C16T 3GHz 130W Ivy Bridge from 2013
Right now I’m using E5-2650, mostly because of summer and its lower TDP. When I finish setting up that machine, I plan to test the power consumption of both CPUs and choose which is better to run in my case.
How to find what is the best march that make both CPUs run optimally? |
|
Back to top |
|
|
molletts Tux's lil' helper
Joined: 16 Feb 2013 Posts: 129
|
Posted: Sat Aug 31, 2024 11:14 am Post subject: |
|
|
I'd go for -march=sandybridge - Ivy Bridge is really just a refinement of Sandy Bridge (it was the "tock" part of Intel's old "tick-tock" release cadence) so the differences are minimal. The compiler instruction scheduling is probably identical.
The only features I can see that are present on Ivy Bridge and not on Sandy Bridge and have CPU_FLAGS_X86 flags are f16c and rdrand. Neither of these is particularly common, although gui-libs/gtk appears to offer f16c as an option.
If you end up going with the E5-1680 v2 permanently and aren't worried about having the option to switch back or run the same code on a second system with the 2650 (via binpkgs), you could switch to -march=native (or -march=ivybridge with the additional cache-size hints) and turn on the features but it wouldn't be worth doing a world rebuild - just let stuff be rebuilt when it gets updated. |
|
Back to top |
|
|
Ralphred l33t
Joined: 31 Dec 2013 Posts: 652
|
Posted: Sat Aug 31, 2024 3:52 pm Post subject: |
|
|
One of the Gentoo Forum regulars wrote a blog post about this a few years back, it was related to distcc IIRC. I had the foresight to store the final scriptlet in my make.conf, but not the url, sorry (to OP and author).
It produces a list of options included in `-march=native` but not included in `-march=[your arch]`, but you should be able to dissect it and play "mix and match" between the two machines, to take advantage of all the options supported by both.
Code: | MARCH="sandybridge";diff -U0 <(gcc -### -E - -march=native 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )|( -dumpbase -)|( -mno-[^\ ]+)//g') <(gcc -### -E - -march=${MARCH} 2>&1 | sed -r '/cc1/!d;s/(")|(^.* - )|( -dumpbase -)|( -mno-[^\ ]+)//g')|grep "\\--march"|sed s'/-//' |
|
|
Back to top |
|
|
|