Skip to content

Commit

Permalink
build fixes and instructions for OpenCL in windows
Browse files Browse the repository at this point in the history
  • Loading branch information
borg323 committed Jun 19, 2018
1 parent ffa0866 commit 1411309
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 0 deletions.
31 changes: 31 additions & 0 deletions 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

3 changes: 3 additions & 0 deletions meson.build
Expand Up @@ -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
Expand Down
5 changes: 5 additions & 0 deletions meson_options.txt
Expand Up @@ -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/'],
Expand Down
39 changes: 39 additions & 0 deletions 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 <Enter> 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.


0 comments on commit 1411309

Please sign in to comment.