Lc0 — Building Lc0 version 0.30 on Debian 12
We have previously dedicated three blog posts in French on compiling the neural network chess engine Lc0 (Leela Chess Zero) on Ubuntu 18.04. A new version 0.30.0 has been released on July 21, 2023.
Here's the process to compile Lc0 on Debian 12 and Ubuntu 23.04.
Installing requirements
As a root
user (or with sudo
on Ubuntu):
apt update
apt install git build-essential meson
NVIDIA GPU Support
To compile Lc0 with the support for NVIDIA GPUs,
you should add the two repositories non-free
and contrib
during the installation phase of prerequisites as described above.
As a root
user (or with sudo
on Ubuntu):
apt-add-repository non-free
apt-add-repository contrib
apt update
apt install nvidia-cuda-toolkit nvidia-cudnn
Building the source code
Navigate into the directory lc0 created by the previous command:
cd lc0
./build.sh
Testing
The executable lc0
generated by the build process can be found in the directory build/release/
.
cd build/release/
Lc0 is a neural chess engine, requiring a pre-trained neural network for its operation. The simplest solution is to use the one from the official release (791556.pb.gz
). It can be downloaded from the site https://training.lczero.org/networks/. For more information about available networks, see the website https://lczero.org/play/networks/bestnets/.
The pre-trained network file 791556.pb.gz
can be downloaded using the following command:
wget https://training.lczero.org/get_network?sha=f404e156ceb2882470fd8c032b8754af0fa0b71168328912eaef14671a256e34 -O 791556.pb.gz
Once you have obtained the pre-trained network, you can run a benchmark with the following command:
./lc0 benchmark
You should see an output similar to this:
_
| _ | |
|_ |_ |_| v0.30.0 built Aug 28 2023
Found pb network file: ./791556.pb.gz
Creating backend [eigen]...
Using Eigen version 3.4.0
Eigen max batch size is 256.
...
...
If you compiled Lc0 with the support for NVIDIA GPUs (and have a compatible graphics card), you should see an output similar to this:
_
| _ | |
|_ |_ |_| v0.30.0 built Aug 28 2023
Found pb network file: ./791556.pb.gz
Creating backend [cudnn-auto]...
Switching to [cudnn-fp16]...
CUDA Runtime version: 11.8.0
Cudnn version: 8.5.0
Latest version of CUDA supported by the driver: 12.2.0
GPU: NVIDIA GeForce GTX 1650 Ti
GPU memory: 3.81238 GiB
GPU clock frequency: 1485 MHz
GPU compute capability: 7.5
...
...
The builds of Lc0 provided in this blog can be found on GitHub within the repository https://github.com/jldblog/lc0-linux-unofficial-builds.