目录
安装miniconda
安装tensorflow
安装 libcudnn
安装miniconda
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh && bash Miniconda3-latest-Linux-x86_64.sh
安装tensorflow
tensorflow官网,查看版本对应
https://tensorflow.google.cn/install?hl=en
pip install tensorflow-gpu==2.9.0 -i https://pypi.tuna.tsinghua.edu.cn/simple
使用 print(tf.config.list_physical_devices('GPU')) 查看GPU时报错
2024-01-23 14:37:14.298095: W tensorflow/stream_executor/platform/default/dso_loader.cc:64] Could not load dynamic library 'libcudnn.so.8'; dlerror: libcudnn.so.8: cannot open shared object file: No such file or directory; LD_LIBRARY_PATH: /usr/local/cuda-11.7/lib64:/usr/local/cuda-11.7/lib64:/usr/local/cuda-11.7/lib64
2024-01-23 14:37:14.298127: W tensorflow/core/common_runtime/gpu/gpu_device.cc:1850] Cannot dlopen some GPU libraries. Please make sure the missing libraries mentioned above are installed properly if you would like to use GPU. Follow the guide at https://www.tensorflow.org/install/gpu for how to download and setup the required libraries for your platform.
Skipping registering GPU devices...
安装 libcudnn
报以上错误是因为没有安装cudnn
下载网址:Index of /compute/cuda/repos/ubuntu2004/x86_64 (nvidia.com)
下载命令:
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/libcudnn8_8.5.0.96-1+cuda11.7_amd64.deb
安装
sudo dpkg -i libcudnn8_8.5.0.96-1+cuda11.7_amd64.deb
安装成功