Hi Sam,
On Sun, May 31, 2015 at 08:05:44PM -0400, Sam Varshavchik wrote:
Suvayu Ali writes:
>
>How does rpmbulid decide how many threads to run? I think it looks at
>the local machine and decides. I also recall some variable called
>RPMBUILD_NCPU or something like that. That would explain why it only
>uses as many threads as the local machine can handle.
>
>Hope this helps,
Sadly, no it doesn't. As I wrote above:
>> >> >> ps shows the maximum number of "/usr/bin/distcc
/usr/bin/g++
>[options]"
>> >> >> processes running locally,
rpmbuild uses the _smp_mflags macro to pass the -j parameter to make, and I
have it correctly configured to kick off ten parallel processes, to match
the maximum number of ten processes distcc is configured (4 local, 6
remote). Yet, despite the fact that a manual build distributes the compiles
correctly, with rpmbuild distcc throttles the number of concurrent parallel
jobs that it kicks off to four, and runs them locally.
I think you misunderstood me, I wasn't clear either. I saw you set
_smp_mflags, what I mean is rpmbuild still does some magic underneath.
I.e. after you have set that flag, afaik, rpmbuild will fiddle with the
value and pass an "appropriate" -j<n> flag to Make in the regular case.
It makes this choice based on how many threads it can run locally. At
least that's what I think it does.
Okay I did some digging. This is what rpmbuild does with _smp_mflags
(output from rpmbuild --showrc).
-14: _smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \
ncpus_max=%{?_smp_ncpus_max}; \
if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ]
&& [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then
RPM_BUILD_NCPUS="$ncpus_max"; fi; \
if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo
"-j$RPM_BUILD_NCPUS"; fi)
-14: _smp_ncpus_max 16
I don't have the time to check the above snippet, maybe you can take a
look? Hope this time we follow each other. If this doesn't help, I'm
out of ideas :-(.
Cheers,
--
Suvayu
Open source is the future. It sets us free.