在Windows中不能将GPU作为Theano设备

我的电脑规格是在Windows 10中的NVIDIA 1050ti GPU。

我安装了CUDA驱动程序(必须使用c ++工具安装visual studio)并运行testing,使用theano和pygpu(python 3.6.3)创build了一个新的conda环境。 运行脚本:

from theano import function, config, shared, sandbox import theano.tensor as T import numpy import time print(config.device) 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' % iters, t1 - t0, 'seconds') print('Result is', 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') 

一切正常(与CPU运行)。 然后,我创build了一个.theanorc.txt文件并添加到它:

 #!sh [global] device = cpu floatX = float32 

我试图再次运行脚本,结果是。 一些代码之后是5000行

  nvcc fatal : Cannot find compiler 'cl.exe' in PATH ['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', '-I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\lib\\site-packages\\theano\\sandbox\\cuda"', '-I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\lib\\site-packages\\numpy\\core\\include"', '-I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\include"', '-I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\lib\\site-packages\\theano\\gof"', '-L"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\libs"', '-L"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets"', '-o', 'C:\\Users\\JoaquimFerrer\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.16299-SP0-Intel64_Family_6_Model_158_Stepping_9_GenuineIntel-3.6.3-64\\cuda_ndarray\\cuda_ndarray.pyd', 'mod.cu', '-lcublas', '-lpython36', '-lcudart'] ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('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 -I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\lib\\site-packages\\theano\\sandbox\\cuda" -I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\lib\\site-packages\\numpy\\core\\include" -I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\include" -I"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\lib\\site-packages\\theano\\gof" -L"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets\\libs" -L"C:\\Users\\JoaquimFerrer\\Anaconda3\\envs\\neural_nets" -o C:\\Users\\JoaquimFerrer\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.16299-SP0-Intel64_Family_6_Model_158_Stepping_9_GenuineIntel-3.6.3-64\\cuda_ndarray\\cuda_ndarray.pyd mod.cu -lcublas -lpython36 -lcudart') WARNING (theano.sandbox.cuda): The cuda backend is deprecated and will be removed in the next release (v0.10). Please switch to the gpuarray backend. You can get more information about how to switch at this URL: https://github.com/Theano/Theano/wiki/Converting-to-the-new-gpu-back-end%28gpuarray%29 WARNING (theano.sandbox.cuda): CUDA is installed, but device gpu is not available (error: cuda unavailable) gpu 

然后输出用cpu运行的脚本。 我将cl添加到path,现在我可以在控制台中运行它,但输出没有改变。

有人可以帮忙吗? 即使以全新的方式安装一切。