Hello, On Tue, 12 Jun 2018, Mick wrote: >On Tuesday, 12 June 2018 19:31:32 BST Ian Zimmerman wrote: >> I have had it with compiling stuff from source on my laptop. It is just >> too slow. So I would like to create binary packages on my desktop and >> then just tell the laptop to use them. >> >> Simple enough, except that the desktop is AMD Phenom, and the laptop is >> Intel 64 bit Atom. Up to now, each system had unique CFLAGS to squeeze >> as much performance as possible. >> >> On the desktop: >> CFLAGS="-march=barcelona --param l1-cache-size=64 --param >> l1-cache-line-size=64 --param l2-cache-size=512 -O2 -pipe" >> >> On the laptop: >> CFLAGS="-march=ivybridge --param l1-cache-size=32 --param >> l1-cache-line-size=64 --param l2-cache-size=4096 -O2 -pipe"
First of all, I've seen quite a big boost just by using '-O3'! My speeding-up-relevant flags (for a Athlon II X2 250 "Regor") are: -O3 -march=native -mtune=native -mfpmath=sse -msse4a \ -funwind-tables -fasynchronous-unwind-tables You'll have to adjust -march=/-mtune= for the Atom and -m* for both, crosscheck with e.g. $ grep ^flags /proc/cpuinfo |tr ' ' '\n' |grep sse | sort -u misalignsse sse sse2 sse4a or app-portage/cpuid2cpuflags. >> I don't want to give up these tunings, but from the wiki page [1] I can >> see no straightforward way to have different CFLAGS when compiling binary >> packages, from the normal CFLAGS when installing directly from source on >> the host system. Is the only way of doing this to set up a full-blown >> cross-development environment? >> >> [1] >> https://wiki.gentoo.org/wiki/Binary_package_guide > >On the desktop you could just use -march=native for its own compiles, not sure >if there is a benefit or good reason to use '-march=barcelona', but I'm >digressing. > >If you are compiling binary packages for the laptop with a single stanza on >the CLI, then you can run: > >CFLAGS="-march=ivybridge ..." CXXFLAGS="-march=ivybridge ..." >FEATURES="buildpkg" PKGDIR="/tmp/binpkg_dir emerge -uaNDv --buildpkg world > >I understand you will need the complete CFLAGS & CXXFLAGS for the guest's >hardware - others should confirm if this is so. Depends on how far you want to go on optimization ;) >I find it neater/easier to copy the guest's fs over to the faster host, then >chroot into it, sync portage and emerge with --buildpkg world. There are >other solutions, NFS mounts of the guest over the network, using a VM >mirroring the laptop build on the host, but they are more complicated for my >use case of a single guest. And/or setup some wrappers/shell-functions, that setup flags like: ==== emerge-atom === #!/bin/sh FEATURES="buildpkg" PKGDIR="${PORTDIR}/laptop_binpkg_dir" export CFLAGS="..." export CXXFLAGS="..." ... emerge "$@" ==== and then use 'emerge ....' for the desktop and 'emerge-atom' for the laptop. Or something along those lines. On the other paw, one could run some benchmarks, comparing both native flags vs. the "common demnominator" (and -O2 vs -O3 ;)... HTH, -dnh -- I like offending people, because I think people that get offended should be offended. -- Linus Torvalds, June 2012 at Aalto Uni