Buildroot Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Nathan Lynch <ntl@pobox.com>
To: buildroot@busybox.net
Subject: [Buildroot] [PATCHv2 7/7] automatically set PARALLEL_JOBS when BR2_JLEVEL is 0
Date: Thu, 14 Jun 2012 10:02:45 -0500	[thread overview]
Message-ID: <1339686165-10145-1-git-send-email-ntl@pobox.com> (raw)
In-Reply-To: <1339466983-19786-8-git-send-email-ntl@pobox.com>

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(-)

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)
-- 
1.7.10.2

  parent reply	other threads:[~2012-06-14 15:02 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-06-12  2:09 [Buildroot] [PATCH 0/7] automatically determine job concurrency Nathan Lynch
2012-06-12  2:09 ` [Buildroot] [PATCH 1/7] introduce PARALLEL_JOBS build system variable Nathan Lynch
2012-06-12  2:09 ` [Buildroot] [PATCH 2/7] boost: change uses of BR2_JLEVEL to PARALLEL_JOBS Nathan Lynch
2012-06-12  2:09 ` [Buildroot] [PATCH 3/7] cmake: change use " Nathan Lynch
2012-06-12  2:09 ` [Buildroot] [PATCH 4/7] midori: " Nathan Lynch
2012-06-12  2:09 ` [Buildroot] [PATCH 5/7] qt: " Nathan Lynch
2012-06-12  2:09 ` [Buildroot] [PATCH 6/7] toolchain/crosstool-ng: " Nathan Lynch
2012-06-12  2:09 ` [Buildroot] [PATCH 7/7] automatically set PARALLEL_JOBS when BR2_JLEVEL is 0 Nathan Lynch
2012-06-13 23:27   ` Arnout Vandecappelle
2012-06-13 23:44     ` Nathan Lynch
2012-06-14  6:07       ` Peter Korsgaard
2012-06-14  6:16         ` Nathan Lynch
2012-06-14  8:56           ` Peter Korsgaard
2012-06-14  8:33     ` Richard Braun
2012-06-14 15:02   ` Nathan Lynch [this message]
2012-06-14 18:09     ` [Buildroot] [PATCHv2 " Baruch Siach
2012-06-16 19:37   ` [Buildroot] [PATCHv3 " Nathan Lynch
2012-06-24  9:13 ` [Buildroot] [PATCH 0/7] automatically determine job concurrency Peter Korsgaard

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1339686165-10145-1-git-send-email-ntl@pobox.com \
    --to=ntl@pobox.com \
    --cc=buildroot@busybox.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox