Skip to content

Latest commit

 

History

History
92 lines (88 loc) · 11.1 KB

File metadata and controls

92 lines (88 loc) · 11.1 KB

Compiling KataGo

KataGo is written in C++. It should compile on Linux or OSX via g++ that supports at least C++14, or on Windows via MSVC 15 (2017) and later. Other compilers and systems have not been tested yet. This is recommended if you want to run the full KataGo self-play training loop on your own and/or do your own research and experimentation, or if you want to run KataGo on an operating system for which there is no precompiled executable available.

Building for Distributed

As also mentioned in the instructions below but repeated here for visibility, if you also are building KataGo with the intent to use it in distributed training on https://katagotraining.org, then keep in mind:

  • You'll need to specify -DBUILD_DISTRIBUTED=1 or BUILD_DISTRIBUTED and have OpenSSL installed.
  • Building will need to happen within a Git clone of the KataGo repo, rather than a zipped copy of the source (such as what you might download from a packaged release).
  • The version will need to be supported for distributed training. The master branch will NOT work - instead please use the either latest release tag or the tip of the stable branch, these should both work.
  • Please do NOT attempt to bypass any versioning or safety checks - if you feel you need to do so, please first reach out by opening an issue or messaging in discord. There is an alternate site test.katagodistributed.org you can use if you are working on KataGo development or want to test things more freely, ask in the KataGo channel of discord to set up a test account.

Linux

  • TLDR (if you have a working GPU):
    git clone https://github.com/lightvector/KataGo.git
    cd KataGo/cpp
    # If you get missing library errors, install the appropriate packages using your system package manager and try again.
    # -DBUILD_DISTRIBUTED=1 is only needed if you want to contribute back to public training.
    cmake . -DUSE_BACKEND=OPENCL -DBUILD_DISTRIBUTED=1
    make -j 4
    
  • TLDR (building the slow pure-CPU version):
    git clone https://github.com/lightvector/KataGo.git
    cd KataGo/cpp
    # If you get missing library errors, install the appropriate packages using your system package manager and try again.
    cmake . -DUSE_BACKEND=EIGEN -DUSE_AVX2=1
    make -j 4
    
  • Requirements
  • Clone this repo:
    • git clone https://github.com/lightvector/KataGo.git
  • Compile using CMake and make in the cpp directory:
    • cd KataGo/cpp
    • cmake . -DUSE_BACKEND=OPENCL or cmake . -DUSE_BACKEND=CUDA or cmake . -DUSE_BACKEND=TENSORRT or cmake . -DUSE_BACKEND=EIGEN depending on which backend you want.
      • Specify also -DUSE_TCMALLOC=1 if using TCMalloc.
      • Compiling will also call git commands to embed the git hash into the compiled executable, specify also -DNO_GIT_REVISION=1 to disable it if this is causing issues for you.
      • Specify -DUSE_AVX2=1 to also compile Eigen with AVX2 and FMA support, which will make it incompatible with old CPUs but much faster. (If you want to go further, you can also add -DCMAKE_CXX_FLAGS='-march=native' which will specialize to precisely your machine's CPU, but the exe might not run on other machines at all).
      • Specify -DBUILD_DISTRIBUTED=1 to compile with support for contributing data to public distributed training runs.
        • If building distributed, you will also need to build with Git revision support, including building within a clone of the repo, as opposed to merely an unzipped copy of its source.
        • Only builds from specific tagged versions or branches can contribute, in particular, instead of the master branch, use either the latest release tag or the tip of the stable branch. To minimize the chance of any data incompatibilities or bugs, please do NOT attempt to contribute with custom changes or circumvent these limitations.
    • make
  • Done! You should now have a compiled katago executable in your working directory.
  • Pre-trained neural nets are available at the main training website.
  • You will probably want to edit configs/gtp_example.cfg (see "Tuning for Performance" above).
  • If using OpenCL, you will want to verify that KataGo is picking up the correct device when you run it (e.g. some systems may have both an Intel CPU OpenCL and GPU OpenCL, if KataGo appears to pick the wrong one, you can correct this by specifying openclGpuToUse in configs/gtp_example.cfg).

Windows