Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
How to choose the best march for two CPUs?
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Portage & Programming
View previous topic :: View next topic  
Author Message
lekto
Apprentice
Apprentice


Joined: 20 Sep 2014
Posts: 199
Location: Ancient Rome

PostPosted: Sat Aug 31, 2024 9:40 am    Post subject: How to choose the best march for two CPUs? Reply with quote

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


Joined: 16 Feb 2013
Posts: 127

PostPosted: Sat Aug 31, 2024 11:14 am    Post subject: Reply with quote

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


Joined: 31 Dec 2013
Posts: 566

PostPosted: Sat Aug 31, 2024 3:52 pm    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Portage & Programming 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