Removing CUDA Toolkit and Driver
参考这篇文章把原来安装的 CUDA 有关内容全部删除了
以 Ubuntu 系统为例:
Ubuntu and Debian
To remove CUDA Toolkit:
sudo apt-get --purge remove "*cuda*" "*cublas*" "*cufft*" "*cufile*" "*curand*" \ "*cusolver*" "*cusparse*" "*gds-tools*" "*npp*" "*nvjpeg*" "nsight*" "*nvvm*"
To remove NVIDIA Drivers:
sudo apt-get --purge remove "*nvidia*" "libxnvctrl*"
To clean up the uninstall:
sudo apt-get autoremove
检查卸载情况
运行 nvidia-smi
:
安装新的 CUDA
以 CUDA11.8 为例,在 NV 官网搜索下载方式
选择对应的系统环境,会显示对应的安装命令:
重装完记得检查 ~/.bashrc
里面要加上相应的 PATH:
export PATH=/usr/local/cuda-xxx/bin${PATH:+:${PATH}}
export LD_LIBRARY_PATH=/usr/local/cuda-xxx/lib64\
{LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}
然后可以跑个 pytorch minist 的 demo 测试一下环境是否正常
如果报错 GET was unable to find an engine to execute this computation
,则用 echo 检查一下 PATH 和 LD_LIBRARY_PATH 这两个变量是否正常
参考来源: