down votefavorite 
<http://stackoverflow.com/questions/43371190/cant-use-gpu-with-theano-win10#>

I builded and executed deviceQuery.exe with VS2015, and the result was 
Pass, but when I test theano with the code below, some errors occurred.

from theano import function, config, shared, tensorimport numpyimport 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([], tensor.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, tensor.Elemwise) 
and
              ('Gpu' not in type(x.op).__name__)
              for x in f.maker.fgraph.toposort()]):
    print('Used the cpu')else:
    print('Used the gpu')

Error:

c1xx: fatal error C1083: Cannot open source file: 'mod.cu': No such file or 
directory
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).
mod.cu
['nvcc', '-shared', '-O3', '-LC:\\Users\\asus\\Anaconda3\\envs\\DL\\libs', 
'-use_fast_math', '--compiler-bindir', 'C:\\Program Files (x86)\\Microsoft 
Visual Studio 14.0\\VC\\bin\\x86_amd64', '-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\\asus\\Anaconda3\\envs\\DL\\lib\\site-packages\\theano\\sandbox\\cuda"',
 
'-I"C:\\Users\\asus\\Anaconda3\\envs\\DL\\lib\\site-packages\\numpy\\core\\include"',
 '-I"C:\\Users\\asus\\Anaconda3\\envs\\DL\\include"', 
'-I"C:\\Users\\asus\\Anaconda3\\envs\\DL\\lib\\site-packages\\theano\\gof"', 
'-L"C:\\Users\\asus\\Anaconda3\\envs\\DL\\libs"', 
'-L"C:\\Users\\asus\\Anaconda3\\envs\\DL"', '-o', 
'C:\\Users\\asus\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.5.3-64\\cuda_ndarray\\cuda_ndarray.pyd',
 'mod.cu', '-lcublas', '-lpython35', '-lcudart']
ERROR (theano.sandbox.cuda): Failed to compile cuda_ndarray.cu: ('nvcc return 
status', 2, 'for cmd', 'nvcc -shared -O3 
-LC:\\Users\\asus\\Anaconda3\\envs\\DL\\libs -use_fast_math --compiler-bindir 
C:\\Program Files (x86)\\Microsoft Visual Studio 14.0\\VC\\bin\\x86_amd64 
-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\\asus\\Anaconda3\\envs\\DL\\lib\\site-packages\\theano\\sandbox\\cuda"
 
-I"C:\\Users\\asus\\Anaconda3\\envs\\DL\\lib\\site-packages\\numpy\\core\\include"
 -I"C:\\Users\\asus\\Anaconda3\\envs\\DL\\include" 
-I"C:\\Users\\asus\\Anaconda3\\envs\\DL\\lib\\site-packages\\theano\\gof" 
-L"C:\\Users\\asus\\Anaconda3\\envs\\DL\\libs" 
-L"C:\\Users\\asus\\Anaconda3\\envs\\DL" -o 
C:\\Users\\asus\\AppData\\Local\\Theano\\compiledir_Windows-10-10.0.14393-SP0-Intel64_Family_6_Model_94_Stepping_3_GenuineIntel-3.5.3-64\\cuda_ndarray\\cuda_ndarray.pyd
 mod.cu -lcublas -lpython35 -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)

It seems that cuda_ndarray.cu can't be compiled, but I can't figure out the 
reason.

My .theanorc file

[global]

openmp=False

device = gpu

optimizer_including=cudnn

floatX = float32

allow_input_downcast=True
[lib]

cnmem = 0.8
[blas]

ldflags=
[gcc]

cxxflags=-IC:\Users\asus\Anaconda3\envs\DL\MinGW
[nvcc]

flags = -LC:\Users\asus\Anaconda3\envs\DL\libs

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

fastmath = True

cuda version : 8.0

cuDNN version : 5.1

theano version : 0.9.0 (conda install theano)

visual studio version : 2015

operating system : win10 (64-bit)

python version : 3.5.3 (64-bit)

I have spent over 15 hours googling and configuring it, and I am willing to 
add any essential information. I appreciate for any advice.

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"theano-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to