使用GPU导入theano时出错(Error when importing theano using GPU)

我试图在CentOS 5.6上使用theano进行通过anaconda安装的python 2.7。 如果只使用cpu,我可以导入theano,但是当我尝试使用gpu运行它时,我得到了hte错误:

>>> import theano Using gpu device 0: Tesla K20m Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/__init__.py", line 98, in <module> theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1() File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/tests/test_driver.py", line 39, in test_nvidia_driver1 if not numpy.allclose(f(), a.sum()): File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 606, in __call__ storage_map=self.fn.storage_map) File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 595, in __call__ outputs = self.fn() TypeError: Argument not a CudaNdarray Apply node that caused the error: GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>) Inputs types: [CudaNdarrayType(float32, vector)] Inputs shapes: [(10000,)] Inputs strides: [(1,)] Inputs values: ['not shown'] HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'. HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

关于如何解决这个问题的任何想法? 我一直在尝试一切,从重新安装cuda,anaconda,python ......

I am trying to use theano for python 2.7 installed through anaconda on a CentOS 5.6. I am able to import theano if only using cpu, but when I try to run it using gpu I get hte error:

>>> import theano Using gpu device 0: Tesla K20m Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/__init__.py", line 98, in <module> theano.sandbox.cuda.tests.test_driver.test_nvidia_driver1() File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/sandbox/cuda/tests/test_driver.py", line 39, in test_nvidia_driver1 if not numpy.allclose(f(), a.sum()): File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 606, in __call__ storage_map=self.fn.storage_map) File "/data/ASR1/yunwang/software/anaconda/lib/python2.7/site-packages/theano/compile/function_module.py", line 595, in __call__ outputs = self.fn() TypeError: Argument not a CudaNdarray Apply node that caused the error: GpuCAReduce{add}{1}(<CudaNdarrayType(float32, vector)>) Inputs types: [CudaNdarrayType(float32, vector)] Inputs shapes: [(10000,)] Inputs strides: [(1,)] Inputs values: ['not shown'] HINT: Re-running with most Theano optimization disabled could give you a back-trace of when this node was created. This can be done with by setting the Theano flag 'optimizer=fast_compile'. If that does not work, Theano optimizations can be disabled with 'optimizer=None'. HINT: Use the Theano flag 'exception_verbosity=high' for a debugprint and storage map footprint of this apply node.

Any ideas on how to fix that? I have been trying everything, from reinstalling cuda, anaconda,python...

最满意答案

我在阅读此链接后发现了这个问题。 显然,theano创建了一个导致问题的缓存文件夹.theano。 删除此文件夹后修复。

I have found the problem after reading this link. Apparently theano creates a cache folder .theano that was causing the issue. It was fixed after removing this folder.

更多推荐