Skip to content

Commit cd2d1b5

Browse files
authored
Merge pull request LeelaChessZero#7 from LeelaChessZero/master
merge lc0 master
2 parents b5bedf4 + a56709c commit cd2d1b5

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+2211
-1000
lines changed

README.md

+25-19
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,11 @@ Having successfully acquired Lc0 via either of these methods, proceed to the bui
3434

3535
Building should be easier now than it was in the past. Please report any problems you have.
3636

37-
Aside 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 libraries `protobuf` and `zlib`. (`gtest` is optionally used for the test suite.) If your system already has those two libraries 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.
37+
Aside 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.
3838

39-
Backend support includes (in theory) any CBLAS-compatible library for CPU usage, such as OpenBLAS or Intel's MKL. For GPUs, OpenCL and CUDA+cudnn are supported.
39+
Backend 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.
40+
41+
Finally, 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.
4042

4143
Given those basics, the OS and backend specific instructions are below.
4244

@@ -80,26 +82,31 @@ in ("Deep Learning").
8082

8183
#### Ubuntu 18.04
8284

83-
For Ubuntu 18.04 you need the latest version of meson and clang-6.0 before performing the steps above:
85+
For Ubuntu 18.04 you need the latest version of meson, g++-8 and clang-6.0 before performing the steps above:
8486

85-
sudo apt-get install clang-6.0 ninja-build pkg-config protobuf-compiler libprotobuf-dev meson
87+
sudo apt-get install gcc-8 g++-8 clang-6.0 ninja-build pkg-config
88+
pip3 install meson --user
8689
CC=clang-6.0 CXX=clang++-6.0 INSTALL_PREFIX=~/.local ./build.sh
8790

8891
Make sure that `~/.local/bin` is in your `PATH` environment variable. You can now type `lc0 --help` and start.
8992

9093
#### Ubuntu 16.04
9194

92-
For Ubuntu 16.04 you need the latest version of meson and clang-6.0 before performing the steps above:
95+
For Ubuntu 16.04 you need the latest version of meson, ninja and also gcc-8.0 before performing the steps above:
9396

94-
wget -O - https://apt.llvm.org/llvm-snapshot.gpg.key | sudo apt-key add -
95-
sudo apt-add-repository 'deb http://apt.llvm.org/xenial/ llvm-toolchain-xenial-6.0 main'
97+
sudo add-apt-repository ppa:ubuntu-toolchain-r/test
9698
sudo apt-get update
97-
sudo apt-get install clang-6.0 ninja-build protobuf-compiler libprotobuf-dev
99+
sudo apt-get install gcc-8 g++-8
98100
pip3 install meson --user
99-
CC=clang-6.0 CXX=clang++-6.0 INSTALL_PREFIX=~/.local ./build.sh
101+
pip3 install ninja --user
102+
CC=gcc-8 CXX=g++-8 INSTALL_PREFIX=~/.local ./build.sh
100103

101104
Make sure that `~/.local/bin` is in your `PATH` environment variable. You can now type `lc0 --help` and start.
102105

106+
If you want to build with clang-6.0 you still need g++-8 for the library. Replace the last line above with:
107+
108+
sudo apt-get install clang-6.0
109+
CC=clang-6.0 CXX=clang++-6.0 INSTALL_PREFIX=~/.local ./build.sh
103110

104111
#### openSUSE (all versions)
105112

@@ -113,24 +120,23 @@ to run latest releases of lc0 and the client inside a Docker container.
113120

114121
### Windows
115122

