Skip to content
trinetra75 edited this page Oct 7, 2022 · 16 revisions

SAI is a Go engine based on Leela Zero, so everything about installation should be really similar to the father project and you can always have a look there to get a better understanding.

Windows: binaries

We provide Windows executables at the releases page. Please note that if you want the very last version of SAI you need to compile it.

Ignore the source code files and download either the GPU or the CPU version according to your hardware. The GPU version requires a graphic card and working openCL drivers. If you have a NVIDIA or AMD graphic card with recent drivers installed, you should be ok. If you have an integrated graphics chipset, such as Intel HD Graphics, you may try the GPU version, but it may happen that the CPU version is faster.

We tested SAI on Windows 7, Windows 8.1 and Windows 10 without problems.

The executables are inside zip files, together with: the required libraries; a strong network for 9x9 SAI; some small scripts for your ease.

You should decompress the zip file you downloaded in a dedicated directory and take note of its path. If are not an expert user, maybe the easiest way is to decompress the contents of the zip file in a directory C:\sai. After doing that, you will find four useful executables in C:\sai:

  • sai.exe: the main program with SAI engine for 19x19 games;
  • sai9x9.exe: the main program with SAI engine for 9x9 games;
  • autogtp.exe: the client used for contributing to the distributed effort;
  • sai.hta: a GUI to launch autogtp.exe.

Windows: compiling SAI

The following is step-by-step guide for compiling SAI, tested on Windows 10.

  1. Download the installer for Visual Studio 2019 Community Edition.

  2. Using the Visual Studio Installer select "Desktop development with C++" from the Workloads tab and "Windows Universal CRT SDK" and "Windows 10 SDK" from Individual Components (taken from https://lifein19x19.com/viewtopic.php?f=18&t=16582).

  3. Install Qt from https://www.qt.io/: use "Downloads for open source users" and choose the Qt online installer.

  4. From the Qt online installer you can create a Qt account. Do it, and confirm your email.

  5. Log in with your brand new Qt credentials and accept the GPL license.

  6. From the window "Select Components" select at least one of the Qt versions: at the time of writing (April 2020), I have chosen the last version 5.14.2 - around 36GB disk space required!

  7. Install "Git for Windows" from https://gitforwindows.org/, and run the Git bash shell.

  8. Clone github SAI repository and its submodules with:

    git clone https://github.com/sai-dev/sai.git
    cd sai
    git submodule update --init --recursive
    
  9. From the zip file in the releases, copy msys-gcc_s-1.dll, msys-2.0.dll, curl.exe and gzip.exe into sai/msvc folder.

  10. Double-click the leela-zero2019.sln file, and open it with Microsoft Visual Studio 2019.

  11. In the main VS2019 window, change from "Debug" to "Release" and from "Win32" to "x64".

  12. From the tab "Extensions" choose "Qt VS Tools"->"Qt Options".

  13. In the tab "Qt Versions" you should have at least one path. If not, use the "Add" button and select the path C:\Qt\5.14.2\msvc2017_64 for a default Qt 5.14.2 installation. Please notice that 2017 instead of 2019 is correct.

  14. From the window on the right, right-click on "Solution 'leela-zero2019' and choose "Build Solution".

  15. Change the cmd prompt path to include the folder sai\msvc\VS2019\x64\Release, where the .exe have been built.

Linux

We do not provide Linux binaries; instead you will have to compile them on your own. In the following, a step-by-step guide for Ubuntu-like distributions.

  1. Update and upgrade your installation

    sudo apt update
    sudo apt upgrade
    
  2. Test for OpenCL support and compatibility

    sudo apt install clinfo && clinfo
    

If the output gives no OpenCL platform then either you don't have a GPU or you graphic card drivers are not properly installed. Correct the issue or compile the CPU version, below.

  1. From a shell clone SAI git

    sudo apt install git cmake
    git clone https://github.com/sai-dev/sai.git
    cd sai
    git submodule update --init --recursive
    
  2. Install build dependencies. The second line only if you have OpenCL working

    sudo apt install libboost-dev libboost-program-options-dev libboost-filesystem-dev zlib1g-dev libqt5opengl5-dev
    sudo apt install opencl-headers ocl-icd-libopencl1 ocl-icd-opencl-dev
    
  3. Prepare compiling directory and makefile

    mkdir build
    cd build
    cmake ..
    

    If you may want to compile for CPU only, replace the last command with

    cmake .. -DUSE_CPU_ONLY=1
    

    You can also try the parameter -DBOARD_SIZE to compile with a different board size, such as

    cmake .. -DBOARD_SIZE=9
    
  4. Start the compiling process

    cmake --build .
    

Finally, you will find sai executable in sai/build and autogtp executable in sai/build/autogtp

The tests are also compiled, but they should not work for SAI.

macOS

We lack macOS expertise, but Leela-Zero instructions should work equally well for SAI. We report them here for completeness:

# Clone github repo
git clone https://github.com/leela-zero/leela-zero
cd leela-zero
git submodule update --init --recursive

# Install build dependencies
brew install boost cmake zlib

# Use a stand alone build directory to keep source dir clean
mkdir build && cd build

# Compile sai and autogtp in build subdirectory with cmake
cmake ..
cmake --build .

Please have a look to the Linux instructions above for changing board size and on how to test. The test program should not work for SAI.