0

我是运行 Scientific Linux 6.6 版(Carbon)的集群计算机上的非 root 用户。

在使用 CUDA 7.5 和 cuDNN 5 在 GPU 上运行代码时,我遇到了一些 theano 崩溃。我使用的是 Python 2.7、Theano 0.9、Keras 1.0.7 和 Lasange 0.1。

仅当我在启用了 cuDNN 的 GPU 节点上运行程序时,才会发生以下崩溃。该代码在禁用 cuDNN 的 CPU 和 GPU 上顺利完成。

Traceback (most recent call last):
  File "runner.py", line 306, in <module>
    main()
  File "runner.py", line 241, in main
    queries_exp = __import__(args.exp_model).queries_exp
  File "/mnt/nfs2/inf/tjb32/workspace/CNN_EL/nlp-entity-convnet/exp_multi_conv_cosim.py", line 923, in <module>
    queries_exp = EntityVectorLinkExp()
  File "/mnt/nfs2/inf/tjb32/workspace/CNN_EL/nlp-entity-convnet/exp_multi_conv_cosim.py", line 51, in __init__
    self._setup()
  File "/mnt/nfs2/inf/tjb32/workspace/CNN_EL/nlp-entity-convnet/exp_multi_conv_cosim.py", line 543, in _setup
    on_unused_input='ignore',
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/compile/function.py", line 326, in function
    output_keys=output_keys)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/compile/pfunc.py", line 484, in pfunc
    output_keys=output_keys)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/compile/function_module.py", line 1788, in orig_function
    output_keys=output_keys).create(
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/compile/function_module.py", line 1467, in __init__
    optimizer_profile = optimizer(fgraph)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 102, in __call__
    return self.optimize(fgraph)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 90, in optimize
    ret = self.apply(fgraph, *args, **kwargs)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 235, in apply
    sub_prof = optimizer.optimize(fgraph)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 90, in optimize
    ret = self.apply(fgraph, *args, **kwargs)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 235, in apply
    sub_prof = optimizer.optimize(fgraph)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 90, in optimize
    ret = self.apply(fgraph, *args, **kwargs)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 2262, in apply
    lopt_change = self.process_node(fgraph, node, lopt)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 1825, in process_node
    lopt, node)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 1719, in warn_inplace
    return NavigatorOptimizer.warn(exc, nav, repl_pairs, local_opt, node)
  File "/home/t/tj/tjb32/.local/lib/python2.7/site-packages/theano/gof/opt.py", line 1705, in warn
    raise exc
AssertionError

我的 .theanorc 看起来像这样:

[global]
floatX = float32
device = gpu

[lib]
cnmem = 1

[nvcc]
fastmath = True

我的个人资料有以下内容:

export LD_LIBRARY_PATH=/home/t/tj/tjb32/cuda/lib64:$LD_LIBRARY_PATH 
export CPATH=/home/t/tj/tjb32/cuda/include:$CPATH
export LIBRARY_PATH=/home/t/tj/tjb32/cuda/lib64:$LD_LIBRARY_PATH
export PATH=/home/t/tj/tjb32/cuda/bin:$PATH

当我查询 theano 时,返回以下内容,这表明 theano 正在与 CUDA 和 cuDNN 交互。

Using gpu device 0: Tesla K20m (CNMeM is enabled with initial size: 95.0% of memory, cuDNN 5005)

我相当确定我已经正确安装了 CUDA 和 cuDNN,如果有人能提出任何我可能错过的导致 cuDNN 使程序崩溃的额外配置步骤,我将不胜感激。

4

2 回答 2

0

我还使用 CUDA-7.5 和 CuDNN 5 在 Keras 中运行 DNN。我在我的家中创建了一个单独的目录(cuDNN/copy),并将所有 CuDNN(从 nvidia 网站获得)文件(.so 和 .h 文件)放在这个目录中。然后我对 bashrc 中的 PATH 和 LD_LIBRARY 变量进行了适当的更改。我还对 .theanorc 文件进行了更改。所以 DNN 对我有用。这就是我的 bashrc 的外观 -

##########################
# CUSTOMIZATIONS GO HERE #
##########################
export PATH="/users/start2015/r0605639/miniconda2/envs/kerPy3.4/bin:$PATH"
export PATH="/usr/local/cuda/bin:$PATH"
export LD_LIBRARY_PATH="/usr/local/cuda/lib64:$PATH"

#http://www.chioka.in/why-is-keras-running-so-slow/
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-7.5/lib64:/users/start2015/r0605639/cuDNN/copy:
export LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-7.5/lib64:/users/start2015/r0605639/cuDNN/copy:
export CPATH=$CPATH:/users/start2015/r0605639/cuDNN/copy:
export PATH=$PATH:/usr/local/cuda-7.5/bin

这就是我的 .theanorc 的样子:

[global]
device = gpu  
floatX = float32
optimizer = fast_run

[blas]
ldflags = -L/users/start2015/r0605639/kerasLibs/lib -lopenblas

[lib]
cnmem = 0.8

[cuda]
root = /usr/local/cuda-7.5

[nvcc]
fastmath = True
optimizer_including=cudnn
flags=-D_FORCE_INLINES -I/usr/local/cuda-7.5/include -I/usr/local/cuda-7.5/bin

[dnn]
enabled = True
于 2016-12-06T14:10:36.743 回答
0

不确定这是否是问题,但是: export LIBRARY_PATH=/home/t/tj/tjb32/cuda/lib64:$ LD_ LIBRARY_PATH 应该是?导出 LIBRARY_PATH=/home/t/tj/tjb32/cuda/lib64:$LIBRARY_PATH

于 2016-09-01T07:34:43.220 回答