I have just installed CUDA 9.1. CUDA 9.0 was previously installed. When I attempt to compile a CUDA source file, I get
"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\bin\nvcc.exe" -gencode=arch=compute_30,code=\"sm_30,compute_30\" --use-local-env --cl-version 2017 -ccbin "C:\Program Files (x86)\Microsoft Visual Studio017\Community3\VC\Tools\MSVC4.12.25827\bin\HostX86\x64" -x cu -rdc=true -IC:\[bunch of C++ libraries]-I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include" -I"C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include" -G --keep-dir x64\Debug -maxrregcount=0 --machine 64 --compile -cudart static -Xptxas -v -g -DWIN64 -D_WINDOWS -D_DEBUG -DTablebaseBuild -Xcompiler "/EHsc /W3 /nologo /Od /FS /Zi /RTC1 /MTd " -o x64\Debug\PosXNew_CUDA.cu.obj "C:\MyProject\MySourceFile.cu"
1>c:\program files\nvidia gpu computing toolkit\cuda\v9.0\include\crt/host_config.h(133): fatal error C1189: #error: -- unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported!
This has two problems, probably related: (1) Error for unsupported VS version; (2) compiler being used is 9.0.
I can find no option, extension, or path setting in VS to change the default compiler. Environment variable PATH contains C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\libnvvp and C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\bin.
VS macros are
$(CUDA_PATH)=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1
$(CUDA_PATH_V9_0)=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0
$(CUDA_PATH_V9_1)=C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1
How do I “retarget” VS to use CUDA 9.1 to compile and link CUDA (.cu) files?
Windows 7 64-bit; Visual Studio 2017 15.5.3; CUDA 9.1.85; NSight 5.5.0.18005
The “retargeting” is accomplished by right-clicking the project in Solution Explorer, choosing Build Customizations, unchecking CUDA 9.0, and checking CUDA 9.1. After this, the 9.1 toolkit is used, rather than 9.0.
Next, there is an error in host_config.h, found in C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.1\include\crt. The error is in the test for supported VS version. As of 2016, MS started incrementing the macro _MSC_VER with every minor release, not just major releases. For VS2017 15.5.3, _MSC_VER is 1912. The test in host_config.h is
#if _MSC_VER < 1600 || _MSC_VER > 1911
so it fails, giving the “unsupported error”.
However, just changing the test to “>1912” gives a new set of errors, such as
1>C:\Program Files (x86)\Microsoft Visual Studio\2017\Community3\VC\Tools\MSVC\14.12.25827\include\type_traits(504): error : expression must have a constant value
Problem with Cuda Sdk 9.1 at Visual Studio Pro 15.5.4 or Enterprise 2017 Trail, community version could be supported but if you update visual studio you get the same problem: VS x86_x64 Cross Tools Command Prompt for VS 2017 error: expression must have a constant value
cl /?: Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64 (Dont want 2015 stuff but 2017 compile tools cpp) force MSVC 14.11.25503
Seeing how this thread is now a month old, and the Visual Studio integration with CUDA appears somewhat, for the lack of a better term, fundamental (on the basis that NVIDIA’s own video tutorials show the building of CUDA projects using VS), does anyone know whether this has been filed as a bug report? Have we seen any official response on the matter?
On the face of it, these fixes appear quite simple, and I’d rather wait NVIDIA to get their products in order rather than my having to install deprecated software.
Previous Visual Studio 2017 15.4.5 works fine with offline enterprise iso (compile tools: vs2017 but not needed vs2015) installation. Now there are 3 Patches for Cuda 9.1, we use this in VsC++ because syntax highlighting(not 9.0). Just easy create a cuda9.1 cpp 2017 project from template, compile&run. Sry did not find the actual Vs2017 version solution yet, but previous! visual studio 2017 15.4.5 at DuckDuckGo
If you have trouble reinstall windows 10 and start vs2017 15.4.5 installation on launch second time is old version without update, at least Cuda 9.1 and 3 patches. Some friend reported to me, advanced he also installed actual nVidia driver 391.01. Vote or comment by add a post, if it works fine for you too.
Visual Studio 2017 R15.4 is no longer available for download from Microsoft. Visual Studo 2017 R15.6 released March 22, 2018. Only previous released available to download.
Courtesy of archive.org, this link should work for VS Community 2017 15.4.5: https://aka.ms/eam4b7
For those that want to just use the latest version that works with this legacy CUDA 9.1 Toolkit. Hopefully it doesn’t die for a while.