public inbox for crossgcc@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] Add a 'auto' value for the number of parallel jobs
@ 2011-09-28 23:42 Michael Hope
  2011-10-05 21:56 ` Yann E. MORIN
  0 siblings, 1 reply; 2+ messages in thread
From: Michael Hope @ 2011-09-28 23:42 UTC (permalink / raw)
  To: Yann E. MORIN; +Cc: crossgcc

# HG changeset patch
# User Michael Hope <michael.hope@linaro.org>
# Date 1317253242 -46800
# Node ID 69e6e581338dc4558d87fdcde9d9cbf8466893c9
# Parent  780d29fbc4c574ded2248f55e77dd7cb1540aea4
Add a 'auto' value for the number of parallel jobs.

When CT_PARALLEL_JOBS is -1, set the number of parallel jobs to the
number of online CPUs + 1.  Update documentation to match.

I find this useful when building in the cloud.  You can use the same
.config file and have the build adapt to the number of processors
available.  Limited testing shows that NCPUS+1 is faster than NCPUS+0
or NCPUS+2.

Signed-off-by: Michael Hope <michael.hope@linaro.org>

diff -r 780d29fbc4c5 -r 69e6e581338d config/global/build-behave.in
--- a/config/global/build-behave.in	Thu Sep 29 12:27:54 2011 +1300
+++ b/config/global/build-behave.in	Thu Sep 29 12:40:42 2011 +1300
@@ -16,6 +16,8 @@
       
       Enter 1 (or 0) to have only one job at a time.
 
+      Enter -1 to set automatically based on how many processors the host has.
+
 config LOAD
     int
     prompt "Maximum allowed load" if ! BACKEND
diff -r 780d29fbc4c5 -r 69e6e581338d scripts/crosstool-NG.sh.in
--- a/scripts/crosstool-NG.sh.in	Thu Sep 29 12:27:54 2011 +1300
+++ b/scripts/crosstool-NG.sh.in	Thu Sep 29 12:40:42 2011 +1300
@@ -488,7 +488,11 @@
 
     # And help make go faster
     JOBSFLAGS=
-    [ ${CT_PARALLEL_JOBS} -ne 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}"
+    # Use the number of processors+1 when automatically setting the number of
+    # parallel jobs.  Fall back to 1 if the host doesn't use GLIBC.
+    AUTO_JOBS=$((`getconf _NPROCESSORS_ONLN 2> /dev/null || echo 0` + 1))
+    [ ${CT_PARALLEL_JOBS} -eq -1 ] && JOBSFLAGS="${JOBSFLAGS} -j${AUTO_JOBS}"
+    [ ${CT_PARALLEL_JOBS} -gt 0 ] && JOBSFLAGS="${JOBSFLAGS} -j${CT_PARALLEL_JOBS}"
     [ ${CT_LOAD} -ne 0 ] && JOBSFLAGS="${JOBSFLAGS} -l${CT_LOAD}"
 
     # We need to save the real .config with kconfig's value,

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] Add a 'auto' value for the number of parallel jobs
  2011-09-28 23:42 [PATCH] Add a 'auto' value for the number of parallel jobs Michael Hope
@ 2011-10-05 21:56 ` Yann E. MORIN
  0 siblings, 0 replies; 2+ messages in thread
From: Yann E. MORIN @ 2011-10-05 21:56 UTC (permalink / raw)
  To: crossgcc; +Cc: Michael Hope

Michael, All,

On Thursday 29 September 2011 01:41:39 Michael Hope wrote:
> # HG changeset patch
> # User Michael Hope <michael.hope@linaro.org>
> # Date 1317253242 -46800
> # Node ID 69e6e581338dc4558d87fdcde9d9cbf8466893c9
> # Parent  780d29fbc4c574ded2248f55e77dd7cb1540aea4
> Add a 'auto' value for the number of parallel jobs.

Applied as #f2495884ca3e. Thank you!

Regards,
Yann E. MORIN.

-- 
.-----------------.--------------------.------------------.--------------------.
|  Yann E. MORIN  | Real-Time Embedded | /"\ ASCII RIBBON | Erics' conspiracy: |
| +33 662 376 056 | Software  Designer | \ / CAMPAIGN     |  ___               |
| +33 223 225 172 `------------.-------:  X  AGAINST      |  \e/  There is no  |
| http://ymorin.is-a-geek.org/ | _/*\_ | / \ HTML MAIL    |   v   conspiracy.  |
'------------------------------^-------^------------------^--------------------'

--
For unsubscribe information see http://sourceware.org/lists.html#faq

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2011-10-05 21:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-09-28 23:42 [PATCH] Add a 'auto' value for the number of parallel jobs Michael Hope
2011-10-05 21:56 ` Yann E. MORIN

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).