Gentoo Archives: gentoo-user

From: David Haller <gentoo@×××××××.de>
To: gentoo-user@l.g.o
Subject: Re: [gentoo-user] is multi-core really worth it?
Date: Wed, 22 Nov 2017 07:48:30
Message-Id: 20171122074808.r7thimlcnapg5gek@grusum.endjinn.de
In Reply to: [gentoo-user] is multi-core really worth it? by Raffaele Belardi
1 Hello,
2
3 On Wed, 22 Nov 2017, Raffaele Belardi wrote:
4 >rebuilding system and world with gcc-7.2.0 on a 6-core AMD CPU I have
5 >the impression that most of the ebuilds limit parallel builds to 1, 2
6 >or 3 threads.
7
8 Most should build with "many" cores, but some might be limited, but ...
9
10 >I'm aware it is only an impression, I did not spend the
11 >night monitoring the process, but nevertheless every time I checked
12 >the load was very low.
13
14 I guess you're mostly observing stalls because the (single-thread)
15 overhead of emerge, configure (etc.), which can also be IO-bound...
16 The actual builds probably goes so fast on your box, you hardly
17 notice unless they're rather big(gish).
18
19 Some numbers for comparison, and I generally build with just one
20 thread in the background on my 2 core "old" Athlon II X2 250:
21 dev-libs/boost took a good 45mins to build with one thread. Divide by
22 6 for your cores, divide again by about 2-3 for your newer cores and
23 you're in the 3:45min range for such a "biggie" as boost. Most other
24 stuff won't even peg your meter.
25
26 So, your emerge is mostly IO and "emerge"-threads bound. Solution:
27 adjust your build-threads[1], and then adjust your emerge jobs! See
28 '--jobs' in 'man emerge'. Can't find where to set a default in a
29 config-file for that ATM, but you could always alias/function/script
30 emerge to something else, e.g. put this in your ~/.bashrc:
31
32 ====
33 eworld() {
34 emerge --jobs 7 [..whatever_you_use_for_world..] @world
35 }
36 ====
37
38 or use a "proper" script in ~/bin/ for that purpose.
39
40 You might want to "tune down" your "make" threads in make.conf though,
41 as your'll be building 7 packages in parallell ... Well, best try it
42 out, and have a guess at a sweet spot between emerge-jobs and
43 make-jobs. I'd hazard a guess of [2-4] emerge- and [3-5] make-jobs for
44 your six core should be nice.
45
46 Just experiment with 'emerge -j [1..7] ... @world'...
47
48 HTH,
49 -dnh
50
51 PS:[lines rebroken]
52
53 ====
54 # type eworld
55 eworld is a function
56 eworld ()
57 {
58 emerge --verbose --pretend --update --changed-use \
59 --newuse --deep --with-bdeps y "$@" @world;
60 beep -r 1 -l 50
61 }
62 ====
63
64 I usually call it as: eworld -t [--verbose-conflicts].
65
66 I then "pick and build" from the result (from the bottom up, due to
67 "--tree"). Even with ccache, it'd be rather stupid starting a
68 libreoffice, firefox or icedtea build that'll take hours when I have
69 to leave in 10min and won't keep the box running...
70
71 [1] I think that's good practice when doing multithreaded build on
72 multicore: add (at least) one for IO. THREADS="$(( $N_CORES+1 ))"
73 You can add that in your make.conf and feed $THREADS to
74 MAKEOPTS="-j ${THREADS}" etc.
75
76 --
77 "I have always felt that violence was the last refuge of the incompetent,
78 and emtpy threats the final sanctuary of the terminally inept."
79 -- the Marquis de Carabas

Replies

Subject Author
Re: [gentoo-user] is multi-core really worth it? "J. Roeleveld" <joost@××××××××.org>