Skip to content
EntityQ55391485· pop 15· linked from 579 articles

Leela Chess Zero

Sign in to save

Also known as LeelaChessZero, LCZero, Lc0

free and open-source chess engine

Source code

Lc0 is a UCI-compliant chess engine designed to play chess via neural network, specifically those of the LeelaChessZero project. For essentially all purposes, including selfplay game generation and match play, we highly recommend using the latest release/version branch (for example release/0.32 ), which is equivalent to using the latest version tag. Versioning follows the Semantic Versioning guidelines, with major, minor and patch sections. The training server enforces game quality using the versions output by the client and engine. If you prefer to download an archive: Download the .zip file (.tar.gz archive is also available) Extract Having successfully acquired Lc0 via either of these methods, proceed to the build section below and follow the instructions for your OS. Building should be easier now than it was in the past. Please report any problems you have. Building lc0 requires the Meson build system and at least one backend library for evaluating the neural network, as well as a few libraries. If your system already has these libraries installed, they will be used; otherwise Meson will generate its own copy (a "subproject"), which in turn requires that git is installed (yes, separately from cloning the actual lc0 repository). Meson also requires python and Ninja. Backend support includes (in theory) any CBLAS-compatible library for CPU usage, but OpenBLAS or Intel's DNNL are the main ones. For GPUs, the following are supported: CUDA (with optional cuDNN), various flavors of onnxruntime, and Apple's Metal Performance Shaders. There is also experimental SYCL support for AMD and Intel GPUs. For Ubuntu 20.04 you need meson, ninja and gcc-10 before performing the steps above. The following should work: Make sure that ~/.local/bin is in your PATH environment variable. You can now type lc0 --help and start. Here are the brief instructions for CUDA/cuDNN, for details and other options see windows-build.md and the instructions in the following sections. 1. Install Microsoft Visual Studio (2019 version 16.11 or later) 2. Install CUDA 3. (Optionally install cuDNN). 4. Install Python3 if you didn't install it with Visual Studio. 5. Install Meson: pip3 install --upgrade meson 6. If CUDA PATH is not set (run the set command to see the full list of variables), edit build.cmd and set the CUDA PATH with your CUDA directory If you also want cuDNN, set CUDNN PATH with your cuDNN directory (not needed if it is the same with CUDA PATH ). 7. Run build.cmd . It will ask permission to delete the build directory, then generate MSVS project and pause. 8. Open generated solution build/lc0.sln in Visual Studio and build it yourself. You will need xcode and python3 installed. Then you need to install some required packages through Terminal: 1. Install meson: pip3 install meson 2. Install ninja: pip3 install ninja Now download the lc0 source, if you haven't already done so, following the instructions earlier in the page. Starting with v0.32.0, we are also offering a pre-compiled version that can be downloaded from the release page. CUDA can be downloaded and installed following the instructions in from . The build in most cases will pick it up with no further action. However if the cuda compiler ( nvcc ) is not found you can call the build like this: PATH=/usr/local/cuda/bin:$PATH ./build.sh , replacing the path with the correct one for nvcc . Note that CUDA uses the system compiler and stops if it doesn't recognize the version, even if newer. This is more of an issue with new Linux versions, but you can get around with the nvcc ccbin build option to specify a different compiler just for cuda. As an example, adding -Dnvcc ccbin=g++-11 to the build command line will use g++-11 with cuda instead of the system compiler. Lc0 offers several ONNX based backends, namely onnx-cpu, onnx-cuda, onnx-trt, onnx-rocm and on Windows onnx-dml, utilizing the execution providers offered by onnxruntime. Some Linux systems are starting to offer onnx

Excerpt from the source-code README · 12,233 chars · not written by Vinony