Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
CFLAGS for 4 different PCs using binary packages?
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
Fran
Guru
Guru


Joined: 29 Feb 2004
Posts: 521
Location: Coruña (Spain)

PostPosted: Thu Jan 24, 2013 2:54 pm    Post subject: CFLAGS for 4 different PCs using binary packages? Reply with quote

I have 4 computers (2 amdfam10, 1 core2, 1 corei7-avx) and I want them to use the same binary packages to reduce compiling times and energy consumption. Which CFLAGS should I use? At first I thought of -mtune=generic -O2, but that's a bit conservative. Then I took a look at the options enabled by gcc for each one when using -march=native, which are:
Code:
march=core2 mcx16 msahf mno-movbe mno-aes mno-pclmul mno-popcnt mno-abm mno-lwp mno-fma mno-fma4 mno-xop mno-bmi mno-bmi2 mno-tbm mno-avx mno-avx2 mno-sse4.2 mno-sse4.1 mno-lzcnt mno-rdrnd mno-f16c mno-fsgsbase -param l1-cache-size=32 -param l1-cache-line-size=64 -param l2-cache-size=2048 mtune=core2

Code:
march=corei7-avx mcx16 msahf mno-movbe maes mpclmul mpopcnt mno-abm mno-lwp mno-fma mno-fma4 mno-xop mno-bmi mno-bmi2 mno-tbm mavx mno-avx2 msse4.2 msse4.1 mno-lzcnt mno-rdrnd mno-f16c mno-fsgsbase -param l1-cache-size=32 -param l1-cache-line-size=64 -param l2-cache-size=6144 mtune=corei7-avx

Code:
march=amdfam10 mcx16 msahf mno-movbe mno-aes mno-pclmul mpopcnt mabm mno-lwp mno-fma mno-fma4 mno-xop mno-bmi mno-bmi2 mno-tbm mno-avx mno-avx2 mno-sse4.2 mno-sse4.1 mlzcnt mno-rdrnd mno-f16c mno-fsgsbase -param l1-cache-size=64 -param l1-cache-line-size=64 -param l2-cache-size=512 mtune=amdfam10

which would yield a common of -mtune=generic -O2 -mcx16 -msahf (I assume the -mno-xxx are included by default) but then I don't know which options are enabled by each respective -march=xxx that don't show there. For example, I assume that -msse3 is included in all three -marches, since all of them support them, so maybe there are other options supported by all of them that aren't included.

Yeah, I know the difference in performance may be <1%, but IT IS >0%, right? ;). So, any way to get the real lowest common denominator between those arches?
Back to top
View user's profile Send private message
DaggyStyle
Advocate
Advocate


Joined: 22 Mar 2006
Posts: 4916

PostPosted: Thu Jan 24, 2013 3:50 pm    Post subject: Reply with quote

you have 4 machines with different cpu type and want to compile on one and use binpkg install on the rest, imho, go for a binary based distro, you are trying to do basicly the same thing and thus loosing a main feature of gentoo.
if you must use gentoo, try one of the bin derivatives.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
ProjectFootball
Back to top
View user's profile Send private message
Fran
Guru
Guru


Joined: 29 Feb 2004
Posts: 521
Location: Coruña (Spain)

PostPosted: Thu Jan 24, 2013 4:04 pm    Post subject: Reply with quote

DaggyStyle wrote:
and thus loosing a main feature of gentoo.

Uh, no. My reasons to use gentoo instead of any other distro could be:

33% -> I can apply custom patches to any package
33% -> I can add an unsupported package simply by coding an ebuild
33% -> I choose the dependencies
1% -> I can use compile-time optimizations

I don't mind losing that 1%. But the more I can minimize that loss, the better (it's free). Hence this thread.
Back to top
View user's profile Send private message
DaggyStyle
Advocate
Advocate


Joined: 22 Mar 2006
Posts: 4916

PostPosted: Thu Jan 24, 2013 5:44 pm    Post subject: Reply with quote

Fran wrote:
DaggyStyle wrote:
and thus loosing a main feature of gentoo.

Uh, no. My reasons to use gentoo instead of any other distro could be:

33% -> I can apply custom patches to any package
33% -> I can add an unsupported package simply by coding an ebuild
33% -> I choose the dependencies
1% -> I can use compile-time optimizations

I don't mind losing that 1%. But the more I can minimize that loss, the better (it's free). Hence this thread.

hence go for either the gentoo bin derivatives or even arch.
_________________
Only two things are infinite, the universe and human stupidity and I'm not sure about the former - Albert Einstein
ProjectFootball
Back to top
View user's profile Send private message
ulenrich
Veteran
Veteran


Joined: 10 Oct 2010
Posts: 1136

PostPosted: Thu Jan 24, 2013 8:51 pm    Post subject: Reply with quote

@Fran, please try calculate and report here from your binary experience.
I am curious and just on the brink to try that Gentoo derivative in a vm.

How do they provide bins?
As of Sabayon having a whole parallel package manager universe, coming with incompatibilities with Gentoo, I heard Calculate has a better solution to the issue.
_________________
fun2gen2
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31722
Location: 56N 3W

PostPosted: Thu Jan 24, 2013 9:03 pm    Post subject: Reply with quote

Fran,

You are on the right track. Go through the settings you obtained from each machine and cross out any that do not appear in all three.
Whats left is common and therefore what you can use in CFLAGS on all of them.

If one happens to be a desktop that you want to use multimedia applications on that would benefit for the SIMD extensions, you can enable them on a per package per machine basis if its worth the performance increase.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
Back to top
View user's profile Send private message
Fran
Guru
Guru


Joined: 29 Feb 2004
Posts: 521
Location: Coruña (Spain)

PostPosted: Thu Jan 24, 2013 9:21 pm    Post subject: Reply with quote

ulenrich wrote:
@Fran, please try calculate and report here from your binary experience.

Nah. While I don't see any drawbacks in a "compile-once-install-everywhere" model, I have no interest whatsoever in going full binary. I seriously doubt there is a binary distro with packages compiled with some of my current USEs (-udisks -upower -consolekit -policykit -gstreamer -pulseaudio -gnome -kde, for example :roll:). Or a distro where patching the window manager to my liking is as simple as dropping a patch in /etc/portage/patches/x11-wm/yaddayadda (yeah, I do that frequently). For me THOSE are the best things about gentoo, NOT CFLAGS.

NeddySeagoon wrote:
You are on the right track. Go through the settings you obtained from each machine and cross out any that do not appear in all three.
Whats left is common and therefore what you can use in CFLAGS on all of them.

Yeah, but what about -msse3, for example? I know for sure it's supported by all three, and in fact it's enabled by default when using -march={core2,corei7-avx,amdfam10} even though it doesn't appear there. Are there any other flags implicit by all three -marches, apart from -mmmx, -msse, -msse2 and -msse3?

For now I'm using "-mtune=generic -mmmx -msse -msse2 -msse3 -mcx16 -msahf -O2 -pipe", to ensure I don't get any "Illegal instruction" when running something.
Back to top
View user's profile Send private message
NeddySeagoon
Administrator
Administrator


Joined: 05 Jul 2003
Posts: 31722
Location: 56N 3W

PostPosted: Thu Jan 24, 2013 9:25 pm    Post subject: Reply with quote

Fran,

Check FLAGS in /proc/cpuinfo all the instruction set extensions get CPU flags there.
_________________
Regards,

NeddySeagoon

Computer users fall into two groups:-
those that do backups
those that have never had a hard drive fail.
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