Today I installed CUDA 9 with the Visual Studio 2017 integration. When creating a new CUDA 9 project and building, I got the error:
Error C1189 #error: – unsupported Microsoft Visual Studio version! Only the versions 2012, 2013, 2015 and 2017 are supported!
With some debugging, I found that on line 131 of file host_config.h in directory “C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.0\include\crt” only supports a max _MSC_VER of 1910. Since Visual Studio 2017 is reporting version 1911, I changed the line to:
I hope this tip is helpful to some. I’m just starting off with CUDA (spent 3 days getting it installed and currently working through some Hello World samples), so I apologize if this tip is very elementary for some.
Apologies for the difficulties with VS 2017 and CUDA 9 RC.
Microsoft released VS 2017 Update 3 (15.3) on 8/14/2017, right after CUDA 9 RC was published. This update results in an incompatibility with CUDA 9 RC. NVIDIA expects that the CUDA 9 GA (future) release will address this particular incompatibility. In the meantime, if you switch to using VS 2017 RTM (the very first release of VS 2017) with no updates, it should work with CUDA 9 RC. I’m not suggesting this is easy or difficult, or providing exact steps to get VS 2017 RTM at this time.
In other respects, the supported environments should be spelled out in the windows installation guide that ships with CUDA 9 RC, and which is also linked from the CUDA 9 RC download page on developer.nvidia.com.
Just had a chat with MS support. According to them, it is only possible to download the latest RTM of VS 2017. There is no facility to go back to older versions.
Are MS and NVIDIA working on some policy to discourage developers from using CUDA?
Given that NVIDIA has a vested interest in actively promoting the use of CUDA (as it actually helps them make money these days), I would suggest posing that question to Microsoft.
I wouldn’t exactly characterize that approach as customer friendly.
If you try to compile and execute the most simple CUDA Program with CUDA 9.0 RC and VS2017 latest version, and set -rdc=true, the program will output the following error:
I changed the _MSC_VER > 1911 to _MSC_VER > 1912, but errors are just postponed:
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(504): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(505): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(506): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(538): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(1043): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(1558): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(2371): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\type_traits(2371): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xutility(543): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xtr1common(58): error : class "std::enable_if<<error-constant>, int>" has no member "type"
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xmemory0(390): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xmemory0(1002): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xmemory0(1322): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xstring(1693): error : expression must have a constant value
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xtr1common(58): error : class "std::enable_if<<error-constant>, void>" has no member "type"
<<MSVC_DIR>>\VC\Tools\MSVC4.12.25827\include\xutility(298): error : expression must have a constant value
Thanks for reply.
I have installed v140 platform toolset. When I try to apply new project configuration, I get this error:
An error has occurred while saving the edited properties listed below:
Platform Toolset
One or more values are invalid. MSBuild returned the following error: The imported project 'C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\BuildCustomizations\CUDA 9.1.targets' was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
I have first installed CUDA 9. Then I learned that I need CUDA 8 to run Tensorflow, so I installed it. Did I corrupt it?
I had the same problem and here is a simple workaround for VS 2017, latest version (15.5.2) with CUDA latest version (9.1.85) that worked for me:
Given that in the beginning, I had only the version VC++ 2017 v142 of the toolset installed, I started the visual studio installer and installed the VC++ 2017 v141 toolset, too.
This alone, didn’t solve the problem, because, for some reason (bug in VS?), even if the project is configured to use the v141 toolset, VS generated the include paths for the v142 toolset.
So I manually changed the project include path in visual studio to point to the v141 toolset:
Project properties → VC++ Directories → Include Directories: