{"id":13765120,"url":"https://github.com/LeelaChessZero/lc0","last_synced_at":"2025-05-10T20:31:41.297Z","repository":{"id":39179125,"uuid":"135489692","full_name":"LeelaChessZero/lc0","owner":"LeelaChessZero","description":"Open source neural network chess engine with GPU acceleration and broad hardware support.","archived":false,"fork":false,"pushed_at":"2025-05-03T21:44:16.000Z","size":40194,"stargazers_count":2614,"open_issues_count":198,"forks_count":561,"subscribers_count":91,"default_branch":"master","last_synced_at":"2025-05-03T22:25:50.150Z","etag":null,"topics":["alphazero","alphazero-inspired","chess","chess-ai","chess-engine","cuda","deep-learning","deep-reinforcement-learning","gpu","leela-chess-zero","neural-networks","uci"],"latest_commit_sha":null,"homepage":"https://lczero.org/","language":"C++","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LeelaChessZero.png","metadata":{"files":{"readme":"README.md","changelog":"changelog.txt","contributing":"CONTRIBUTING.md","funding":null,"license":"COPYING","code_of_conduct":null,"threat_model":null,"audit":null,"citation":"CITATION.cff","codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":"AUTHORS","dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2018-05-30T19:41:42.000Z","updated_at":"2025-05-03T21:44:20.000Z","dependencies_parsed_at":"2023-02-16T14:00:35.099Z","dependency_job_id":"2a690fb4-30cb-4a19-a380-b79576c72f8c","html_url":"https://github.com/LeelaChessZero/lc0","commit_stats":null,"previous_names":[],"tags_count":86,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeelaChessZero%2Flc0","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeelaChessZero%2Flc0/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeelaChessZero%2Flc0/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LeelaChessZero%2Flc0/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LeelaChessZero","download_url":"https://codeload.github.com/LeelaChessZero/lc0/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253480509,"owners_count":21915248,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alphazero","alphazero-inspired","chess","chess-ai","chess-engine","cuda","deep-learning","deep-reinforcement-learning","gpu","leela-chess-zero","neural-networks","uci"],"created_at":"2024-08-03T16:00:34.193Z","updated_at":"2025-05-10T20:31:36.374Z","avatar_url":"https://github.com/LeelaChessZero.png","language":"C++","funding_links":[],"categories":["Chess engines","C++"],"sub_categories":[],"readme":"[![CircleCI](https://circleci.com/gh/LeelaChessZero/lc0.svg?style=shield)](https://circleci.com/gh/LeelaChessZero/lc0)\n[![AppVeyor](https://ci.appveyor.com/api/projects/status/3245b83otdee7oj7?svg=true)](https://ci.appveyor.com/project/leelachesszero/lc0)\n\n# Lc0\n\nLc0 is a UCI-compliant chess engine designed to play chess via neural network, specifically those of the [LeelaChessZero project](https://lczero.org).\n\n## Downloading source\n\nLc0 can be acquired either via a git clone or an archive download from GitHub. Be aware that there is a required submodule which isn't included in source archives.\n\nFor essentially all purposes, including selfplay game generation and match play, we highly recommend using the latest `release/version` branch (for example `release/0.31`), which is equivalent to using the latest version tag.\n\nVersioning 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.\n\n\nDownload using git:\n\n```shell\ngit clone -b release/0.31 --recurse-submodules https://github.com/LeelaChessZero/lc0.git\n```\n\nIf you have cloned already an old version, fetch, view and checkout a new branch:\n```shell\ngit fetch --all\ngit branch --all\ngit checkout -t remotes/origin/release/0.31\n```\n\n\nIf you prefer to download an archive, you need to also download and place the submodule:\n * Download the [.zip](https://api.github.com/repos/LeelaChessZero/lc0/zipball/release/0.31) file ([.tar.gz](https://api.github.com/repos/LeelaChessZero/lc0/tarball/release/0.31) archive is also available)\n * Extract\n * Download https://github.com/LeelaChessZero/lczero-common/archive/master.zip (also available as [.tar.gz](https://github.com/LeelaChessZero/lczero-common/archive/master.tar.gz))\n * Move the second archive into the first archive's `libs/lczero-common/` folder and extract\n * The final form should look like `\u003cTOP\u003e/libs/lczero-common/proto/`\n\nHaving successfully acquired Lc0 via either of these methods, proceed to the build section below and follow the instructions for your OS.\n\n\n## Building and running Lc0\n\nBuilding should be easier now than it was in the past. Please report any problems you have.\n\nAside from the git submodule, lc0 requires the Meson build system and at least one backend library for evaluating the neural network, as well as the required `zlib`. (`gtest` is optionally used for the test suite.) If your system already has this library installed, they will be used; otherwise Meson will generate its own copy of the two (a \"subproject\"), which in turn requires that git is installed (yes, separately from cloning the actual lc0 repository). Meson also requires python and Ninja.\n\nBackend support includes (in theory) any CBLAS-compatible library for CPU usage, such as OpenBLAS or Intel's DNNL or MKL. For GPUs, OpenCL and CUDA+cudnn are supported, while DX-12 can be used in Windows 10 with latest drivers.\n\nFinally, lc0 requires a compiler supporting C++17. Minimal versions seem to be g++ v8.0, clang v5.0 (with C++17 stdlib) or Visual Studio 2017.\n\n*Note* that cuda checks the compiler version and stops even with newer compilers, and to work around this we have added the `nvcc_ccbin` build option. This is more of an issue with new Linux versions, but you can get around it by using an earlier version of gcc just for cuda. As an example, adding `-Dnvcc_ccbin=g++-9` to the `build.sh` command line will use g++-9 with cuda instead of the system compiler.\n\nGiven those basics, the OS and backend specific instructions are below.\n\n### Linux\n\n#### Generic\n\n1. Install backend:\n    - If you want to use NVidia graphics cards Install [CUDA](https://developer.nvidia.com/cuda-zone) and [cuDNN](https://developer.nvidia.com/cudnn).\n    - If you want to use AMD graphics cards install OpenCL.\n    - if you want OpenBLAS version Install OpenBLAS (`libopenblas-dev`).\n2. Install ninja build (`ninja-build`), meson, and (optionally) gtest (`libgtest-dev`).\n3. Go to `lc0/`\n4. Run `./build.sh`\n5. `lc0` will be in `lc0/build/release/` directory\n6. Unzip a [neural network](https://lczero.org/play/networks/bestnets/) in the same directory as the binary.\n\nIf you want to build with a different compiler, pass the `CC` and `CXX` environment variables:\n\n    CC=clang-6.0 CXX=clang++-6.0 ./build.sh\n\n#### Note on installing CUDA on Ubuntu\n\nNvidia provides .deb packages. CUDA will be installed in `/usr/local/cuda-10.0` and requires 3GB of diskspace.\nIf your `/usr/local` partition doesn't have that much space left you can create a symbolic link before\ndoing the install; for example: `sudo ln -s /opt/cuda-10.0 /usr/local/cuda-10.0`\n\nThe instructions given on the nvidia website tell you to finish with `apt install cuda`. However, this\nmight not work (missing dependencies). In that case use `apt install cuda-10-0`. Afterwards you can\ninstall the meta package `cuda` which will cause an automatic upgrade to a newer version when that\ncomes available (assuming you use `Installer Type deb (network)`, if you'd want that (just cuda-10-0 will\nstay at version 10). If you don't know what to do, only install cuda-10-0.\n\ncuDNN exists of two packages, the Runtime Library and the Developer Library (both a .deb package).\n\nBefore you can download the latter you need to create a (free) \"developer\" account with nvidia for\nwhich at least a legit email address is required (their website says: The e-mail address is not made public\nand will only be used if you wish to receive a new password or wish to receive certain news or notifications\nby e-mail.). Further they ask for a name, date of birth (not visible later on), country, organisation (\"LeelaZero\"\nif you have none), primary industry segment (\"Other\"/none) and which development areas you are interested\nin (\"Deep Learning\").\n\n#### Ubuntu 18.04\n\nFor Ubuntu 18.04 you need the latest version of meson, libstdc++-8-dev, and clang-6.0 before performing the steps above:\n\n    sudo apt-get install libstdc++-8-dev clang-6.0 ninja-build pkg-config\n    pip3 install meson --user\n    CC=clang-6.0 CXX=clang++-6.0 INSTALL_PREFIX=~/.local ./build.sh\n\nMake sure that `~/.local/bin` is in your `PATH` environment variable. You can now type `lc0 --help` and start.\n\n#### Ubuntu 16.04\n\nFor Ubuntu 16.04 you need the latest version of meson, ninja, clang-6.0, and libstdc++-8:\n\n    wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -\n    sudo apt-add-repository 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main'\n    sudo add-apt-repository ppa:ubuntu-toolchain-r/test\n    sudo apt-get update\n    sudo apt-get install clang-6.0 libstdc++-8-dev\n    pip3 install meson ninja --user\n    CC=clang-6.0 CXX=clang++-6.0 INSTALL_PREFIX=~/.local ./build.sh\n\nMake sure that `~/.local/bin` is in your `PATH` environment variable. You can now type `lc0 --help` and start.\n\n#### openSUSE (all versions)\n\nInstructions, packages and tools for building on openSUSE are at [openSUSE_install.md](openSUSE_install.md)\n\n#### Docker\n\nUse https://github.com/vochicong/lc0-docker\nto run latest releases of lc0 and the client inside a Docker container.\n\n\n### Windows\n\nHere are the brief instructions for CUDA/CuDNN, for details and other options see `windows-build.md`.\n\n0. Install Microsoft Visual Studio (2017 or later)\n1. Install [CUDA](https://developer.nvidia.com/cuda-zone)\n2. Install [cuDNN](https://developer.nvidia.com/cudnn).\n3. Install Python3\n4. Install Meson: `pip3 install --upgrade meson`\n5. Edit `build.cmd`:\n\n* Set `CUDA_PATH` with your CUDA directory\n* Set `CUDNN_PATH` with your cuDNN directory (may be the same with CUDA_PATH)\n\n6. Run `build.cmd`. It will ask permission to delete the build directory, then generate MSVS project and pause.\n\nThen either:\n\n7. Hit `Enter` to build it.\n8. Resulting binary will be `build/lc0.exe`\n\nOr.\n\n7. Open generated solution `build/lc0.sln` in Visual Studio and build yourself.\n\n### Mac\n\nFirst you need to install some required packages through Terminal:\n1. Install brew as per the instructions at https://brew.sh/\n2. Install python3: `brew install python3`\n3. Install meson: `brew install meson`\n4. Install ninja: `brew install ninja`\n5. (For Mac OS 10.14 Mojave, or if the other step 5 fails):\n * Install developer tools: ``xcode-select --install``\n * When using Mojave install SDK headers: `installer -pkg /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg -target /` (if this doesn't work, use `sudo installer` instead of just `installer`.)\n\nOr.\n\n5. (For MacOS 10.15 Catalina, or if the other step 5 fails): \n * Install Xcode command-line tools: ``xcode-select --install``\n * Install \"XCode Developer Tools\" through the app store. (First one on the list of Apps if searched.)\n * Associate the SDK headers in XCode with a command: export CPATH=\\`xcrun --show-sdk-path\\`/usr/include\n \nNow download the lc0 source, if you haven't already done so, following the instructions earlier in the page.\n\n6. Go to the lc0 directory.\n7. Run `./build.sh -Dgtest=false` (needs step 5)\n\n### Raspberry Pi\n\nYou'll need to be running the latest Raspberry Pi OS \"buster\".\n\n1. Install OpenBLAS\n\n```shell\ngit clone https://github.com/xianyi/OpenBLAS.git\ncd OpenBLAS/\nmake\nsudo make PREFIX=/usr install\ncd ..\n```\n\n2. Install Meson\n\n```shell\npip install meson\npip install ninja\n```\n\n3. Install compiler and standard libraries\n\n```shell\nsudo apt install clang-6.0 libstdc++-8-dev\n```\n\n4. Clone lc0 and compile\n\n```shell\ngit clone https://github.com/LeelaChessZero/lc0.git\ncd lc0\ngit submodule update --init --recursive\nCC=clang-6.0 CXX=clang++-6.0 ./build.sh -Ddefault_library=static\n```\n\n5. The resulting binary will be in build/release\n\n## Python bindings\n\nPython bindings can be built and installed as follows.\n\n```shell\npip install --user git+https://github.com/LeelaChessZero/lc0.git\n```\n\nThis will build the package `lczero-bindings` and install it to your Python user install directory.\nAll the `lc0` functionality related to position evaluation is now available in the module `lczero.backends`.\nAn example interactive session can be found [here](https://github.com/LeelaChessZero/lc0/pull/1261#issuecomment-622951248).\n\n## License\n\nLeela Chess is free software: you can redistribute it and/or modify\nit under the terms of the GNU General Public License as published by\nthe Free Software Foundation, either version 3 of the License, or\n(at your option) any later version.\n\nLeela Chess is distributed in the hope that it will be useful,\nbut WITHOUT ANY WARRANTY; without even the implied warranty of\nMERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\nGNU General Public License for more details.\n\nYou should have received a copy of the GNU General Public License\nalong with Leela Chess.  If not, see \u003chttp://www.gnu.org/licenses/\u003e.\n\n### Additional permission under GNU GPL version 3 section 7\n\n_The source files of Lc0 with the exception of the BLAS and OpenCL\nbackends (all files in the `blas` and `opencl` sub-directories) have\nthe following additional permission, as allowed under GNU GPL version 3\nsection 7:_\n\nIf you modify this Program, or any covered work, by linking or\ncombining it with NVIDIA Corporation's libraries from the NVIDIA CUDA\nToolkit and the NVIDIA CUDA Deep Neural Network library (or a\nmodified version of those libraries), containing parts covered by the\nterms of the respective license agreement, the licensors of this\nProgram grant you additional permission to convey the resulting work.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeelaChessZero%2Flc0","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FLeelaChessZero%2Flc0","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FLeelaChessZero%2Flc0/lists"}