Nvcc fatal cannot find compiler cl.exe in path windows 10

Can some one please help me out with these?? I followed everything from http://deeplearning.net/software/theano/install_windows.html#install-windows. But when I try to run it in GPU this error occurs.

nvcc : fatal error : Cannot find compiler 'cl.exe' in PATH
['nvcc', '-shared', '-O3', '--use-local-env', '--cl-version=2008', '-Xlinker', '/DEBUG', '-D HAVE_ROUND', '-m64', '-Xcompiler', '-DCUDA_NDARRAY_CUH=bf8d22b192850a85a00263cce1175696,-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD', '-Ic:\scisoft\theano\theano\sandbox\cuda', '-IC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\numpy\core\include', '-IC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\include', '-o', 'C:\Users\USER\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-AMD64_Family_21_Model_48_Stepping_1_AuthenticAMD-2.7.10-64\cuda_ndarray\cuda_ndarray.pyd', 'mod.cu', '-LC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\libs', '-LC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64', '-lpython27', '-lcublas', '-lcudart']
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return status', -1, 'for cmd', 'nvcc -shared -O3 --use-local-env --cl-version=2008 -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=bf8d22b192850a85a00263cce1175696,-D NPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -Ic:\scisoft\theano\theano\sandbox\cuda -IC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\lib\site-packages\numpy\core\include -IC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\include -o C:\Users\USER\AppData\Local\Theano\compiledir_Windows-8-6.2.9200-AMD64_Family_21_Model_48_Stepping_1_AuthenticAMD-2.7.10-64\cuda_ndarray\cuda_ndarray.pyd mod.cu -LC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64\libs -LC:\SciSoft\WinPython-64bit-2.7.10.3\python-2.7.10.amd64 -lpython27 -lcublas -lcudart')
WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available (error: cuda unavilable)
NP time: 0.467000[s], theano time: 0.431000[s](times should be close when run on CPU!)
Result difference: 0.000000

I have followed all the instructions from https://datanoord.com/2016/02/01/setup-a-deep-learning-environment-on-windows-theano-keras-with-gpu-enabled/
but can't seem to get it work.

I have added
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\bin
to my PATH variable

Every time I run the code from the Theano website to test whether a CPU or GPU is used, it gives me a fatal error of
"nvcc fatal : Cannot find compiler 'cl.exe' in PATH"

Here is the code I use to test:

from theano import function, config, shared, sandbox
import theano.tensor as T
import numpy
import time

vlen = 10 * 30 * 768  # 10 x #cores x # threads per core
iters = 1000

rng = numpy.random.RandomState(22)
x = shared(numpy.asarray(rng.rand(vlen), config.floatX))
f = function([], T.exp(x))
print(f.maker.fgraph.toposort())
t0 = time.time()
for i in range(iters):
    r = f()
t1 = time.time()
print("Looping %d times took %f seconds" % (iters, t1 - t0))
print("Result is %s" % (r,))
if numpy.any([isinstance(x.op, T.Elemwise) for x in f.maker.fgraph.toposort()]):
    print('Used the cpu')
else:
    print('Used the gpu')

How can I solve this?

Hunter Provyn

unread,

Nov 11, 2016, 12:59:59 AM11/11/16

to theano-users

I followed the instructions to install CUDA using mounted MSVS 15 - it worked, I could run the test code from MSVS and the error below tells me I have CUDA installed.

I'm not sure what --cl-version I am supposed to be using. 2014 fails with this message: "nvcc fatal   : Value '2014' is not defined for option 'cl-version'".  However there is a file cl.exe in the specified folder.

--cl-version=2015 fails with the below error

ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return status', 1, 'for cmd', 'nvcc -shared -O3 --use-local-env --cl-version=2015 --compiler-bindir C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin -Xlinker /DEBUG -D HAVE_ROUND -m64 -Xcompiler -DCUDA_NDARRAY_CUH=mc72d035fdf91890f3b36710688069b2e,-DNPY_NO_DEPRECATED_API=NPY_1_7_API_VERSION,/Zi,/MD -IC:\\Users\\Big Pigeon\\Anaconda3\\lib\\site-packages\\theano\\sandbox\\cuda -IC:\\Users\\Big Pigeon\\Anaconda3\\lib\\site-packages\\numpy\\core\\include -IC:\\Users\\Big Pigeon\\Anaconda3\\include -IC:\\Users\\Big Pigeon\\Anaconda3\\lib\\site-packages\\theano\\gof -o C:\\Users\\Big Pigeon\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.5.2-64\\cuda_ndarray\\cuda_ndarray.pyd mod.cu -LC:\\Users\\Big Pigeon\\Anaconda3\\libs -LC:\\Users\\Big Pigeon\\Anaconda3 -lcublas -lpython35 -lcudart')

WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available  (error: cuda unavailable)

nvcc warning : The 'compute_20', 'sm_20', and 'sm_21' architectures are deprecated, and may be removed in a future release (Use -Wno-deprecated-gpu-targets to suppress warning).

nvcc fatal   : Cannot find compiler 'cl.exe' in PATH

My .theanorc

[global]

device = gpu

floatX = float32

mode=FAST_RUN

[nvcc]

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

compiler_bindir = C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

[cuda]

root = C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v8.0

[gcc] 

cxxflags = -shared -I"C:\TDM-GCC-64\include" -I"C:\TDM-GCC-64\x86_64-w64-mingw32\include"

I appreciate any advice to get this working.

Hunter Provyn

unread,

Nov 11, 2016, 1:14:25 AM11/11/16

to theano-users

These are in my PATH:

C:\Users\Big Pigeon\Anaconda3

C:\Users\Big Pigeon\Anaconda3\Scripts

C:\Users\Big Pigeon\Anaconda3\Library\bin

%USERPROFILE%\AppData\Local\Microsoft\WindowsApps

C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\bin

C:\Program Files\mingw-w64\x86_64-5.3.0-posix-seh-rt_v4-rev0\mingw64\bin

I also did follow the instructions to gendef and dlltool to the python35.dll and copy the libpython35.a to my Anaconda3\libs

Hunter Provyn

unread,

Nov 12, 2016, 2:16:53 PM11/12/16

to theano-users

I used this guide and it works.

https://github.com/philferriere/dlwin

The only change I had to make was to alter the C:\Program Files (x86)\Windows Kits\10\Lib10.0.10240 to 10.0.14393.0 for the LIB and INCLUDE system paths.

The 10240 version didn't contain an \um dir for me so I got an error:  missing uuid.lib

Hunter Provyn

unread,

Nov 12, 2016, 2:17:55 PM11/12/16

to theano-users

I also had to change the path of my OpenBlas to not contain a space. Theano didn't like it.

Frédéric Bastien

unread,

Nov 17, 2016, 3:26:43 PM11/17/16

to theano-users

thanks for the update and the fixes you found.

There is many fix in the dev version of Theano about spaces in the path. Which version of Theano did you used?

Where can I find cl exe?

cl.exe is usually located at %VCINSTALLDIR%\bin\ . VCINSTALLDIR environment variable is not set by default, but it is being set when you open Visual Studio's Native Tools Command Prompt.

How do I know if CL exe is installed?

You can test that you have the C++ compiler, cl.exe , installed correctly by typing 'cl' and you should see a copyright message with the version and basic usage description.

What is Cl exe?

cl.exe is a tool that controls the Microsoft C++ (MSVC) C and C++ compilers and linker. cl.exe can be run only on operating systems that support Microsoft Visual Studio for Windows. You can start this tool only from a Visual Studio developer command prompt.

Can I use Cuda without Visual Studio?

You do not need the Visual Studio IDE to program in CUDA.