theano.test() : optimization failure due to consta

2019-07-03 08:11发布

When running theano.test() on an Ubuntu operating system, some error message about an optimization failure is produced as follows:

ERROR (theano.gof.opt): Optimization failure due to: constant_folding

ERROR (theano.gof.opt): TRACEBACK:

ERROR (theano.gof.opt): Traceback (most recent call last):

File "/usr/local/lib/python2.7/dist-packages/theano/gof/opt.py", line 1286, in process_node
replacements = lopt.transform(node)
File "/usr/local/lib/python2.7/dist-packages/theano/tensor/opt.py", line 3996, in constant_folding
no_recycling=[])

File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/__init__.py", line 237, in make_thunk
compute_map, no_recycling)

File "/usr/local/lib/python2.7/dist-packages/theano/gof/op.py", line 606, in make_thunk
output_storage=node_output_storage)

File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 948, in make_thunk
keep_lock=keep_lock)

File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 891, in __compile__
keep_lock=keep_lock)

File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1322, in cthunk_factory
key=key, fn=self.compile_cmodule_by_step, keep_lock=keep_lock)
File "/usr/local/lib/python2.7/dist-packages/theano/gof/cmodule.py", line 996, in module_from_key
module = next(compile_steps)

File "/usr/local/lib/python2.7/dist-packages/theano/gof/cc.py", line 1237, in compile_cmodule_by_step
preargs=preargs)

File "/usr/local/lib/python2.7/dist-packages/theano/sandbox/cuda/nvcc_compiler.py", line 444, in compile_str
return dlimport(lib_filename)

File "/usr/local/lib/python2.7/dist-packages/theano/gof/cmodule.py", line 284, in dlimport
rval = __import__(module_name, {}, {}, [module_name])

ImportError: ('/home/csz/.theano/compiledir_Linux-3.11.0-20-generic-x86_64-with-Ubuntu-12.04-precise-x86_64-2.7.3-64/tmpcF2It0/3ea6a99a1a8d1d8523de8d72c27b90f4.so: undefined symbol: _Z25CudaNdarray_CopyFromArrayP11CudaNdarrayP23tagPyArrayObject_fields', '[GpuFromHost(TensorConstant{0.0})]')

Does anybody know a way to fix these problem, or what exactly is going on?

1条回答
Animai°情兽
2楼-- · 2019-07-03 08:42

This can be caused by many things. The error is related to the GPU. So first, make sure you can compile nvidia example and that they run fine. To be sure this isn't the problem.

The problem is that Theano isn't able to import a GPU module it compiled, because he didn't found the symbol it need. This missing symbol "_Z25CudaNdarray_CopyFromArrayP11CudaNdarrayP23tagPyArrayObject_fields" is in a shared library that Theano already pre-compiled.

What is your OS? Make sure to update to the latest development version of Theano. There was a fix recently (Monday if my memory is exact) that could solve this on some OS.

查看更多
登录 后发表回答