CuDNN在二进制安装的Cupy中不可用

时间:2019-04-24 05:03:32

标签: chainer cupy

我使用二进制软件包cupy-cuda92安装了Cupy,但未加载CuDNN。

$ pip install cupy-cuda92==5.4.0 chainer==5.4.0

$ python -c 'import chainer; chainer.print_runtime_info()'
/home/xxxxx/.pyenv/versions/3.5.2/lib/python3.5/site-packages/chainer/backends/cuda.py:98: UserWarning: cuDNN is not enabled.
Please reinstall CuPy after you install cudnn
(see https://docs-cupy.chainer.org/en/stable/install.html#install-cudnn).
  'cuDNN is not enabled.\n'
Platform: Linux-4.4.0-103-generic-x86_64-with-debian-stretch-sid
Chainer: 5.3.0
NumPy: 1.16.2
CuPy:
  CuPy Version          : 5.3.0
  CUDA Root             : /usr/local/cuda
  CUDA Build Version    : 9020
  CUDA Driver Version   : 9020
  CUDA Runtime Version  : 9020
  cuDNN Build Version   : None
  cuDNN Version         : None
  NCCL Build Version    : 2307
  NCCL Runtime Version  : 2402
iDeep: Not Available

我尝试使用--no-cache-dir卸载并重新安装chainer和cupy,但没有什么区别。我还确认CUDA为9.2。

$ nvcc --version
nvcc: NVIDIA (R) Cuda compiler driver
Copyright (c) 2005-2018 NVIDIA Corporation
Built on Wed_Apr_11_23:16:29_CDT_2018
Cuda compilation tools, release 9.2, V9.2.88

1 个答案:

答案 0 :(得分:2)

我自己找到了问题和解决方案。

首先,我尝试直接导入cudnn。

.get

因此,存在一种库版本不匹配的情况。我检查了$ python Python 3.5.2 (default, Mar 25 2019, 10:54:56) [GCC 5.4.0 20160609] on linux Type "help", "copyright", "credits" or "license" for more information. >>> import cupy.cuda.cudnn Traceback (most recent call last): File "<stdin>", line 1, in <module> ImportError: /home/xxxxx/.pyenv/versions/3.5.2/lib/python3.5/site-packages/cupy/cuda/cudnn.cpython-35m-x86_64-linux-gnu.so: symbol cudnnGetBatchNormalizationTrainingExReserveSpaceSize, version libcudnn.so.7 not defined in file libcudnn.so.7 with link time reference ,发现通过LD_LIBRARY_PATH安装了不同版本的CuDNN。我从cudnnenv中删除了它们,问题解决了。

LD_LIBRARY_PATH