Distributed kernel building
Summary
As I’ve written in previous article, I built the Raspberry Pi cluster, which has 6 Raspberry Pis (24 cores in total!!). One of the things that I wanted to do on this Raspberry Pi cluster is, building Linux kernel using many cores. There’s a tool called “distcc”, which distributes the compilation job to the cluster nodes, and makes the process faster. Here’s what I experimented.
Installing distcc
This is pretty simple. If you have Ubuntu, you can use “apt” to install it.
sudo apt install distcc
Configuration is pretty straight forward too. Open /etc/default/distcc and add few lines (do this on all the machines in cluster).
STARTDISTCC=”true”
ALLOWEDNETS="192.168.150.0/24" # Change this for your network
LISTENER="0.0.0.0"
Then, before you run parallel job, create file in home directory ~/.distcc/hosts and enumerate which servers you would like to use (space delimited). The number after “/” is, number of jobs on that host.
localhost/4 192.168.150.210/4 192.168.150.211/4 …
That’s it!! When you run your build, simply add variables like below;
make ARCH=arm -j24 CC=distcc CXX=distcc Image modules
Experimentation
I built the Linux kernel for Raspberry Pi 4, with few different configurations. Results are below;
It’s not like “double the resource, double the speed”, but compile speed has been increased by using more resources.
I’m pretty much satisfied with this result.
…Oh question? What that desktop computer beside the cluster is?? Compared to that computer, how fast the cluster is??? That is…my workstation, which can build the Linux kernel within…3 mins… (it, alone, has 14 cores/28 threads)…