gpt4 book ai didi

linux - 更新 CuDNN 次要版本时的静态库

转载 作者:太空宇宙 更新时间:2023-11-04 10:04:28 26 4
gpt4 key购买 nike

CuDNN 安装程序似乎在查找错误版本的 CUDA。我究竟做错了什么?完整的故事:

Ubuntu 16.04

安装了两个版本的 CUDA,9.0 和 9.1。/usr/lib/cuda 链接到 9.1 安装,LD_LIBRARY_PATH 似乎指向那个:

$ echo $LD_LIBRARY_PATH
/usr/local/cuda/lib64:/usr/local/lib
$ ls -l /usr/local
lrwxrwxrwx 1 root root 8 jan 22 2018 cuda -> cuda-9.1
drwxr-xr-x 15 root root 4096 dec 1 2017 cuda-9.0
drwxr-xr-x 15 root root 4096 jan 22 2018 cuda-9.1

现在我确实安装了 CuDNN 7.0,想用 7.1 版替换它。 (这可能是一个不明智的决定,但是,我已经开始这样做了!)

已下载 CuDNN 7.1.3 的 debian 安装程序,以配合 CUDA 9.1。尝试这样安装它:

$ sudo dpkg -i libcudnn7_7.1.3.16-1+cuda9.1_amd64.deb
(Reading database ... 261910 files and directories currently installed.)
Preparing to unpack libcudnn7_7.1.3.16-1+cuda9.1_amd64.deb ...
Unpacking libcudnn7 (7.1.3.16-1+cuda9.1) over (7.1.3.16-1+cuda9.1) ...
Setting up libcudnn7 (7.1.3.16-1+cuda9.1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
/sbin/ldconfig.real: /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link

如您所见,安装程序在库文件之后查找 cuda-9.0 目录。 (为什么?)文件存在但不是符号链接(symbolic link):

$ ls -l /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so
-rwxr-xr-x 1 root root 287624224 jan 16 2018 /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so

我也尝试删除 libcudnn,但我是在第一次尝试重新安装后删除的,因此删除会引发相同类型的错误:

$ sudo apt-get remove libcudnn7
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
cuda-9-0 cuda-command-line-tools-9-0 cuda-core-9-0 cuda-cublas-9-0
cuda-cublas-dev-9-0 cuda-cudart-9-0 cuda-cudart-dev-9-0 cuda-cufft-9-0
cuda-cufft-dev-9-0 cuda-curand-9-0 cuda-curand-dev-9-0 cuda-cusolver-9-0
cuda-cusolver-dev-9-0 cuda-cusparse-9-0 cuda-cusparse-dev-9-0
cuda-demo-suite-9-0 cuda-documentation-9-0 cuda-driver-dev-9-0
cuda-libraries-9-0 cuda-libraries-dev-9-0 cuda-license-9-0
cuda-misc-headers-9-0 cuda-npp-9-0 cuda-npp-dev-9-0 cuda-nvgraph-9-0
cuda-nvgraph-dev-9-0 cuda-nvml-dev-9-0 cuda-nvrtc-9-0 cuda-nvrtc-dev-9-0
cuda-runtime-9-0 cuda-samples-9-0 cuda-toolkit-9-0 cuda-visual-tools-9-0
libatk-wrapper-java libatk-wrapper-java-jni python-cliapp python-markdown
python-ttystatus
Use 'sudo apt autoremove' to remove them.
The following packages will be REMOVED:
libcudnn7 libcudnn7-dev
0 upgraded, 0 newly installed, 2 to remove and 18 not upgraded.
After this operation, 680 MB disk space will be freed.
Do you want to continue? [Y/n]
(Reading database ... 261909 files and directories currently installed.)
Removing libcudnn7-dev (7.1.3.16-1+cuda9.1) ...
update-alternatives: removing manually selected alternative - switching libcudnn to auto mode
Removing libcudnn7 (7.1.3.16-1+cuda9.1) ...
Processing triggers for libc-bin (2.26-0ubuntu2.1) ...
/sbin/ldconfig.real: /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudnn.so.7 is not a symbolic link

因此,大局观:我的目标是正确安装 CuDNN 7.1。我该如何实现该目标?

最佳答案

我终于成功了!我进去并手动删除了 .so 文件:

$ cd /usr/local/cuda-9.0/targets/x86_64-linux/lib/
$ sudo mv libcudnn.so bak_libcudnn.so
$ sudo mv libcudnn.so.7 bak_libcudnn.so.7
$ sudo mv libcudnn.so.7.0.5 bak_libcudnn.so.7.0.5

然后使用 dpkg 安装,并重新安装我的 tensorflow-gpu,确认一切终于正常工作:

2018-11-30 09:40:39.478559: I tensorflow/core/common_runtime/gpu/gpu_device.cc:1115] Created TensorFlow device (/job:localhost/replica:0/task:0/device:GPU:0 with 2123 MB memory) -> physical GPU (device: 0, name: Quadro M2000M, pci bus id: 0000:01:00.0, compute capability: 5.0)

关于linux - 更新 CuDNN 次要版本时的静态库,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53554188/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com