marian/vs
Cédric Rousseau eb98a45b04 merge Master
2018-09-07 13:29:38 +02:00
..
.gitignore Adding scripts and readme file 2018-09-04 16:34:21 +02:00
build.bat Build in Release, with improved debug info 2018-09-04 16:58:49 +02:00
configure.bat Adding scripts and readme file 2018-09-04 16:34:21 +02:00
Marian.sln added VS Solution and Project 2018-08-19 16:18:32 -07:00
Marian.vcxproj fixed all warnings discovered by Visual Studio 2018-08-31 19:21:14 -07:00
Marian.vcxproj.filters fixed all warnings discovered by Visual Studio 2018-08-31 19:21:14 -07:00
paths_for_windows removed old (incorrect) VS files 2018-08-20 13:22:18 -07:00
README.md update README 2018-09-07 11:41:31 +02:00

Build Marian on Windows with GPU support

Install prerequisites

The following SDK are required to build Marian with GPU support

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.

  1. Fix Cuda error : Unsupported Visual Studio Version Error
    See above for justification and fixes

  2. Fix VS compiler flags / Build in Release, with improved debug info
    Added VS specific compile and link flags

  3. 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.

  4. Fix marian::Backendn marian::cpu::Beckend and marian::gpu::Backend conflicts
    There were name conflicts between the 3 Backend 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 and gpuBackend.

  5. 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.

  6. 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.

  7. Fix mismatched class/struct forward declarations
    Microsoft's C++ name mangling makes a distinction between class and struct objects, so definitions and forward declaration must match.
    See this pdf, page 27, for more information.

  8. Fix unresolved external due to a removed #include directive
    An #include directive was specifically removed for MSVC compiler.

  9. 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.

  10. 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 replace mkstemp, and added the flag _O_TEMPORARY to the parameters of _open to automatically delete the file when it is closed. If unlinkEarly is not set, I added a call to remove in the destructor to delete the file after its closure.
    I also handled the case of the default value for the base parameter: the path \tmp doesnot exist on Windows, so it is replaced by the value of the %TMP% environment variable in NormalizeTempPrefix.