Message ID | 1339686165-10145-1-git-send-email-ntl@pobox.com |
---|---|
State | Superseded |
Headers | show |
Hi Nathan, On Thu, Jun 14, 2012 at 10:02:45AM -0500, Nathan Lynch wrote: > When BR2_JLEVEL is 0, set PARALLEL_JOBS to double the number of CPUs > detected. This allows one to more or less fully utilize the host > system without manually tuning the configuration. > > Also make 0 the default value for BR2_JLEVEL. > > Signed-off-by: Nathan Lynch <ntl@pobox.com> > --- [snip] > +ifeq ($(BR2_JLEVEL),0) > +PARALLEL_JOBS:=$(shell echo \ > + $$((2 * `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`))) > +else > PARALLEL_JOBS:=$(BR2_JLEVEL) > +endif IMO, there should be a comment here explaining the magic (2*CPUs) number. baruch
diff --git a/Config.in b/Config.in index 95c2e8c..3745255 100644 --- a/Config.in +++ b/Config.in @@ -178,10 +178,12 @@ config BR2_DEBIAN_MIRROR endmenu config BR2_JLEVEL - int "Number of jobs to run simultaneously" - default "2" + int "Number of jobs to run simultaneously (0 for auto)" + default "0" help - Number of jobs to run simultaneously + Number of jobs to run simultaneously. If 0, determine + automatically according to number of CPUs on the host + system. config BR2_CCACHE bool "Enable compiler cache" diff --git a/package/Makefile.in b/package/Makefile.in index 9177a1b..95e0ae6 100644 --- a/package/Makefile.in +++ b/package/Makefile.in @@ -6,7 +6,12 @@ HOSTMAKE=$(MAKE) endif HOSTMAKE :=$(shell which $(HOSTMAKE) || type -p $(HOSTMAKE) || echo make) +ifeq ($(BR2_JLEVEL),0) +PARALLEL_JOBS:=$(shell echo \ + $$((2 * `getconf _NPROCESSORS_ONLN 2>/dev/null || echo 1`))) +else PARALLEL_JOBS:=$(BR2_JLEVEL) +endif MAKE1:=$(HOSTMAKE) -j1 MAKE:=$(HOSTMAKE) -j$(PARALLEL_JOBS)
When BR2_JLEVEL is 0, set PARALLEL_JOBS to double the number of CPUs detected. This allows one to more or less fully utilize the host system without manually tuning the configuration. Also make 0 the default value for BR2_JLEVEL. Signed-off-by: Nathan Lynch <ntl@pobox.com> --- v2: Updated to use double number of detected CPUs per Arnout and Peter. Config.in | 8 +++++--- package/Makefile.in | 5 +++++ 2 files changed, 10 insertions(+), 3 deletions(-)