-
Notifications
You must be signed in to change notification settings - Fork 185
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add make version 4.3 to speedup parallel build #72
Comments
I think this is an exercise best left up to the user. We only use |
So I wired up a benchmark with GCC and the initial results for make 4.3 don't seem good.
I am building |
Thanks for the numbers @nathanchance. BTW, I see the latest make in Debian includes
I agree that using make v4.3 might be of a higher interest when building the Linux-kernel. UPDATE: Add Link to Debian bug #890309. [1] https://sources.debian.org/src/make-dfsg/4.2.1-1.2/debian/changelog/#L13 |
Clang doesn’t seem to be any better:
Maybe Linus’ pipe changes make 4.3 better but on this machine (stock Ubuntu 18.04 with the stock 4.15 kernel), it is a regression and I don’t think that should be shipped to users. |
This is outside the scope of the script. If you want a newer version of |
Update 2020-05-22:
Numbers please:
|
Both user and system times are better with 4.3 but elapsed time is worse?
This is confusing? The dependency is the other way: I thought Linus' pipe commit isn't really a bug fix but a speedup, which happens to trigger a bug in 4.2.1, which 4.3 is fixing. |
I have no numbers for you. But as you say and that is what I have understood Linus' pipe improvements in Linux v5.7 is a speedup when used together with make version 4.3. If you have a vanilla make version 4.2.1 without the See Debian bug below [1] and noted in previous conversation here. Jonathan Derrick reports "Parallel compilation performance regression" in [2] with As said we are talking here about tc-build performance in building a llvm-toolchain - without building a Linux-kernel in my case. According to @nathanchance the build-host is Ubuntu 18.04 LTS with Linux v4.15. [1] https://bugs.debian.org/890309 |
Yes, but I'd put the emphasis slightly differently. SV51159 is fixing a bug in Make 4.2.1 which exists even before Linus' pipe patches. After those patches, the Make bug is much more likely to trigger, thus those patches are effectively a performance regression if you don't have SV51159.
yes :)
i.e. you mostly use cmake, not make, and cmake doesn't use pipes for implementing parallelism?
|
I must have misunderstood then. I can't explain the regression in compile time but I can try to run the benchmarks on a few different machines to see if those measurements were inaccurate or an outlier. |
Maybe it was just an Ubuntu 18.04 fluke or something since I see no regression with 4.3 on two machines running Ubuntu 20.04. Kernel version on both machines:
c3.medium.x86Clang 11.0.0:
GCC 10.1.0:
x2.xlarge.x86Clang 11.0.0 (do note this one had an outlier, I just don't want to re-run it):
GCC 10.1.0:
If you are curious about doing your own benchmarks, this is the script I used. I recommend running it in a $ cat test.sh
#!/usr/bin/env bash
set -eux
BASE=$(dirname "$(readlink -f "${0}")")
cd "${BASE}"
# Grab some sources/toolchains
[[ -d make-4.2.1 ]] || curl -LSs http://ftp.gnu.org/gnu/make/make-4.2.1.tar.gz | tar -xzf -
[[ -d make-4.3 ]] || curl -LSs http://ftp.gnu.org/gnu/make/make-4.3.tar.gz | tar -xzf -
[[ -d linux-5.7.4 ]] || curl -LSs https://cdn.kernel.org/pub/linux/kernel/v5.x/linux-5.7.4.tar.xz | tar -xJf -
[[ -d tc-build ]] || git clone https://github.com/ClangBuiltLinux/tc-build
[[ -x gcc-10.1.0-nolibc/aarch64-linux/bin/aarch64-linux-gcc ]] || curl -LSs https://mirrors.edge.kernel.org/pub/tools/crosstool/files/bin/x86_64/10.1.0/x86_64-gcc-10.1.0-nolibc-aarch64-linux.tar.xz | tar -xJf -
# Build make binaries
for MAKE_VER in 4.2.1 4.3; do
cd "${BASE}"/make-"${MAKE_VER}"
if [[ ! -x make ]]; then
# Fix error due to definition of __alloca
[[ ${MAKE_VER} = "4.2.1" ]] && sed -i '211d;232d' glob/glob.c
./configure
make -j"$(nproc)"
fi
done
# Build clang + aarch64 binutils
TC_BLD_BIN=${BASE}/tc-build/install/bin
[[ -x ${TC_BLD_BIN}/aarch64-linux-gnu-as ]] || "${BASE}"/tc-build/build-binutils.py -t aarch64
[[ -x ${TC_BLD_BIN}/clang ]] || "${BASE}"/tc-build/build-llvm.py \
--check-targets clang lld llvm \
--projects "clang;lld" \
--targets "AArch64;X86"
# Move into kernel source
cd "${BASE}"/linux-5.7.4
GCC_MAKE_COMMAND="make -skj$(nproc) ARCH=arm64 CROSS_COMPILE=${BASE}/gcc-10.1.0-nolibc/aarch64-linux/bin/aarch64-linux- O=out defconfig all"
hyperfine \
--export-markdown "${BASE}"/make-gcc-results.md \
--prepare 'rm -rf out' \
--runs 25 \
--style basic \
--warmup 1 \
"${BASE}/make-4.2.1/${GCC_MAKE_COMMAND}" \
"${BASE}/make-4.3/${GCC_MAKE_COMMAND}"
export PATH=${TC_BLD_BIN}:${PATH}
CLANG_MAKE_COMMAND="make -skj$(nproc) ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu- LLVM=1 O=out defconfig all"
hyperfine \
--export-markdown "${BASE}"/make-clang-results.md \
--prepare 'rm -rf out' \
--runs 25 \
--style basic \
--warmup 1 \
"${BASE}/make-4.2.1/${CLANG_MAKE_COMMAND}" \
"${BASE}/make-4.3/${CLANG_MAKE_COMMAND}" |
My observation on Debian/testing AMD64 were similiar: No big differences in build-time between Debian's make v4.2.1 and v4.3. |
Hi,
as pointed out at the first ClangBuiltLinux Meetup in Zurich I suggest to try
make version 4.3
to check if we see some speedups in parallel builds.The official release announcement [1] and a review in German [2] is added.
While dealing with
GNU make
I fell over this commit ("pipe: use exclusive waits when reading or writing") in Linus tree [3] which reports to speedup parallel-make-jobs when building a Linux-kernel significantly.Speaking for the Debian side there is 'make (4.2.1-1.2)` in buster/testing/unstable available.
[1] https://lists.gnu.org/archive/html/info-gnu/2020-01/msg00004.html
[2] https://www.heise.de/developer/meldung/Build-Tool-GNU-Make-4-3-verbessert-die-Performance-4641700.html
[3] https://git.kernel.org/linus/0ddad21d3e99c743a3aa473121dc5561679e26bb
The text was updated successfully, but these errors were encountered: