Step by step instructions on how to participate in building the best Chess AI (Leela Chess). Requirements: A machine with (hardware support for) OpenCL 1.1 or higher.
At the time of writing this, only the precomplied client worked on Debian 9.4. Running a locally built client failed on failed with:
./client_linux: line 1: syntax error near unexpected token `newline' ./client_linux: line 1: `!<arch>'
Download the latest version of client_linux
from https://github.com/glinscott/leela-chess/releases. Make sure the file is executable, e.g.
chmod 755 client_linux
If you really want to compile your own client, the see here
Install build requirements of leela-chess
. Note that if you already have a working installation of opencl, don't install opencl packages, eg. ocl-icd-libopencl1 conflicts with nvidia-libopencl1-dev.
cd ~/
sudo apt-get install git-all cmake libboost-all-dev libopenblas-dev opencl-headers zlib1g-dev ocl-icd-libopencl1 ocl-icd-opencl-dev
Install the source code of leela-chess
.
git clone https://github.com/glinscott/leela-chess.git cd leela-chess git submodule update --init --recursive mkdir build && cd build cmake ..
If you have installed custom libraries, i.e. the non-free library CUDA in /usr/local/cuda/include
, then you will have to patch all make-files which use the argument "-isystem" and replace that string with "-I".
find CMakeFiles -type f -exec sed -i 's/-isystem /-I/g' "{}" +
make
will somehow, magically restore the old state!
grep -R isystem CMakeFiles
CMakeFiles/objs.dir/flags.make CMakeFiles/lczero.dir/flags.make CMakeFiles/tests.dir/flags.make
leela-chess
make
Put the newly built binary in the same directory as the client.
If you have downloaded a precompiled client, then just make a directory and put both files there. If you built the client locally, then something like this should work.
cp lczero ~/go/src/github.com/Tilps/chess/
cd ~/go/src/github.com/Tilps/chess/
Execute the client, it will automatically start leela-chess
.
./client_linux
Install the GO programming language.
sudo apt-get install golang-1.10 export GOROOT=/usr/lib/go-1.10/ export GOPATH=${HOME}/go mkdir -p ${GOPATH}/src PATH=/usr/lib/go-1.10/bin:$PATH
Get two packages required by lczero-client
.
go get -u github.com/Tilps/chess go get -u github.com/nightlyone/lockfile
Get the client.
mkdir -p ~/src
cd ~/src
git clone git@github.com:leelachesszero/lczero-client.git
Build the client.
cd ~/src/lczero-client git pull export GOPATH=${HOME}/go:${HOME}/src/lczero-client go build lc0_main.go
export GOPATH=${HOME}/go:${HOME}/src/lczero-client
That's all for the client, now let's install and compile leela-chess.