Why an error occurs when executing a program with a GPU and there are no errors when executing a program with a CPU.
Program:
""" Created on Tue Feb 14 16:41:40 2017 @author: George """ # -*- coding: utf-8 -*- 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') Running a program with a GPU:
Python 3.5.2 |Anaconda custom (32-bit)| (default, Jul 5 2016, 11:45:57) [MSC v.1900 32 bit (Intel)] Type "copyright", "credits" or "license" for more information. IPython 5.1.0 -- An enhanced Interactive Python. ? -> Introduction and overview of IPython's features. %quickref -> Quick reference. help -> Python's own help system. object? -> Details about 'object', use 'object??' for extra details. runfile('H:/Users/George/untitled10.py', wdir='H:/Users/George') Using gpu device 0: GeForce GTX 980 (CNMeM is enabled with initial size: 50.0% of memory, cuDNN not available) Traceback (most recent call last): File "<ipython-input-1-f00bb712112e>", line 1, in <module> runfile('H:/Users/George/untitled10.py', wdir='H:/Users/George') File "H:\Users\George\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 866, in runfile execfile(filename, namespace) File "H:\Users\George\Anaconda3\lib\site-packages\spyder\utils\site\sitecustomize.py", line 102, in execfile exec(compile(f.read(), filename, 'exec'), namespace) File "H:/Users/George/untitled10.py", line 8, in <module> from theano import function, config, shared, sandbox File "H:\Users\George\Anaconda3\lib\site-packages\theano\__init__.py", line 111, in <module> theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1() File "H:\Users\George\Anaconda3\lib\site-packages\theano\sandbox\cuda\tests\test_driver.py", line 31, in test_nvidia_driver1 profile=False) File "H:\Users\George\Anaconda3\lib\site-packages\theano\compile\function.py", line 320, in function output_keys=output_keys) File "H:\Users\George\Anaconda3\lib\site-packages\theano\compile\pfunc.py", line 479, in pfunc output_keys=output_keys) File "H:\Users\George\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 1777, in orig_function defaults) File "H:\Users\George\Anaconda3\lib\site-packages\theano\compile\function_module.py", line 1641, in create input_storage=input_storage_lists, storage_map=storage_map) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\link.py", line 690, in make_thunk storage_map=storage_map)[:3] File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\vm.py", line 1003, in make_all no_recycling)) File "H:\Users\George\Anaconda3\lib\site-packages\theano\sandbox\cuda\__init__.py", line 256, in make_thunk compute_map, no_recycling) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\op.py", line 970, in make_thunk no_recycling) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\op.py", line 879, in make_c_thunk output_storage=node_output_storage) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1200, in make_thunk keep_lock=keep_lock) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1143, in __compile__ keep_lock=keep_lock) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1595, in cthunk_factory key=key, lnk=self, keep_lock=keep_lock) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\cmodule.py", line 1142, in module_from_key module = lnk.compile_cmodule(location) File "H:\Users\George\Anaconda3\lib\site-packages\theano\gof\cc.py", line 1506, in compile_cmodule preargs=preargs) File "H:\Users\George\Anaconda3\lib\site-packages\theano\sandbox\cuda\nvcc_compiler.py", line 362, in compile_str nvcc_stdout, nvcc_stderr = decode_iter(p.communicate()[:2]) File "H:\Users\George\Anaconda3\lib\site-packages\theano\compat\__init__.py", line 46, in decode_iter yield x.decode() UnicodeDecodeError: 'utf-8' codec can't decode byte 0xd1 in position 3: invalid continuation byte