Re: [gentoo-user] Binary packages for a different amd64 flavor

2018-06-12 Thread David Haller
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



Re: [gentoo-user] Binary packages for a different amd64 flavor

2018-06-12 Thread R0b0t1
On Tue, Jun 12, 2018 at 1:31 PM, 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"
>
> 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
>

Use crossdev to generate an x86_64-pc-linux-gnu (or x86) toolchain.
You can specify something in place of "pc" to identify the system and
be fairly compliant, or you can invent your own naming and specify the
architecture manually. This will create a root in /usr with the name
given that will have a make.conf in /usr/${name}/etc/portage and
generated packages in /usr/${name}/usr/portage/packages.

Cheers,
 R0b0t1



Re: [gentoo-user] Binary packages for a different amd64 flavor

2018-06-12 Thread Neil Bothwick
On Tue, 12 Jun 2018 11:31:32 -0700, 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"
> 
> 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?

Set up a container (or chroot but a container is easier to manage)
containing a copy of the root filesystem of the laptop. Tweak make.conf
to add buildpkg and set an appropriate PKGDIR. then you can just enter
the container/chroot and run your world update or whatever else you want
to emerge.

Now export the PKGDIR over NFS and mount it on the laptop and add
--usepkg to the portage default opts in make.conf.


-- 
Neil Bothwick

Don't judge a book by its movie.


pgpdVFN4WEhsH.pgp
Description: OpenPGP digital signature


Re: [gentoo-user] Binary packages for a different amd64 flavor

2018-06-12 Thread Mick
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"
> 
> 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.

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.

-- 
Regards,
Mick

signature.asc
Description: This is a digitally signed message part.


[gentoo-user] Binary packages for a different amd64 flavor

2018-06-12 Thread Ian Zimmerman
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"

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

-- 
Please don't Cc: me privately on mailing lists and Usenet,
if you also post the followup to the list or newsgroup.
To reply privately _only_ on Usenet and on broken lists
which rewrite From, fetch the TXT record for no-use.mooo.com.