1. 更新nvidia驱动
sudo apt-get install nvidia-driver-440 nvidia-settings nvidia-prime
2. 更新cuda套件
wget https://developer.download.nvidia.com/compute/cuda/11.4.4/local_installers/cuda_11.4.4_470.82.01_linux.run
sudo sh cuda_11.4.4_470.82.01_linux.run
测试运行cuda
cd ../NVIDIA_CUDA-11.4_Samples/ 50 ll 51 cd 1_Utilities/ 52 ll 53 cd bandwidthTest/ 54 make 55 ll 56 ./bandwidthTest
3. 下载安装cudnn
wget https://mirrors.tuna.tsinghua.edu.cn/anaconda/pkgs/main/linux-64/cudnn-8.2.1-cuda11.3_0.tar.bz2 --no-check-certificate 79 mkdir cudnn-8.2.1 80 tar -jxvf cudnn-8.2.1-cuda11.3_0.tar.bz2 -C cudnn-8.2.1 81 ll cudnn-8.2.1 82 cp cudnn-8.2.1/include/cudnn.h /usr/local/cuda/include 83 sudo cp cudnn-8.2.1/include/cudnn.h /usr/local/cuda/include 85 sudo cp cudnn-8.2.1/lib/libcudnn* /usr/local/cuda/lib64 87 sudo chmod a+r /usr/local/cuda/include/cudnn.h /usr/local/cuda/lib64/libcudnn*
4. 安装 TensorFlow gpu 2.6.0
pip3 install tensorflow-gpu==2.6.0