1 |
On 14/08/2013 16:23, Paul Hartman wrote: |
2 |
> |
3 |
> On Wed, Aug 14, 2013 at 12:18 AM, Pandu Poluan <pandu@××××××.info |
4 |
> <mailto:pandu@××××××.info>> wrote: |
5 |
> |
6 |
> I know that the (theoretical) best performance is to use |
7 |
> -march=native , but since the processors of the HP servers are not |
8 |
> exactly the same as the Dell's, I'm concerned that compiling with |
9 |
> -march=native will render the VMs unable to migrate between the |
10 |
> different hosts. |
11 |
> |
12 |
> |
13 |
> |
14 |
> I use -mtune=native rather than -march=native, that way I can use some |
15 |
> advanced processor features if they are available, but my system will |
16 |
> still run if moved to a different host. |
17 |
|
18 |
That's not how -mtune works. If -march is unspecified, it will default |
19 |
to the lowest common denominator for the platform which prevents the use |
20 |
of any distinguished processor features. For an amd64 install, that |
21 |
would be "-march=x86-64". |
22 |
|
23 |
Instead, -mtune affects everything that -march doesn't. Though it |
24 |
doesn't affect the instructions that *can* be used, it may effect which |
25 |
of the allowed instructions are used and how. For instance, gcc includes |
26 |
processor pipeline descriptions for different microarchitectures so as |
27 |
to emit instructions in a way that tries to avoid pipeline hazards: |
28 |
|
29 |
http://gcc.gnu.org/onlinedocs/gccint/Processor-pipeline-description.html |
30 |
|
31 |
If performance matters, a better approach is to look at what |
32 |
-march=native enables and manually specify all options that are common |
33 |
between the hosts. Further, if the host CPU microarchitecture varies |
34 |
then I would suggest adding -mtune=generic so as not to make potentially |
35 |
erroneous assumptions in the course of applying that type of |
36 |
optimisation. Indeed, -mtune=generic is the default if neither -march |
37 |
nor -mtune are specified. |
38 |
|
39 |
Regarding qemu, the main thing is never to use a feature that would |
40 |
incur costly emulation on the host side. |
41 |
|
42 |
--Kerin |