CUDA 7.5 doesn't recognize Visual Studio 2010 as a supported Visual Studio version

When trying to run a test script for Theano, which uses CUDA, I get the following error message:

ERROR (theano.sandbox.cuda): Failed to compile ('nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -IC:\Program1\Theano\theano\sandbox\cuda -IC:\Program1\Python35\lib\site-packages\numpy\core\include -IC:\Program1\Python35\include -IC:\Program1\Theano\theano\gof -o C:\Users\<user-name>\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.5.1-64\cuda_ndarray\cuda_ndarray.pyd -LC:\Program1\Python35\libs -LC:\Program1\Python35 -lcublas -lpython35 -lcudart')
nvcc fatal   : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2010, 2012, and 2013 are supported

But upon running the command cl, I get the following output:

Microsoft (R) C/C++ Optimizing Compiler Version 16.00.40219.01 for x64
Copyright (C) Microsoft Corporation.  All rights reserved.

cl version 16 maps to Visual studio 2010, which is supposed to be supported. So why doesn’t CUDA recognize Visual studio 2010 as a supported Visual Studio version on my system?

Normally when running nvcc on windows platform, the -ccbin switch is provided to tell nvcc where to look for cl.exe. Since that is not provided in the command listed, my guess is that nvcc simply doesn’t know where to look for your VS2010 installation.

Probably there is a way with theano to either add this switch or provide appropriate path definitions so that nvcc can find the VS installation. I don’t happen to know what it is.

If you have just installed these things, be sure that you installed CUDA 7.5 after you installed VS2010.

This seems to be a similar problem:

Notice there the additional switches in the nvcc command which are missing from yours:

'--compiler-bindir', 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin',

Also, you may have a 32bit/64bit tools mismatch.

Note that at the end of the GH thread txbob pointed to there is also mention of a bug fix to Theano, which apparently was applied in 2015. If you use a recent version of Theano, you should have picked that up automatically. A quick look at the bug fix seems to indicate that it fixed an issue in how Theano passes compilation flags to nvcc.

In general, CUDA 7.5 works just fine with MSVC 2010 (same version string as yours) on Windows 7, that is what I am running here at the moment. As txbob points out, you would want to first install MSVS 2010, then CUDA 7.5. Then build some of the CUDA sample programs to make sure the CUDA installation is operational. If that works, finally try Theano.

I took the command outputted in the terminal and enetered it, with the additional switches, so:

nvcc -shared -O3 -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -IC:\Program1\Theano\theano\sandbox\cuda -IC:\Program1\Python35\lib\site-packages\numpy\core\include -IC:\Program1\Python35\include -IC:\Program1\Theano\theano\gof -o C:\Users\kristofer.krus\AppData\Local\Theano\compiledir_Windows-7-6.1.7601-SP1-Intel64_Family_6_Model_60_Stepping_3_GenuineIntel-3.5.1-64\cuda_ndarray\cuda_ndarray.pyd -LC:\Program1\Python35\libs -LC:\Program1\Python35 -lcublas -lpython35 -lcudart --compiler-bindir 'C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin'

but I’m still getting

nvcc fatal   : nvcc cannot find a supported version of Microsoft Visual Studio. Only the versions 2010, 2012, and 2013 are supported

I’m also getting the same error message when using ‘C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64’ instead. (Because doesn’t CUDA 7.5 require a 64bit compiler?)

The command “where cl” gives

C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\amd64\cl.exe
C:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\bin\cl.exe

so I assume that at least one of the paths I have provided nvcc with is the correct one.

I did install VS2010 before I installed CUDA.

Apparently, I needed to create a .theanorc file in my USERPROFILE folder, with the following content:

device = gpu
floatX = float32

flags = --use-local-env  --cl-version=2010

Adding such a file solved the problem of nvcc not being able to locate Visual Stusio 2010. However, I don’t understand why the nvcc command I entered (with the additional switches) doesn’t work?

Compiling from the command line on windows using nvcc in my experience is somewhat involved to set up. In addition to all the above advice, I usually have to set the %PATH% variable to include various VS paths, including the path to cl.exe (yes, it is non-intuitive)

I guess it depends on the definition of “involved”. Here is how I set up the MSVS 2010 environment suitable for CUDA on 64-bit Windows 7 (I put these commands in a handy little .bat file):

call "c:\Program Files (x86)\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" amd64
set PATH=c:\Program Files\NVIDIA Corporation\NVSMI;%PATH%

C:\Program Files\NVIDIA Corporation\NVSMI is something I don’t have in my PATH, and I have neverseen it before. What does it do, and do I need it?

Also, I’m getting an error in Theano saying “CuDNN not available”. I have tried to install CuDNN according to the instructions on this page: However, since it is Theano that uses CuDNN and not me, I don’t have a Visual Studio project of my own, which the installation instructions assumes. So I have added the CuDNN folder to the INCLUDE environment variable as well as to the LIB and LIBPATH environment variables (I don’t know which one corresponds to the Library Directories lists in Visual Studio). What I haven’t been able to do is to find something that corresponds to adding cudnn.lib to Linker->Input->Additional Dependencies. How do I do that?

Also, what about if you don’t use Visual Studio at all, but for example MinGW(w-64)? How do you install CuDNN then? Surely, NVIDIA can’t assume that everyone who is running Windows uses Visual Studio.

Is there any other thing that could cause Theano not to find CuDNN that you know of? Theano doesn’t mention anything about any Visual Studio project, so I think it should work without doing the steps mentioned in the CuDNN installation instructions.

I set this up a long time ago, I believe “c:\Program Files\NVIDIA Corporation\NVSMI” is actually the path to the nvidia-smi utility, so not actually anything to do with MSVS 2010 setup. Sorry for the confusion, I simply cut & paste from my batch file.

Can’t help with Theano setup. As it is a popular open source application, you should be able to get help from the many folks that use it (e.g. forum, mailing list dedicated to Theano). Or read the source.

MSVS is the only supported host tool chain for CUDA on Windows. I would think that covers 99% of the Windows app development market. Since CUDA integrates fairly tightly with the host toolchain (requiring work of NVIDIA to make that happen) it probably isn’t economically feasible to cater to every niche.

Okay, thank you very much for your answers, njuffa and txbob. I will try my luck at the Theano user forum.