When compiling programs to run inside a VM, what should march and mtune be set to?

Posted by Russ on Stack Overflow See other posts from Stack Overflow or by Russ
Published on 2012-04-12T22:41:20Z Indexed on 2012/04/12 23:29 UTC
Read the original article Hit count: 230

With VMs being slave to whatever the host machine is providing, what compiler flags should be provided to gcc?

I would normally think that -march=native would be what you would use when compiling for a dedicated box, but the fine detail that -march=native is going to as indicated in this article makes me extremely wary of using it.

So... what to set -march and -mtune to inside a VM?


For a specific example...

My specific case right now is compiling python (and more) in a linux guest inside a KVM-based "cloud" host that I have no real control over the host hardware (aside from 'simple' stuff like CPU GHz m CPU count, and available RAM). Currently, cpuinfo tells me I've got an "AMD Opteron(tm) Processor 6176" but I honestly don't know (yet) if that is reliable and whether the guest can get moved around to different architectures on me to meet the host's infrastructure shuffling needs (sounds hairy/unlikely).

All I can really guarantee is my OS, which is a 64-bit linux kernel where uname -m yields x86_64.

© Stack Overflow or respective owner

Related posts about linux

Related posts about gcc