116-
0. Install Microsoft Visual Studio
117-
1. Install [CUDA](https://developer.nvidia.com/cuda-zone) (v9.2 is fine)
123+
Here are the brief instructions for CUDA/CuDNN, for details and other options see `windows-build.md`.
124+
125+
0. Install Microsoft Visual Studio (2017 or later)
126+
1. Install [CUDA](https://developer.nvidia.com/cuda-zone)
118127
2. Install [cuDNN](https://developer.nvidia.com/cudnn).
119128
3. Install Python3
120129
4. Install Meson: `pip3 install --upgrade meson`
121-
5. Edit `build-cuda.cmd`:
130+
5. Edit `build.cmd`:
122131

123-
* If you use MSVS other than 2015 (or if it's installed into non-standard location):
124-
* `C:\Program Files (x86)\Microsoft Visual Studio 14.0\` replace 14.0 with your version
125-
* `--backend 2015` replace 2015 with your version
126-
* `C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\lib\x64` replace with your CUDA path
127-
* `C:\dev\cuDNN\` replace with your cuDNN directory
132+
* Set `CUDA_PATH` with your CUDA directory
133+
* Set `CUDNN_PATH` with your cuDNN directory (may be the same with CUDA_PATH)
128134

129-
6. Run `build-cuda.cmd`. It will generate MSVS project and pause.
135+
6. Run `build.cmd`. It will ask permission to delete the build directory, then generate MSVS project and pause.
130136

131137
Then either:
132138

133-
7. Hit <Enter> to build it.
139+
7. Hit `Enter` to build it.
134140
8. Resulting binary will be `build/lc0.exe`
135141

136142
Or.

appveyor.yml

+5-5
Original file line numberDiff line numberDiff line change
@@ -44,13 +44,12 @@ install:
4444
- cmd: set PATH=C:\Python36;C:\Python36\scripts;%PATH%
4545
- cmd: pip3 install --upgrade meson
4646
- cmd: call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
47-
- cmd: IF %NAME%==android C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r17\build\tools\make_standalone_toolchain.py --arch arm64 --api 21 --stl libc++ --install-dir \android-standalone-64
48-
- cmd: IF %NAME%==android set PATH=C:\android-standalone-64\bin;%PATH%
47+
- cmd: IF %NAME%==android IF NOT EXIST C:\ndk\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64 appveyor DownloadFile https://dl.google.com/android/repository/android-ndk-r19c-windows-x86_64.zip
48+
- cmd: IF %NAME%==android IF NOT EXIST C:\ndk\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64 7z x android-ndk-r19c-windows-x86_64.zip -oC:\ndk
49+
- cmd: IF %NAME%==android set PATH=C:\ndk\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64\bin;%PATH%
4950
- cmd: IF %NAME%==android sed "s/clang+*/&.cmd/" cross-files/aarch64-linux-android >crossfile-aarch64
5051
- cmd: IF %NAME%==android IF NOT EXIST C:\cache\OpenBLAS\android-aarch64 appveyor DownloadFile https://github.com/borg323/OpenBLAS/releases/download/android-0.3.8-2/openblas-android-aarch64.zip
5152
- cmd: IF %NAME%==android IF NOT EXIST C:\cache\OpenBLAS\android-aarch64 7z x openblas-android-aarch64.zip -oC:\cache\OpenBLAS
52-
- cmd: IF %NAME%==android C:\ProgramData\Microsoft\AndroidNDK64\android-ndk-r17\build\tools\make_standalone_toolchain.py --arch arm --api 21 --stl libc++ --install-dir \android-standalone-32
53-
- cmd: IF %NAME%==android set PATH=C:\android-standalone-32\bin;%PATH%
5453
- cmd: IF %NAME%==android sed "s/clang+*/&.cmd/" cross-files/armv7a-linux-android >crossfile-armv7a
5554
- cmd: IF %NAME%==android IF NOT EXIST C:\cache\OpenBLAS\android-armv7a appveyor DownloadFile https://github.com/borg323/OpenBLAS/releases/download/android-0.3.8-2/openblas-android-armv7a.zip
5655
- cmd: IF %NAME%==android IF NOT EXIST C:\cache\OpenBLAS\android-armv7a 7z x openblas-android-armv7a.zip -oC:\cache\OpenBLAS
@@ -68,14 +67,15 @@ cache:
6867
- C:\cache -> appveyor.yml
6968
- 'C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0'
7069
- C:\projects\lc0\subprojects\packagecache
70+
- C:\ndk\android-ndk-r19c\toolchains\llvm\prebuilt\windows-x86_64
7171
before_build:
7272
- cmd: git submodule update --init --recursive
7373
- cmd: SET BUILD_BLAS=%BLAS%
7474
- cmd: IF %OPENCL%==true SET BUILD_BLAS=true
7575
- cmd: IF %DX%==true SET BUILD_BLAS=true
7676
- cmd: SET EMBED=false
7777
- cmd: IF %APPVEYOR_REPO_TAG%==true IF %ANDROID%==true SET EMBED=true
78-
- cmd: IF %ANDROID%==false meson build --backend vs2017 --buildtype release -Dgtest=%GTEST% -Dopencl=%OPENCL% -Dblas=%BUILD_BLAS% -Ddnnl=true -Deigen=true -Ddx=%DX% -Dcudnn=%CUDA% -Dispc_native_only=false -Dpopcnt=false -Dcudnn_include="%CUDA_PATH%\include","%PKG_FOLDER%\cuda\include" -Dcudnn_libdirs="%CUDA_PATH%\lib\x64","%PKG_FOLDER%\cuda\lib\x64" -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\dist64\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\dist64\lib" -Ddnnl_dir="%PKG_FOLDER%\dnnl_win_1.1.1_cpu_vcomp" -Dopencl_include="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\include" -Dopencl_libdirs="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\lib\x64" -Ddefault_library=static
78+
- cmd: IF %ANDROID%==false meson build --backend vs2017 --buildtype release -Dgtest=%GTEST% -Dopencl=%OPENCL% -Dblas=%BUILD_BLAS% -Ddnnl=true -Ddx=%DX% -Dcudnn=%CUDA% -Dispc_native_only=false -Dpopcnt=false -Dcudnn_include="%CUDA_PATH%\include","%PKG_FOLDER%\cuda\include" -Dcudnn_libdirs="%CUDA_PATH%\lib\x64","%PKG_FOLDER%\cuda\lib\x64" -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\dist64\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\dist64\lib" -Ddnnl_dir="%PKG_FOLDER%\dnnl_win_1.1.1_cpu_vcomp" -Dopencl_include="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\include" -Dopencl_libdirs="%PKG_FOLDER%\opencl-nug.0.777.77\build\native\lib\x64" -Ddefault_library=static
7979
- cmd: IF %ANDROID%==true meson arm64-v8a --buildtype release -Dgtest=false -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\android-aarch64\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\android-aarch64\lib" -Dembed=%EMBED% -Ddefault_library=static --cross-file crossfile-aarch64
8080
- cmd: IF %ANDROID%==true meson armeabi-v7a --buildtype release -Dgtest=false -Dopenblas_include="%PKG_FOLDER%\OpenBLAS\android-armv7a\include" -Dopenblas_libdirs="%PKG_FOLDER%\OpenBLAS\android-armv7a\lib" -Dembed=%EMBED% -Ddefault_library=static --cross-file crossfile-armv7a
8181
build_script:

build-cl.cmd

-31
This file was deleted.

build-cuda-ninja.cmd

-14
This file was deleted.

build-cuda.cmd

-22
This file was deleted.

build.cmd

+62
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
@echo off
2+
setlocal
3+
4+
rem 1. Set the following for the options you want to build.
5+
set CUDNN=true
6+
set DX12=false
7+
set OPENCL=false
8+
set MKL=false
9+
set DNNL=false
10+
set OPENBLAS=false
11+
set EIGEN=false
12+
set TEST=false
13+
14+
rem 2. Edit the paths for the build dependencies.
15+
set CUDA_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
16+
set CUDNN_PATH=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v10.0
17+
set OPENBLAS_PATH=C:\OpenBLAS
18+
set MKL_PATH=C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl
19+
set DNNL_PATH=C:\dnnl_win_1.1.1_cpu_vcomp
20+
set OPENCL_LIB_PATH=%CUDA_PATH%\lib\x64
21+
set OPENCL_INCLUDE_PATH=%CUDA_PATH%\include
22+
23+
rem 3. In most cases you won't need to change anything further down.
24+
echo Deleting build directory:
25+
rd /s build
26+
27+
if exist "C:\Program Files (x86)\Microsoft Visual Studio\2019" (
28+
call "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
29+
set MSBuild=msbuild
30+
set backend=vs2019
31+
) else (
32+
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64
33+
set MSBuild="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe"
34+
set backend=vs2017
35+
)
36+
37+
if "%CUDA_PATH%"=="%CUDNN_PATH%" (
38+
set CUDNN_LIB_PATH=%CUDNN_PATH%\lib\x64
39+
set CUDNN_INCLUDE_PATH=%CUDNN_PATH%\include
40+
) else (
41+
set CUDNN_LIB_PATH=%CUDA_PATH%\lib\x64,%CUDNN_PATH%\lib\x64
42+
set CUDNN_INCLUDE_PATH=%CUDA_PATH%\include,%CUDNN_PATH%\include
43+
)
44+
45+
if %CUDNN%==true set PATH=%CUDA_PATH%\bin;%PATH%
46+
47+
meson build --backend %backend% --buildtype release -Ddx=%DX12% -Dcudnn=%CUDNN% -Dopencl=%OPENCL% ^
48+
-Dblas=true -Dmkl=%MKL% -Dopenblas=%OPENBLAS% -Deigen=%EIGEN% -Ddnnl=%DNNL% -Dgtest=%TEST% ^
49+
-Dcudnn_include="%CUDNN_INCLUDE_PATH%" -Dcudnn_libdirs="%CUDNN_LIB_PATH%" ^
50+
-Dmkl_include="%MKL_PATH%\include" -Dmkl_libdirs="%MKL_PATH%\lib\intel64" -Ddnnl_dir="%DNNL_PATH%" ^
51+
-Dopencl_libdirs="%OPENCL_LIB_PATH%" -Dopencl_include="%OPENCL_INCLUDE_PATH%" ^
52+
-Dopenblas_include="%OPENBLAS_PATH%\include" -Dopenblas_libdirs="%OPENBLAS_PATH%\lib" ^
53+
-Ddefault_library=static
54+
55+
if errorlevel 1 exit /b
56+
57+
pause
58+
59+
cd build
60+
61+
%MSBuild% /m /p:Configuration=Release /p:Platform=x64 /p:WholeProgramOptimization=true ^
62+
/p:PreferredToolArchitecture=x64 lc0.sln /filelogger

changelog.txt

+68-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,71 @@
1-
v0.24.0-rc1 (2020-02-23)
1+
v0.25.0-rc1 (2020-04-09)
2+
~~~~~~~
3+
4+
* Now requires a c++17 supporting compilation environment to build.
5+
* Support for Moves Left Head based networks. Includes options to adjust search
6+
to favour shorter/longer wins/losses based on the moves left head output.
7+
* Mate score reporting is now possible, and move selection will prefer shorter
8+
mates over longer ones when they are proven.
9+
* Training now outputs v5 format data. This passes the moves left information
10+
back to training. This also includes support for multiple sub formats,
11+
including the existing standard, a new variant which can encode FRC960
12+
castling, and also a further extension of that which tries to make training
13+
data cannonical, so there aren't multiple positions that are trivially
14+
equivalent with different network inputs.
15+
* Benchmark now includes a suite of 34 positions to test by default instead of
16+
just start position.
17+
* Tensorflow backend works once more, almost just as hard to compile as it used
18+
to be though.
19+
* `--noise` flag is gone, use `--noise-epsilon=0.25` to get the old behavior.
20+
* Some bug fixes related to drawscore.
21+
* Selfplay mode now defaults to the same value as match play for
22+
`--root-has-own-cpuct-params` (true).
23+
* Some advanced time management parameters are now accessed via the new
24+
`--time-manager` parameter instead of individual parameters.
25+
* Windows build script has been modernized.
26+
* Separate Eigen backend option for CPU.
27+
* Random backend no longer requires a network.
28+
* Random backend supports producing training data of any input format sub type.
29+
* Integer parameters now give better error messages when given invalid values.
30+
31+
v0.24.1 (2020-03-15)
32+
~~~~~~~
33+
34+
* Fix issues where logitq was being passed as drawscore and logitq wasn't
35+
passed to some GetQ calls. Causing major performance issues when either
36+
setting was non-default.
37+
38+
v0.24.0 (2020-03-11)
39+
~~~~~~~
40+
41+
* New parameter `--max-out-of-order-evals-factor` replaces
42+
`--max-out-of-order-evals` that was introduced in v0.24.0-rc3 and provides
43+
the factor to multiply the maximum batch size to set maximum number
44+
out-of-order evals per batch. The default value of 1.0 keeps the behavior
45+
of previous releases.
46+
* Bug fix for hangs with very early stop command from non-conforming UCI hosts.
47+
48+
v0.24.0-rc3 (2020-03-08)
49+
~~~~~~~~~~~
50+
51+
* New parameter `--max-out-of-order-evals` to set maximum number out-of-order
52+
evals per batch (was equal to the batch size before).
53+
* It's now possible to embed networks into the binary. It allows easier builds
54+
of .apk for Android.
55+
* New parameter `--smart-pruning-minimum-batches` to only allow smart pruning
56+
to stop after at least k batches, preventing insta-moves on slow backends.
57+
58+
v0.24.0-rc2 (2020-03-01)
59+
~~~~~~~~~~~
60+
61+
* All releases are now bundled with network id591226 (and the file date is old
62+
enough so it has a lower priority than networks that you already may have
63+
in your directory).
64+
* Added a 'backendbench' mode to benchmark NN evaluation performance without
65+
search.
66+
* Android builds are added to the official releases.
67+
68+
v0.24.0-rc1 (2020-02-23)
269
~~~~~~~~~~~
370

471
* Introduced DirectX12 backend.

cross-files/aarch64-linux-android

+4-8
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
11

2-
# Tested with Android NDK r18, default toolchain
2+
# Tested with Android NDK r19c, default toolchain
33
# Targeting API level 21
44

5-
# Make the standalone toolchain
6-
# cd android-ndk-r18b/build/tools/
7-
# ./make_standalone_toolchain.py --arch arm64 --api 21 --stl libc++ --install-dir android-standalone-64
8-
95
# Set the toolchain path on your environment
10-
# export PATH="$HOME/.local/share/android-sdk/android-toolchains/android-standalone-64/bin:$PATH"
6+
# export PATH="$HOME/.local/share/android-sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin:$PATH"
117

128
[host_machine]
139
system = 'android'
@@ -19,8 +15,8 @@ endian = 'little'
1915
cpp_link_args = ['-llog', '-static-libstdc++']
2016

2117
[binaries]
22-
c = 'aarch64-linux-android-clang'
23-
cpp = 'aarch64-linux-android-clang++'
18+
c = 'aarch64-linux-android21-clang'
19+
cpp = 'aarch64-linux-android21-clang++'
2420
ar = 'aarch64-linux-android-ar'
2521
strip = 'aarch64-linux-android-strip'
2622
ld = 'aarch64-linux-android-ld'

0 commit comments

Comments
 (0)