Multi-Threaded make

Gabriel VLASIU gabriel at vlasiu.net
Fri Nov 30 00:12:32 UTC 2012


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On Thu, 29 Nov 2012, David G. Miller wrote:

> Setting -j to be equal to the number of cores/CPUs is just playing it 
> safe.
Yes, this is the default behavior of rpmbuild:

%_smp_mflags is defined in /usr/lib/rpm/redhat/macros:

%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
	&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
        if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then echo "-j16"; \\\
        elif [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)

> This is especially true when building a rpm which involves not just 
> compiles and link but also packaging, dependency resolution and 
> documentation tasks which are even more disk I/O intensive than 
> compiles.  Chances are that several of these operations that not 
> dependent on successfully compiling the code are fired off in parallel 
> rather than doing them sequentially and that old workhorse make gets the 
> task of managing each of these tasks.
I disagree with you here. You build a rpm in stages: "%prep", "%build", 
"%install", "list check for %files" and packaging (dependency 
resolution/debug-info/etc). Each stage is dependent on the previous one.
All the stages are run sequentially.
make (%build stage) and make install (%install stage) may run things in 
parallel. But this is something else (as I understand the process).

> Thus, you end up with multiple copies of make running at the same time 
> even on a single core/CPU system to perform these tasks.
Exactly. This is what I was trying to explain to JD( jd1008@).
make != cc1.
make can spawn more make processes which eventually can run cc1. 

Sorry but English is not my first language.

> My best results were with -j 12.
Wow! :-)


Gabriel

- -- 

// Gabriel VLASIU
//
// OpenGPG-KeyID      : 44952F15
// OpenGPG-Fingerprint: 4AC5 7C26 2FE9 02DA 4906  24B2 D32B 7ED7 4495 2F15
// OpenGPG-URL        : http://www.vlasiu.net/public.key


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBAgAGBQJQt/nwAAoJENMrftdElS8VxKgP+wcnGdrorvYioNl8m/QSfROa
ZXU5e3rkbIfRPBTMNusnwTu5ngiIs9N03jTZKdrgvRftyYWrDAI+QB0JSGZfO7X4
waeI80sgDnr4Km4zluw67RLpP7h3UNQomMgYX9CSL0gsXlou5MpvxV5lO/sDM4HH
hLAa2+cL2TCf/sL6jKbSrvmCgxQhAquMrfLb3JigGUDDDW8LXqOz0yq5rl0Yu37a
ZnVJ003dGkgIxs3g27ZFmuEWQpV7nro6JGZDhYemuPGRMLK2psbCfJwpM/tG+KPZ
W9h7ZA1+J1XUmZ9T/Ejv5AFO2CiF9QG5GedjSYV2DTc0DMKwX/70iugoSpy3qa/l
y40v6+lP1UkLYjL1HpUvhcxZjIJJlt8qG/VlZwjby011S7xOZZpyOiRIy+52Gq9p
w3kEE8MciHc8rpEV11d+gKj38rTA3kLlNgb69PlGk3nvk7Ce9nD0Kpj7ZM7LE+5r
cmRn/8U5is28lq+FnSjihDKOEXCX0raFB85i/sh6nUnSyRzUPHUu8AJPnjlckJqB
WlUn5wxmaeERtzLrDOIzu3w3wstmpx/wb/rKShRBhftTXclYUCfkHF4BR2aUvGk/
5BGJ95/2qnQZryk1yaCoz8c8jsz/0iCHkeN1cjKK5DolXMxkCs4xEeZ7/cmHKOlr
jVUsu1Mp0Ri3nxGKcLf0
=NwWn
-----END PGP SIGNATURE-----


More information about the users mailing list