Mir

Merge lp:~dandrader/mir/cross-compile-parallel into lp:mir

Proposed by Daniel d'Andrada
Status: Merged
Approved by: kevin gunn
Approved revision: 1098
Merged at revision: 1100
Proposed branch: lp:~dandrader/mir/cross-compile-parallel
Merge into: lp:mir
Diff against target: 19 lines (+2/-1)
1 file modified
cross-compile-chroot.sh (+2/-1)
To merge this branch: bzr merge lp:~dandrader/mir/cross-compile-parallel
Reviewer Review Type Date Requested Status
PS Jenkins bot (community) continuous-integration Approve
Alan Griffiths Approve
Daniel van Vugt Needs Information
Review via email: mp+188797@code.launchpad.net

Commit message

Make cross-compile-chroot.sh build in parallel when suitable

Use all available CPU cores to speed up the build

To post a comment you must log in.
Revision history for this message
Daniel van Vugt (vanvugt) wrote :

Good idea but:
NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))

Why the "+ 1"?

review: Needs Information
Revision history for this message
Daniel d'Andrada (dandrader) wrote :

> Good idea but:
> NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
>
> Why the "+ 1"?

To squeeze more juice out of the CPU, helping ensure it's 100% busy building the code. :)
In my experience a CPU can handle more build threads than its number of cores without hampering the execution speed of the individual threads.

Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> > Good idea but:
> > NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
> >
> > Why the "+ 1"?
>
> To squeeze more juice out of the CPU, helping ensure it's 100% busy building
> the code. :)
> In my experience a CPU can handle more build threads than its number of cores
> without hampering the execution speed of the individual threads.

I sort of agree - compilation (even C++) is usually I/O bound.

I think "+ 1" is a bit arbitrary, but not harmful.

review: Approve
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'cross-compile-chroot.sh'
2--- cross-compile-chroot.sh 2013-08-28 03:41:48 +0000
3+++ cross-compile-chroot.sh 2013-10-02 10:13:22 +0000
4@@ -4,6 +4,7 @@
5 set -e
6
7 BUILD_DIR=build-android-arm
8+NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
9
10 if [ "$MIR_NDK_PATH" = "" ]; then
11 export MIR_NDK_PATH=`pwd`/partial-armhf-chroot
12@@ -32,6 +33,6 @@
13 -DMIR_PLATFORM=android \
14 ..
15
16- cmake --build .
17+ cmake --build . -- -j${NUM_JOBS}
18
19 popd ${BUILD_DIR} > /dev/null

Subscribers

People subscribed via source and target branches