b6d8177c2f | ||
---|---|---|
.. | ||
.gitignore | ||
Marian.sln | ||
Marian.vcxproj | ||
Marian.vcxproj.filters | ||
README.md | ||
build.bat | ||
configure.bat | ||
paths_for_windows |
README.md
Build Marian on Windows with GPU support
Install prerequisites
The following SDK are required to build Marian with GPU support
-
- Base installer
- Patches
-
- Requires nVidia Developper account
Patch for CUDA error: Unsupported Visual Studio Version Error
The latest versions of Visual Studio 2017 are not officially supported by CUDA. Two fixes are proposed:
-
Downgrade Visual Studio to a supported version
-
Edit the file
<CUDA install path>\include\crt\host_config.h
and change the line 131:131 #if _MSC_VER < 1600 || _MSC_VER > 1914
into:
131 #if _MSC_VER < 1600 || _MSC_VER > 1915
For more information, read this nVidia forum
Configure
- Run configure.bat
Build
- Run build.bat
Changes from the master branch
This part gives more information on all changes done. Refer to this page for commits.
-
Fix Cuda error : Unsupported Visual Studio Version Error
See above for justification and fixes -
Fix VS compiler flags / Build in Release, with improved debug info
Added VS specific compile and link flags -
Fix Warning: D9002: ignoring unknown option '-m64'
This one is related to a compiler flag added while finding the package MKL that does not exists for MS compiler. -
Fix marian::Backendn marian::cpu::Beckend and marian::gpu::Backend conflicts
There were name conflicts between the 3Backend
classes that confused the compiler:template instantiation resulted in unexpected function type of "type" (the meaning of a name may have changed since the template declaration -- the type of the template is "type") .
I renamed the CPU and GPU as
cpuBackend
andgpuBackend
. -
Fix error : identifier "CUDA_FLT_MAX" is undefined in device code
CUDA_FLT_MAX
is not seen from the device and I had to declare it as__constant__
.From StackOverflow:
Undecorated constants get compiled into both host and device code with gcc based toolchains, but not with the Microsoft compiler.
-
Fix fatal error C1019: unexpected #else
There was preprocessor instructions (#ifdef ... #else ... #endif
) in the middle of a call of a macro function (CUDNN_CALL
), which is not allowed with MS compiler. -
Fix mismatched class/struct forward declarations
Microsoft's C++ name mangling makes a distinction betweenclass
andstruct
objects, so definitions and forward declaration must match.
See this pdf, page 27, for more information. -
Fix unresolved external due to a removed #include directive
An#include
directive was specifically removed for MSVC compiler. -
Fix CUDA+MSVC incompatibility with Boost.Preprocessor
The toolchain nvcc+msvc is not correctly handled in Boost.Preprocessor module. See this issue. In the meantime, the recommended workaround is to disable Variadic Macro support in Boost.
I created a PR in the Boost repo on GitHub to fix this. -
Provide implementation for mkstemp / Fix temporary file creation
The code explicitely disabled the creation of temporary files because "mkstemp not available in Windows". In fact,_mktemp
and_unlink
are both implemented, but thay don't work as expected. I used_tempnam
to replacemkstemp
, and added the flag_O_TEMPORARY
to the parameters of_open
to automatically delete the file when it is closed. IfunlinkEarly
is not set, I added a call toremove
in the destructor to delete the file after its closure.
I also handled the case of the default value for thebase
parameter: the path\tmp
doesnot exist on Windows, so it is replaced by the value of the%TMP%
environment variable inNormalizeTempPrefix
.