From 141130999caca9da665c4b3e12f153a923855554 Mon Sep 17 00:00:00 2001 From: borg323 Date: Tue, 19 Jun 2018 17:21:18 +0300 Subject: [PATCH] build fixes and instructions for OpenCL in windows --- build-cl.cmd | 31 +++++++++++++++++++++++++++++++ meson.build | 3 +++ meson_options.txt | 5 +++++ windows_build.md | 39 +++++++++++++++++++++++++++++++++++++++ 4 files changed, 78 insertions(+) create mode 100644 build-cl.cmd create mode 100644 windows_build.md diff --git a/build-cl.cmd b/build-cl.cmd new file mode 100644 index 0000000000..762c2c8ac4 --- /dev/null +++ b/build-cl.cmd @@ -0,0 +1,31 @@ +rd /s build + +rem set MSBuild="C:\Program Files (x86)\MSBuild\14.0\Bin\MSBuild.exe" +set MSBuild="C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\MSBuild\15.0\Bin\MSBuild.exe" + +rem call "C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\vcvarsall.bat" amd64 +call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" amd64 + +meson.py build --backend vs2017 --buildtype release ^ +-Dmkl_include="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl\include" ^ +-Dmkl_libdirs="C:\Program Files (x86)\IntelSWTools\compilers_and_libraries\windows\mkl\lib\intel64" ^ +-Dopencl_libdirs="C:\Program Files (x86)\AMD APP SDK\3.0\lib\x86_64" ^ +-Dopencl_include="C:\Program Files (x86)\AMD APP SDK\3.0\include" ^ +-Ddefault_library=static + +pause + +cd build + +%MSBuild% /p:Configuration=Release /p:Platform=x64 ^ +/p:PreferredToolArchitecture=x64 "subprojects\zlib-1.2.11\Windows resource for file 'win32_zlib1.rc'@cus.vcxproj" ^ +/filelogger + +%MSBuild% /p:Configuration=Release /p:Platform=x64 ^ +/p:PreferredToolArchitecture=x64 subprojects\zlib-1.2.11\subprojects@zlib-1.2.11@@z@sta.vcxproj ^ +/filelogger + +%MSBuild% /p:Configuration=Release /p:Platform=x64 ^ +/p:PreferredToolArchitecture=x64 lc0@exe.vcxproj ^ +/filelogger + diff --git a/meson.build b/meson.build index 0e31df4c91..1adb96bf90 100644 --- a/meson.build +++ b/meson.build @@ -204,6 +204,9 @@ if get_option('build_backends') opencl_files += 'src/neural/blas/transforms.cc' endif + deps += dependency('boost', required: true) + + includes += include_directories(get_option('opencl_include')) files += opencl_files has_backends = true else diff --git a/meson_options.txt b/meson_options.txt index 55f698a484..d59062c6a2 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -8,6 +8,11 @@ option('openblas_include', value: ['/usr/include/openblas/'], description: 'Paths to openblas include directories') +option('opencl_include', + type: 'array', + value: ['/usr/include/'], + description: 'Paths to OpenCL include directories') + option('tensorflow_libdir', type: 'array', value: ['/usr/local/lib/tensorflow_cc/'], diff --git a/windows_build.md b/windows_build.md new file mode 100644 index 0000000000..e528ebe89b --- /dev/null +++ b/windows_build.md @@ -0,0 +1,39 @@ +## Windows MKL/OpenCL + +0. Install Microsoft Visual Studio. For vs2017 make sure the option "Desktop development with C++" + is installed (you can add it if not) + +1. Install git for windows - this can be used to get lc0 but also needed for meson + +2. Install MKL - dont forget to run `mklvars.bat intel64` to set up the paths to the dlls + +3. For OpenCL you also need to install: + * Boost + * OpenCL libraries + +4. Install Python3 - be sure to check the box to add python to the path + +5. Install Meson: `pip3 install --upgrade meson` + +6. Edit `build-cl.cmd`: + +* If you use MSVS other than 2017 community edition (or if it's installed into non-standard location) + replace the path to vcvarsall.bat and MSBuild.exe. If you can't find vcvarsall.bat on VS2017, you + need to install option "Desktop development with C++". Some example paths are in comments. +* `--backend 2017` replace 2017 with the correct version. +* `mkl_include` and `mkl_libdirs` should point to the MKL include and lib directories +* If building with OpenCL `opencl_libdirs` and `opencl_include` should point to the OpenCL include and + lib directories. The include directory is the one with the `CL` directory containing `opencl.h`, not + directly the one containing `opencl.h`. + +7. Run `build-cl.cmd`. It will generate MSVS project and pause. + +8. Hit to build it. + +9. Resulting binary will be `build/lc0.exe` + +Alternatively you can + +8. open generated solution `build/lc0.sln` in Visual Studio and build yourself. + +