Well, this is quite a pain in the neck. What eventually worked on my machine was the procedure
Example of compiling and running - Ubuntu described here:
https://github.com/gcp/leela-zeroCode:
# Test for OpenCL support & compatibility
sudo apt install clinfo && clinfo
# Clone github repo
git clone https://github.com/gcp/leela-zero
cd leela-zero/src
sudo apt install libboost-dev libboost-program-options-dev libopenblas-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev
make
cd ..
wget http://zero.sjeng.org/best-network
src/leelaz --weights best-network
In an ideal world, you would excecute these commands in the shell and be done with it. In practice, you are very likely going to run into some issues, like missing dependencies. Also very likely, you will have to create symbolic links in e.g. usr/etc and the like.
So let's walk through the commands one-by-one. I hope the following will help you through this maze.
Code:
sudo apt install clinfo && clinfo
The tool
clinfo is for GPU diagnostics. It is not needed to run LZ as such. However, you can use it to check if you've got the GPU drivers up and running. Execute the command in the shell and pray that your graphic card is listed as one of the available devices in the command output. If it is not, it's time for specific troubleshooting. Most likely, you will have to install a vendor-provided driver for your GPU. There's also a way to compile LZ without GPU support (see later).
Code:
git clone -b next https://github.com/gcp/leela-zero
cd leela-zero/src
With these commands, you will check out the LZ source code from GitHub. The folder
leela-zero will be created by the
git tool. In contrast to the command given on the LZ GitHub page, the command here will check out the
next branch via the option
-b next. This is basically a future release candidate. However, it is both faster and also required to use LZ in Lizzie.
Before you execute these commands, create a directory for self-compiled tools in your home directory and navigate into this directory before checking out. This is not necessary as such but will help you find your stuff more easily, like for example when you need to enter the path to LZ in a Go GUI.
You may find that
git isn't installed. In this case the error message should point you to the required actions, very likely something like
sudo apt install git. Note, that
sudo is used to execute a command with super user rights. You will be prompted to enter the root password.
Once you have succeeded in checking out the source code and navigated into the source directory (second command), you're ready for the real fun.
Code:
sudo apt install libboost-dev libboost-program-options-dev libopenblas-dev opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev zlib1g-dev
This part of the procedure installs the dependencies. Just hope that you don't run into weird errors, because then it's time for Google, i.e. search Google for the error messages and try to find forum posts describing the remedy. The remedy will usually be something like installing another depencency, editing a configuration file or creating a symbolic link.
Code:
make
Given that the dependencies have been installed properly, this command will build the binary. If you run into errors, some of the remedies mentioned above (symbolic links, configuration file entries...) might help here as well. Before starting over, it's a good idea to do so from scratch by executing the command
make clean first.
Code:
cd ..
wget http://zero.sjeng.org/best-network
When the binary has been built successfully, the rest is piece of cake. Navigate to the folder containing the binary and download the current best network weights using
wget. That way, the network weights and the binary will be stored in the same folder.
Code:
leelaz --weights best-network
The binary will be called
leelaz. It must be executed with the shown command line argument for the weights file. When you configure a Go GUI to use LZ, you might have to prepend the absolute path to the folder where then binary and weight file are located.
EDIT #1:
If you want to build LZ without GPU support, you will have to insert the following line into the file
config.h in the directory
src.
Code:
#define USE_CPU_ONLY
EDIT #2:
Changed GitHub part to checking out the next branch.