3.5 KiB
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 some files
CUDA: Unsupported Visual Studio Version Error
From nVidia forum
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
Configure
- Run configure.bat
Build
- Run build.bat
Changes from the master branch
This part gives more information on the changes done.
-
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
Github Link
Added VS specific compile and link flags -
Fix Warning: D9002: ignoring unknown option '-m64'
Github Link
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
Github Link
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
Github Link
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
Github Link
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.