Installing CUDA 9.0 on Windows 10 with Visual Studio Community Edition

Prerequisites:

For me, the CUDA 9.0 (as well as 9.1) installer failed to install on a fresh Windows 10 system with the 2015 community edition Visual Studio. The problematic items seems to be the “Visual Studio Integration” , which fails to install and somehow blocks all other items from being installed. Fortunately, there is a way around this and you can still use Visual Studio, but you must download the ~1.5GB local install file. We assume that you have already installed Visual Studio Community 2015.

  • Start the downloaded installer. There will be a prompt asking you where to put the temporary installer files. Copy the location to the clipboard and hit OK.
  • Wait for the installer to extract the temporary files.
  • When the license agreement pops up, open the temporary directory in Explorer (right-click the address bar, choose edit address, and then paste from clipboard). Either copy the whole directory to somewhere safe for later use, or just copy the folder named “CUDAVisualStudioIntegration” to your desktop.
  • Go back to the CUDA Installer, accept the license.
  • Choose the “Custom (advanced)” installation option.
  • Uncheck “CUDA” -> “Visual Studio Integration” and install.

The installation will take a while, upon finishing you are able to run the tensorflow-gpu python3 package on your machine, the necessary environment variable settings should have been updated by the installer.

Now, it’s time to install the Visual Studio integration manually.

  • Go to your saved copy of the “CUDAVisualStudioIntegration” folder and install both “.msi” files.
  • Copy the contents of the “CUDAVisualStudioIntegration\extras\visual_studio_integration\MSBuildExtensions” sub-folder to “C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations”.
  • Now, open a random CUDA sample project folder, for instance “C:\ProgramData\NVIDIA Corporation\CUDA Samples\v9.0\7_CUDALibraries\simpleCUBLASXT”. Open the file ending in “vs2015.sln”, in our case “simpleCUBLASXT_vs2015.sln”.
  • It should build and run just fine. In some cases, you might have to adjust your CUDA Toolkit Directory of the project. In order to do so, right click the project in the Solution Explorer, select Properties.

    Then choose “All Configurations” from the top-left drop-box, browse the item “CUDA C/C++” and enter “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0” as the “CUDA Toolkit Custom Dir”.

For me, the same steps also work for the most recent CUDA Toolkit 9.1, which comes with an installer that suffers from the same problems.

Your mileage may vary, Good Luck & Out.