Building MXNet with Visual Studio is not generally straightforward, especially if you want to include CUDA support in the build.  This guide has a recommended combination of tools to use that should make the process easier.

CUDA / Visual Studio Conflict Summary

Unfortunately there is currently a back-and-forth conflict between Microsoft and NVIDIA in regards to Visual Studio and CUDA versions.  Developers wanting to utilize these platforms are caught in the middle.  The problem is that with each new CUDA release NVIDIA indicates a minimum, and maximum version number of Visual Studio that the release will work with.  This was generally not a problem with prior releases of Visual Studio as the release cadence was fairly low, so it was likely you would have the exact version you needed.  The current Visual Studio release cadence is quite high, and users are frequently prompted for updates.  The combination of frequent major version updates on VS's side, and a maximum version specified by CUDA mean that if you download the newest version of CUDA, and trying to run it with an up-to-date version of Visual Studio, your code is unlikely to compile.

More information can be found on NVIDIA forums threads, with typically a new 3-4 threads created each CUDA release.  For example:

https://devtalk.nvidia.com/default/topic/1033111/cuda-9-1-cannot-install-due-to-failed-visual-studio-integration/

https://devtalk.nvidia.com/default/topic/1035535/cuda-9-2-does-not-work-with-visual-studio-2017-15-7-1/

https://devtalk.nvidia.com/default/topic/1032800/cuda-setup-and-installation/visual-studio-integration-failed-/

https://devtalk.nvidia.com/default/topic/1032284/cuda-setup-and-installation/cuda-visual-studio-integration-installation-failed/

https://devtalk.nvidia.com/default/topic/1024458/cuda-setup-and-installation/nvidia-cuda-version-9-0-installer-failed/3

https://devtalk.nvidia.com/default/topic/1024655/cuda-9-0-176-installer-fails-every-time/

https://devtalk.nvidia.com/default/topic/1033047/cuda-setup-and-installation/seriously-what-is-up-with-cuda-9-0-failing-visual-studio-integration/

(ok, some of these provide no value to include here, but are pretty funny)

Error Messages

If you're running into this issue you'll get an error message such as:

"Minimum OS version check fail - Version: 6.1.7601 < 6.3."

OR

"#error: -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported!" (even if you're using VS 2017)

Root Cause

CUDA ships with a header file with the following guards (updated on a CUDA release)

C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.2\include\crt\host_config.h

#if _MSC_VER < 1600 || _MSC_VER > 1913

This specifies a maximum visual studio version, which will likely be less than your version if you install the latest version.  Removing the guard works from some users, but causes errors later in compilation for MXNet.

Recommended working combinations

I recommend using CUDA 9.2 with Visual Studio 15.6.7.  This combination of Visual Studio and CUDA seems to work well, and has many important bug fixes and features.  Updating to a more recent version of Visual Studio will likely prevent you from compiling.

You can download and install Visual Studio 15.6.7 from here:
https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017

The direct VS community edition link for 15.6.7 is here: https://aka.ms/eac464

Install CUDA 9.2 (and patch) after installing 15.6.7 to install Visual Studio integration properly.



  • No labels