自学内容网 自学内容网

ubuntu.24安装cuda

1.下载CUDA Toolkit
https://developer.nvidia.com/cuda-toolkit-archive
2.按照命令下载,安装

sudo sh cuda_12.2.2_535.104.05_linux.run
3.环境变量
sudo vi /etc/profile
最后面添加
export PATH=“/usr/local/cuda-12.2/bin: P A T H " e x p o r t L D L I B R A R Y P A T H = " / u s r / l o c a l / c u d a − 12.2 / l i b 64 : PATH" export LD_LIBRARY_PATH="/usr/local/cuda-12.2/lib64: PATH"exportLDLIBRARYPATH="/usr/local/cuda12.2/lib64:LD_LIBRARY_PATH”
重启
reboot
检查
nvcc -V
4.Removing CUDA Toolkit and Driver
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
5.官方文档
https://docs.nvidia.com/cuda/cuda-installation-guide-linux/contents.html
6.安装cuddn
https://developer.nvidia.cn/rdp/cudnn-archive
sudo tar -xf cudnn-linux-x86_64-8.9.7.29_cuda12-archive.tar.xz
cd cudnn-linux-x86_64-8.9.7.29_cuda12-archive/
sudo cp lib/libcudnn* /usr/local/cuda-12.2/lib64
sudo cp include/* /usr/local/cuda-12.2/include
sudo chmod a+r /usr/local/cuda-12.2/include/cudnn.h
sudo chmod a+r /usr/local/cuda-12.2/lib64/libcudnn*
#测试
cat /usr/local/cuda-12.2/include/cudnn_version.h | grep CUDNN_MAJOR -A 2


原文地址:https://blog.csdn.net/luoganttcc/article/details/143839418

免责声明:本站文章内容转载自网络资源,如本站内容侵犯了原著者的合法权益,可联系本站删除。更多内容请关注自学内容网(zxcms.com)!