1 |
Hello, |
2 |
|
3 |
On Tue, 12 Jun 2018, Mick wrote: |
4 |
>On Tuesday, 12 June 2018 19:31:32 BST Ian Zimmerman wrote: |
5 |
>> I have had it with compiling stuff from source on my laptop. It is just |
6 |
>> too slow. So I would like to create binary packages on my desktop and |
7 |
>> then just tell the laptop to use them. |
8 |
>> |
9 |
>> Simple enough, except that the desktop is AMD Phenom, and the laptop is |
10 |
>> Intel 64 bit Atom. Up to now, each system had unique CFLAGS to squeeze |
11 |
>> as much performance as possible. |
12 |
>> |
13 |
>> On the desktop: |
14 |
>> CFLAGS="-march=barcelona --param l1-cache-size=64 --param |
15 |
>> l1-cache-line-size=64 --param l2-cache-size=512 -O2 -pipe" |
16 |
>> |
17 |
>> On the laptop: |
18 |
>> CFLAGS="-march=ivybridge --param l1-cache-size=32 --param |
19 |
>> l1-cache-line-size=64 --param l2-cache-size=4096 -O2 -pipe" |
20 |
|
21 |
First of all, I've seen quite a big boost just by using '-O3'! |
22 |
|
23 |
My speeding-up-relevant flags (for a Athlon II X2 250 "Regor") are: |
24 |
|
25 |
-O3 -march=native -mtune=native -mfpmath=sse -msse4a \ |
26 |
-funwind-tables -fasynchronous-unwind-tables |
27 |
|
28 |
You'll have to adjust -march=/-mtune= for the Atom and -m* for both, |
29 |
crosscheck with e.g. |
30 |
|
31 |
$ grep ^flags /proc/cpuinfo |tr ' ' '\n' |grep sse | sort -u |
32 |
misalignsse |
33 |
sse |
34 |
sse2 |
35 |
sse4a |
36 |
|
37 |
or app-portage/cpuid2cpuflags. |
38 |
|
39 |
>> I don't want to give up these tunings, but from the wiki page [1] I can |
40 |
>> see no straightforward way to have different CFLAGS when compiling binary |
41 |
>> packages, from the normal CFLAGS when installing directly from source on |
42 |
>> the host system. Is the only way of doing this to set up a full-blown |
43 |
>> cross-development environment? |
44 |
>> |
45 |
>> [1] |
46 |
>> https://wiki.gentoo.org/wiki/Binary_package_guide |
47 |
> |
48 |
>On the desktop you could just use -march=native for its own compiles, not sure |
49 |
>if there is a benefit or good reason to use '-march=barcelona', but I'm |
50 |
>digressing. |
51 |
> |
52 |
>If you are compiling binary packages for the laptop with a single stanza on |
53 |
>the CLI, then you can run: |
54 |
> |
55 |
>CFLAGS="-march=ivybridge ..." CXXFLAGS="-march=ivybridge ..." |
56 |
>FEATURES="buildpkg" PKGDIR="/tmp/binpkg_dir emerge -uaNDv --buildpkg world |
57 |
> |
58 |
>I understand you will need the complete CFLAGS & CXXFLAGS for the guest's |
59 |
>hardware - others should confirm if this is so. |
60 |
|
61 |
Depends on how far you want to go on optimization ;) |
62 |
|
63 |
>I find it neater/easier to copy the guest's fs over to the faster host, then |
64 |
>chroot into it, sync portage and emerge with --buildpkg world. There are |
65 |
>other solutions, NFS mounts of the guest over the network, using a VM |
66 |
>mirroring the laptop build on the host, but they are more complicated for my |
67 |
>use case of a single guest. |
68 |
|
69 |
And/or setup some wrappers/shell-functions, that setup flags like: |
70 |
|
71 |
==== emerge-atom === |
72 |
#!/bin/sh |
73 |
FEATURES="buildpkg" |
74 |
PKGDIR="${PORTDIR}/laptop_binpkg_dir" |
75 |
export CFLAGS="..." |
76 |
export CXXFLAGS="..." |
77 |
... |
78 |
emerge "$@" |
79 |
==== |
80 |
|
81 |
and then use 'emerge ....' for the desktop and 'emerge-atom' for the |
82 |
laptop. Or something along those lines. |
83 |
|
84 |
On the other paw, one could run some benchmarks, comparing both native |
85 |
flags vs. the "common demnominator" (and -O2 vs -O3 ;)... |
86 |
|
87 |
HTH, |
88 |
-dnh |
89 |
|
90 |
-- |
91 |
I like offending people, because I think people that get offended |
92 |
should be offended. -- Linus Torvalds, June 2012 at Aalto Uni |