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   
Scroll To Top

Add Reply