gpt4 book ai didi

docker - 带有tensorflow gpu的docker-ImportError:libcublas.so.9.0:无法打开共享对象文件:没有这样的文件或目录

转载 作者:行者123 更新时间:2023-12-02 19:32:55 26 4
gpt4 key购买 nike

我试图使用Nvidia GPU使用tensorflow运行docker,但是当我运行容器时,出现以下错误:

pgp_1  | Traceback (most recent call last):
pgp_1 | File "/opt/app-root/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow.py", line 58, in <module>
pgp_1 | from tensorflow.python.pywrap_tensorflow_internal import *
pgp_1 | File "/opt/app-root/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 28, in <module>
pgp_1 | _pywrap_tensorflow_internal = swig_import_helper()
pgp_1 | File "/opt/app-root/lib/python3.6/site-packages/tensorflow/python/pywrap_tensorflow_internal.py", line 24, in swig_import_helper
pgp_1 | _mod = imp.load_module('_pywrap_tensorflow_internal', fp, pathname, description)
pgp_1 | File "/opt/app-root/lib64/python3.6/imp.py", line 243, in load_module
pgp_1 | return load_dynamic(name, filename, file)
pgp_1 | File "/opt/app-root/lib64/python3.6/imp.py", line 343, in load_dynamic
pgp_1 | return _load(spec)
pgp_1 | ImportError: libcublas.so.9.0: cannot open shared object file: No such file or directory

Docker撰写

我的docker compose文件如下所示:
version: '3'
services:
pgp:
devices:
- /dev/nvidia0
- /dev/nvidia1
- /dev/nvidia2
- /dev/nvidia3
- /dev/nvidia4
- /dev/nvidiactl
- /dev/nvidia-uvm
image: "myimg/pgp"
ports:
- "5000:5000"
environment:
- LD_LIBRARY_PATH=/opt/local/cuda/lib64/
- GPU_DEVICE=4
- NVIDIA_VISIBLE_DEVICES all
- NVIDIA_DRIVER_CAPABILITIES compute,utility
volumes:
- ./train_package:/opt/app-root/src/train_package
- /usr/local/cuda/lib64/:/opt/local/cuda/lib64/

如您所见,我尝试过将主机cuda映射到docker容器的卷,但这没有帮助。

我能够成功运行 nvidia-docker run --rm nvidia/cuda nvidia-smi
版本号

库达

cat /usr/local/cuda/version.txt显示CUDA版本9.0.176

nvcc -V

nvcc -V
nvcc:NVIDIA(R)Cuda编译器驱动程序
版权所有(c)2005-2017 NVIDIA Corporation
建立在Fri_Sep__1_21:08:03_CDT_2017
Cuda编译工具,版本9.0,V9.0.176

nvidia-docker版本

NVIDIA Docker:2.0.3
客户:
版本:17.12.1-ce

API版本:1.35

Go版本:go1.9.4

Git提交:7390FC6
建成时间:2018年2月27日星期二22:17:40

操作系统/ Arch:linux / amd64

服务器:
发动机:
版本:17.12.1-ce

API版本:1.35(最低版本1.12)

Go版本:go1.9.4

Git提交:7390FC6

建成时间:2018年2月27日星期二22:16:13

操作系统/ Arch:linux / amd64

实验性:错误

Tensorflow

1.5通过gp支持gpu
ldconfig -p | grep cuda
libnvrtc.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvrtc.so.9.0
libnvrtc.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvrtc.so
libnvrtc-builtins.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvrtc-builtins.so.9.0
libnvrtc-builtins.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvrtc-builtins.so
libnvgraph.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvgraph.so.9.0
libnvgraph.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvgraph.so
libnvblas.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvblas.so.9.0
libnvblas.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvblas.so
libnvToolsExt.so.1 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvToolsExt.so.1
libnvToolsExt.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnvToolsExt.so
libnpps.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnpps.so.9.0
libnpps.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnpps.so
libnppitc.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppitc.so.9.0
libnppitc.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppitc.so
libnppisu.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppisu.so.9.0
libnppisu.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppisu.so
libnppist.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppist.so.9.0
libnppist.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppist.so
libnppim.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppim.so.9.0
libnppim.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppim.so
libnppig.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppig.so.9.0
libnppig.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppig.so
libnppif.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppif.so.9.0
libnppif.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppif.so
libnppidei.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppidei.so.9.0
libnppidei.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppidei.so
libnppicom.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppicom.so.9.0
libnppicom.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppicom.so
libnppicc.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppicc.so.9.0
libnppicc.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppicc.so
libnppial.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppial.so.9.0
libnppial.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppial.so
libnppc.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppc.so.9.0
libnppc.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libnppc.so
libicudata.so.55 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libicudata.so.55
libcusparse.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcusparse.so.9.0
libcusparse.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcusparse.so
libcusolver.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcusolver.so.9.0
libcusolver.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcusolver.so
libcurand.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcurand.so.9.0
libcurand.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcurand.so
libcuinj64.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcuinj64.so.9.0
libcuinj64.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcuinj64.so
libcufftw.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcufftw.so.9.0
libcufftw.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcufftw.so
libcufft.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcufft.so.9.0
libcufft.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcufft.so
libcudart.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart.so.9.0
libcudart.so.7.5 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcudart.so.7.5
libcudart.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcudart.so
libcudart.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcudart.so
libcuda.so.1 (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so.1
libcuda.so (libc6,x86-64) => /usr/lib/x86_64-linux-gnu/libcuda.so
libcublas.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcublas.so.9.0
libcublas.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libcublas.so
libaccinj64.so.9.0 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libaccinj64.so.9.0
libaccinj64.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libaccinj64.so
libOpenCL.so.1 (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libOpenCL.so.1
libOpenCL.so (libc6,x86-64) => /usr/local/cuda-9.0/targets/x86_64-linux/lib/libOpenCL.so

在Docker vs主机上使用Tensorflow进行测试

在主机上运行时,以下工作:
python3 -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"

v1.5.0-0-g37aa430d84 1.5.0

运行容器
nvidia-docker run -d --name testtfgpu -p 8888:8888 -p 6006:6006 gcr.io/tensorflow/tensorflow:latest-gpu
登录
nvidia-docker exec -it testtfgpu bash
测试Tensorflow版本
pip show tensorflow-gpu显示:

pip show tensorflow-gpu
Name: tensorflow-gpu
Version: 1.6.0
Summary: TensorFlow helps the tensors flow
Home-page: https://www.tensorflow.org/
Author: Google Inc.
Author-email: opensource@google.com
License: Apache 2.0
Location: /usr/local/lib/python2.7/dist-packages
Requires: astor, protobuf, gast, tensorboard, six, wheel, absl-py, backports.weakref, termcolor, enum34, numpy, grpcio, mock

Python 2
python -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
结果是:
Illegal instruction (core dumped)

Python 3
python3 -c "import tensorflow as tf; print(tf.GIT_VERSION, tf.VERSION)"
结果是:
python3 -c "import tensorflow as tf; print(tf.GIT_ 
Traceback (most recent call last):
File "<string>", line 1, in <module>
ImportError: No module named 'tensorflow'

最佳答案

问题是由于您的cuDNN版本。 Tensorflow-GPU 1.5版本将支持cuDNN 7.0._版本。您可以从here下载。确保您的CUDA版本9.0._和cuDNN版本7.0._。有关更多详细信息,请引用here中的链接。

关于docker - 带有tensorflow gpu的docker-ImportError:libcublas.so.9.0:无法打开共享对象文件:没有这样的文件或目录,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/49396659/

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