Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

CUDA 9 unsupported error with Visual Studio 2017

I've recently updated my VS 2017 and now I cannot even build a default CUDA project (the one with the vector addition).

I suspect that this is due to the following error:

Severity    Code    Description Project File    Line    Suppression State
Error   C1189   #error:  -- unsupported Microsoft Visual Studio version! 
 Only the versions 2012, 2013, 2015 and 2017 are supported! ver2    
c:\program files\nvidia gpu computing 
toolkit\cuda\v9.0\include\crt\host_config.h 133 

The other errors are irrelevant and will disappear once I fix this one. Note, that I am able to build and run simpleCUFFT from CUDA samples.

Before the update I was able to build the default CUDA project but I was not able to build the CUDA Sample project. I've updated my VS2017 using VS installer and installed CUDA SDK 10.0.15063.0. Attached is the screenshotscreenshot with the installed components.

Please let me know if any additional information is required. I am aware of the following topic and since I am using the latest CUDA toolkit, I don't need to make changes in host_config.h.

Thanks, Mikhail

Edit: My VS version (as displayed in VS installer) is 15.5.0 My nvcc version is release 9.0, V9.0.176

Edit2: I've tryied to change host_config.h line 133 to:

  #if _MSC_VER < 1600 || _MSC_VER > 1912

This error does not show up anymore, however, a bunch of errors "expression must have a constant value" show up in the file type_trails. I have no clue how to fix it.

like image 474
Mikhail Genkin Avatar asked Dec 05 '17 03:12

Mikhail Genkin


2 Answers

I'm using CUDA 9.2 and VS 2017 (Version 15.7.5). Simply Modifying host_config.h (usually under C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v9.*\include\crt, can be found in the VS output from build) works for me.

Change the line

#if _MSC_VER < 1600 || _MSC_VER > 1913

to

#if _MSC_VER < 1600 || _MSC_VER > 1914

or something similar, based on the version of cl.exe

like image 148
Chao Avatar answered Oct 22 '22 21:10

Chao


After some painful time, I was able to solve the problem. Here is the answer for those who have a similar problem:

1) Make sure that you have VC++ 2015.3 v140 toolset (can be installed either from web or Visual Studio installer)

2) In the project properties (general) -> Platform toolset choose Visual Studio 2015 (v140).

Edit (5/21/2018): I've just updated Visual studio 2017 to the latest version 15.7.1. From now on, I can choose VS 2017 v141 toolset and it works fine.

like image 20
Mikhail Genkin Avatar answered Oct 22 '22 20:10

Mikhail Genkin