Mir

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

Proposed by Daniel d'Andrada
Status: Merged
Approved by: kevin gunn
Approved revision: no longer in the source branch.
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
=== modified file 'cross-compile-chroot.sh'
--- cross-compile-chroot.sh 2013-08-28 03:41:48 +0000
+++ cross-compile-chroot.sh 2013-10-02 10:13:22 +0000
@@ -4,6 +4,7 @@
4set -e4set -e
55
6BUILD_DIR=build-android-arm6BUILD_DIR=build-android-arm
7NUM_JOBS=$(( `grep -c ^processor /proc/cpuinfo` + 1 ))
78
8if [ "$MIR_NDK_PATH" = "" ]; then9if [ "$MIR_NDK_PATH" = "" ]; then
9 export MIR_NDK_PATH=`pwd`/partial-armhf-chroot10 export MIR_NDK_PATH=`pwd`/partial-armhf-chroot
@@ -32,6 +33,6 @@
32 -DMIR_PLATFORM=android \33 -DMIR_PLATFORM=android \
33 .. 34 ..
3435
35 cmake --build .36 cmake --build . -- -j${NUM_JOBS}
3637
37popd ${BUILD_DIR} > /dev/null 38popd ${BUILD_DIR} > /dev/null

Subscribers

People subscribed via source and target branches