Compiling 1 Engine and Its Interface for Debian 10 (Buster)
Posted: Fri Jan 10, 2020 4:29 pm
The title is a nod to Xela's excellent work here.
viewtopic.php?f=18&t=16046&start=0
I previously had Lizzie and Leela Zero working without a GPU under Debian 9, but the atttempt to
replicate it six months ago under Debian 10 failed, in ways that are now lost in the mists of time.
I decided to try again at Christmas when my son would be able to help out, and to buy and install a
GPU to make things harder. This post is a detailed account of what happened, because...
1) I like war stories; and
2) The record may help with the inevitable repeat when Debian 11 becomes the next stable release.
It is likely that 80% of what we did was unnecessary, but I got a working setup in the end, I learnt
about Docker and I get this chance to muse about my limitations in public. Extensive use is made of
hidden sections to improve the flow.
To start with the conclusion: we bought an Nvidia GeForce GTX 1660. It manages 250 to 1000 visits
per second, depending on the game state. Weights file
877d874de6dc08110158ac3b321f131cb6f276c5bd07eaa4bef9fdf12c9f3f68.gz was used.
As an odd test of accuracy, Leela reproduced AlphaGo's mistake in answer to Lee Sedol's move 78
in game 4 of their match.
Why was the task so hard?
1. The GPU card was installed for use with an existing Linux installation. If the GPU had been
present at the time of installation, it is possible that more support would have been built in to
the O/S already.
2. The available online instructions for Lizzie and Leela under Linux were written by and for the
Ubuntu distribution, and things are a bit different with Debian. This actually helped us during
software installation because my son has a laptop with a small pre-installed Nvidia GPU running
Ubuntu. He quickly got Lizzie and Leela up and running in that environment, which we could then try
to replicate under Debian.
3. The task may be a bit harder under Debian 10 than it was under 9. The next hidden section
describes my usual approach to Debian upgrades and how it failed to help in this case.
My 70-year-old eyes, shaking hands and inflexible brain would have been unequal to the task
without help.
The hidden section describes my usual approach to Operating System upgrades.
There are various online instructions for building Leela zero and Lizzie for Linux. We decided to
compile from source. This worked easily under Ubuntu, so we decided to prototype the method for
Debian by installing a Docker instance of Debian 10 on the Ubuntu laptop and then to repeat the
process inside Docker. That worked, though it was not possible to run Lizzie inside Docker because
the Debian instance that we chose is a small one that does not have a Graphical User Interface.
Instead, the resulting binaries were copied out of Docker into the host Ubuntu system, where they
did run. We decided to repeat the process on the target PC with Debian 10 as the host and the same
Docker instance of Debain 10. That also worked, and the binaries from Docker also ran on the Debian 10
host. Our scripts appear below. This same method will be used when Lizzie, Leela or the Operating
System are next upgraded, because new stuff can be tried out inside Docker without messing up the
existing running system.
GPU Choice and Installation
After improving the PC's cooling and installing the GPU board, we closed the case and moved the HDMI
lead from the socket on the PC motherboard to the socket on the new GPU. Fortunately, the Linux
kernel already contained the reverse-engineered Nouveau driver for Nvidia devices, so we could
still see screen output after rebooting, even though the screen resolution was wrong and some
desktop elements were therefore off the screen.
The following commands added the non-free driver and a detection utility. Non-free sources were
already enabled in /etc/apt/sources.list. We ran everything as root. You might want to be more
careful.
We then rebooted and adjusted the display settings using the GUI's Display Settings editor. We
changed the default 1024x768 resolution to match the actual screen and then adjusted the dots per
inch (DPI) until text looked right. The resulting display looked like it did before the GPU was
added. We also disabled the default nouveau driver:
Two more detailed and painstaking sets of instructions for Debian 10 are available here:
https://linuxconfig.org/how-to-install- ... ster-linux
We then installed the following packages to support Nvidia and OpenCl. (The system probably had
some of these already, but asking for them again causes no problems.)
The following hidden section contains all the details about the Docker build.
Now I just have to relearn how to use Lizzie for analysis, and learn about Katago which is not yet installed.
viewtopic.php?f=18&t=16046&start=0
I previously had Lizzie and Leela Zero working without a GPU under Debian 9, but the atttempt to
replicate it six months ago under Debian 10 failed, in ways that are now lost in the mists of time.
I decided to try again at Christmas when my son would be able to help out, and to buy and install a
GPU to make things harder. This post is a detailed account of what happened, because...
1) I like war stories; and
2) The record may help with the inevitable repeat when Debian 11 becomes the next stable release.
It is likely that 80% of what we did was unnecessary, but I got a working setup in the end, I learnt
about Docker and I get this chance to muse about my limitations in public. Extensive use is made of
hidden sections to improve the flow.
To start with the conclusion: we bought an Nvidia GeForce GTX 1660. It manages 250 to 1000 visits
per second, depending on the game state. Weights file
877d874de6dc08110158ac3b321f131cb6f276c5bd07eaa4bef9fdf12c9f3f68.gz was used.
As an odd test of accuracy, Leela reproduced AlphaGo's mistake in answer to Lee Sedol's move 78
in game 4 of their match.
Why was the task so hard?
1. The GPU card was installed for use with an existing Linux installation. If the GPU had been
present at the time of installation, it is possible that more support would have been built in to
the O/S already.
2. The available online instructions for Lizzie and Leela under Linux were written by and for the
Ubuntu distribution, and things are a bit different with Debian. This actually helped us during
software installation because my son has a laptop with a small pre-installed Nvidia GPU running
Ubuntu. He quickly got Lizzie and Leela up and running in that environment, which we could then try
to replicate under Debian.
3. The task may be a bit harder under Debian 10 than it was under 9. The next hidden section
describes my usual approach to Debian upgrades and how it failed to help in this case.
My 70-year-old eyes, shaking hands and inflexible brain would have been unequal to the task
without help.
The hidden section describes my usual approach to Operating System upgrades.
compile from source. This worked easily under Ubuntu, so we decided to prototype the method for
Debian by installing a Docker instance of Debian 10 on the Ubuntu laptop and then to repeat the
process inside Docker. That worked, though it was not possible to run Lizzie inside Docker because
the Debian instance that we chose is a small one that does not have a Graphical User Interface.
Instead, the resulting binaries were copied out of Docker into the host Ubuntu system, where they
did run. We decided to repeat the process on the target PC with Debian 10 as the host and the same
Docker instance of Debain 10. That also worked, and the binaries from Docker also ran on the Debian 10
host. Our scripts appear below. This same method will be used when Lizzie, Leela or the Operating
System are next upgraded, because new stuff can be tried out inside Docker without messing up the
existing running system.
GPU Choice and Installation
lead from the socket on the PC motherboard to the socket on the new GPU. Fortunately, the Linux
kernel already contained the reverse-engineered Nouveau driver for Nvidia devices, so we could
still see screen output after rebooting, even though the screen resolution was wrong and some
desktop elements were therefore off the screen.
The following commands added the non-free driver and a detection utility. Non-free sources were
already enabled in /etc/apt/sources.list. We ran everything as root. You might want to be more
careful.
Code: Select all
apt-get install -y nvidia-detect nvidia-driver nvidia-libopencl1changed the default 1024x768 resolution to match the actual screen and then adjusted the dots per
inch (DPI) until text looked right. The resulting display looked like it did before the GPU was
added. We also disabled the default nouveau driver:
Code: Select all
echo blacklist nouveau > /etc/modprobe.d/blacklist-nvidia-nouveau.confhttps://linuxconfig.org/how-to-install- ... ster-linux
We then installed the following packages to support Nvidia and OpenCl. (The system probably had
some of these already, but asking for them again causes no problems.)
Code: Select all
apt-get install -y cmake g++ libboost-dev libboost-program-options-dev libboost-filesystem-dev
apt-get install -y opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev
apt-get install -y nvidia-opencl-icd nvidia-cuda-mps
apt-get install -y qtbase5-dev maven