https://blog.csdn.net/qq_46107892/article/details/131453019
首先是安装cuda11.8
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2004/x86_64/cuda-ubuntu2004.pin
sudo mv cuda-ubuntu2004.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/11.8.0/local_installers/cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo dpkg -i cuda-repo-ubuntu2004-11-8-local_11.8.0-520.61.05-1_amd64.deb
sudo cp /var/cuda-repo-ubuntu2004-11-8-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda
添加到环境变量上:
sudo gedit ~/.bashrc
export PATH=/home/cuda/cuda118/bin:$PATH
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/home/cuda/cuda118/lib64
which nvcc
nvcc -V
然后安装cudnn8.6,注意需要使用NVIDIA账号:
https://developer.nvidia.cn/rdp/cudnn-archive
下载好后解压,然后复制相关文件到cuda即可:
sudo cp -r lib/* /usr/local/cuda-11.8/lib64
sudo cp -r include/* /usr/local/cuda-11.8/include
最后是tensorRT的安装,也是去官网进行下载然后复制:
sudo cp -r lib/* /usr/local/cuda-11.8/lib64
sudo cp -r include/* /usr/local/cuda-11.8/include
sudo cp -r lib/* /usr/local/cuda-11.8/lib64
sudo cp -r include/* /usr/local/cuda-11.8/include