How to get Visual Studio 2017 to use CUDA 9.1?
I have just installed CUDA 9.1. CUDA 9.0 was previously installed. When I attempt to compile a CUDA source file, I get [code]"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 Studio\2017\Community3\VC\Tools\MSVC\14.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![/code] 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
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 Studio\2017\Community3\VC\Tools\MSVC\14.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

#1
Posted 01/13/2018 06:25 AM   
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 [code]#if _MSC_VER < 1600 || _MSC_VER > 1911 [/code]so it fails, giving the "unsupported error". However, just changing the test to ">1912" gives a new set of errors, such as[code]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 [/code] There is something else that needs to be done.
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

There is something else that needs to be done.

#2
Posted 01/14/2018 07:36 PM   
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 [color="orange"]error: expression must have a constant value[/color] cl /?: Microsoft (R) C/C++ Optimizing Compiler Version 19.12.25831 for x64 [color="green"](Dont want 2015 stuff but 2017 compile tools cpp) force MSVC 14.11.25503[/color]
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

#3
Posted 01/21/2018 10:08 PM   
I have been able to compile a initial demo program by the following methods. Change 1911 to 1912 in host_config.h. Change these new files (type_traits and xstddef ) to old files. These files are in \Program Files(x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include.
I have been able to compile a initial demo program by the following methods.

Change 1911 to 1912 in host_config.h.
Change these new files (type_traits and xstddef ) to old files.

These files are in \Program Files(x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include.

#4
Posted 02/16/2018 04:55 AM   
[quote="htsumura"]I have been able to compile a initial demo program by the following methods. Change 1911 to 1912 in host_config.h. Change these new files (type_traits and xstddef ) to old files. These files are in \Program Files(x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include. [/quote] Explain: what are the "old files"?
htsumura said:I have been able to compile a initial demo program by the following methods.

Change 1911 to 1912 in host_config.h.
Change these new files (type_traits and xstddef ) to old files.

These files are in \Program Files(x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.12.25827\include.


Explain: what are the "old files"?

#5
Posted 02/19/2018 11:14 PM   
I'm stuck on the same thing... What are the old files? Also, I'm seeing some people say that 15.4 works - where can I get the earlier version of VS?
I'm stuck on the same thing... What are the old files? Also, I'm seeing some people say that 15.4 works - where can I get the earlier version of VS?

#6
Posted 02/19/2018 11:46 PM   
@maseology: I just got CUDA and VS 2017 to work. I uninstalled CUDA / CUDA Nsight extension and VS 2017 (v 15.5). Then then installed VS 15.4 from https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017 as the community edition. Then I installed CUDA 9.0 from https://developer.nvidia.com/cuda-90-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal and rebuild my project (a cmake project) and I didn't get the errors that you mentioned above. Good luck!
@maseology:

I just got CUDA and VS 2017 to work. I uninstalled CUDA / CUDA Nsight extension and VS 2017 (v 15.5). Then then installed VS 15.4 from

https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017

as the community edition. Then I installed

CUDA 9.0 from

https://developer.nvidia.com/cuda-90-download-archive?target_os=Windows&target_arch=x86_64&target_version=10&target_type=exelocal

and rebuild my project (a cmake project) and I didn't get the errors that you mentioned above.

Good luck!

#7
Posted 02/20/2018 12:55 AM   
@christopher.fowler: Thanks, I'll look into that. 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. Any thoughts?
@christopher.fowler: Thanks, I'll look into that.

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.

Any thoughts?

#8
Posted 02/20/2018 02:48 PM   
@maseology I have a couple conferences coming up so I don't have that luxury. I say take the hack and run with it. It's definitely not ideal.
@maseology

I have a couple conferences coming up so I don't have that luxury. I say take the hack and run with it. It's definitely not ideal.

#9
Posted 02/21/2018 05:40 PM   
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! https://duckduckgo.com/?q=visual+studio+2017+15.4.5
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! https://duckduckgo.com/?q=visual+studio+2017+15.4.5

#10
Posted 03/18/2018 06:34 PM   
[img]https://s18.postimg.org/wqvz5w47d/vs2017_15.4.5_en.jpg[/img]
Image

#11
Posted 03/18/2018 06:46 PM   
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.
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.

#12
Posted 03/18/2018 06:50 PM   
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. https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017 Need appropriage fix as no work around exist as of March 23, 2018.
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.

https://docs.microsoft.com/en-us/visualstudio/productinfo/installing-an-earlier-release-of-vs2017


Need appropriage fix as no work around exist as of March 23, 2018.

#13
Posted 03/30/2018 05:32 AM   
We can switch project to use previous toolset of VS2017. Just follow instruction https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/
We can switch project to use previous toolset of VS2017.
Just follow instruction https://blogs.msdn.microsoft.com/vcblog/2017/11/15/side-by-side-minor-version-msvc-toolsets-in-visual-studio-2017/

#14
Posted 04/06/2018 03:28 PM   
Scroll To Top

Add Reply