Ubuntu22.04+Nvidia驱动+Cuda11.8+cudnn8.6 |
您所在的位置:网站首页 › ubuntu2004nvidia驱动 › Ubuntu22.04+Nvidia驱动+Cuda11.8+cudnn8.6 |
Ubuntu22.04+Nvidia驱动+Cuda11.8 2、添加两行语句: blacklist nouveauoptions nouveau modeset=03、更新initramfs sudo update-initramfs -u4、重启 reboot5、验证,终端输入语句, lsmod | grep nouveau# 没有输出说明操作成功2. 确定要安装的驱动版本cat /proc/driver/nvidia/version3. 两种安装方式(1)自动安装驱动# 查找可选择安装的版本自动安装sudo ubuntu-drivers autoinstall(2)指定驱动安装# 列出设备,显示的model是显卡型号,driver是可选的驱动ubuntu-drivers devices== /sys/devices/pci0000:00/0000:00:01.0/0000:01:00.0 ==modalias : pci:v000010DEd00002504sv00001458sd00004072bc03sc00i00vendor : NVIDIA Corporationmodel : GA106 [GeForce RTX 3060 Lite Hash Rate]manual_install: Truedriver : nvidia-driver-470-server - distro non-freedriver : nvidia-driver-515-server - distro non-freedriver : nvidia-driver-510-server - distro non-freedriver : nvidia-driver-470 - distro non-freedriver : nvidia-driver-510 - distro non-freedriver : nvidia-driver-520 - distro non-freedriver : nvidia-driver-515-open - distro non-freedriver : nvidia-driver-520-open - distro non-free recommendeddriver : nvidia-driver-515 - distro non-freedriver : xserver-xorg-video-nouveau - distro free builtin # 安装其中 recommended 一个驱动sudo apt install nvidia-driver-520-opensudo reboot 如果出现 : Failed to initialize NVML: Driver/library version mismatch,则可能是版本不对。 我这很不幸地出现 : no devices were found,最后使用下面方式安装成功。 (3)到官网下载驱动安装https://www.nvidia.com/Download/index.aspx?lang=en-us # 查看显卡型号lspci -vnn | grep VGA # 卸载旧驱动sudo apt-get remove --purge nvidia*# 给run文件可执行权限 sudo chmod a+x NVIDIA-Linux-x86_64-515.86.01.run# 安装 sudo ./NVIDIA-Linux-x86_64-440.64.run -no-x-check -no-nouveau-check -no-opengl-files# -no-x-check:安装驱动时关闭X服务# -no-nouveau-check:安装驱动时禁用nouveau# -no-opengl-files:只安装驱动文件,不安装OpenGL文件提示: Would you like to register the kernel module sources with DKMS? 选择No 提示: Nvidia's 32-bit compatibility libraries? 选择No 提示: Would you like to run the nvidia-xconfigutility to automatically update your x configuration so that the NVIDIA x driver will be used when you restart x? 选择Yes 安装完重新启动电脑。 二、安装Cuda1. 下载Cudahttps://developer.nvidia.com/cuda-downloads?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu 我这里下载的是Cuda11.8: 需要注意的是,之前已经安装过显卡驱动程序,在提问是否安装显卡驱动时选择no 其他 选择默认路径或者yes即可。 2. 如果之前已经安装了Cuda,则卸载掉。sudo /usr/local/cuda-11.8/bin/uninstall_cuda_8.0.plsudo rm -rf /usr/local/cuda-8.03. 安装chomd +x cuda_11.8.0_520.61.05_linux.runsudo ./cuda_11.8.0_520.61.05_linux.run三、安装cuDNNhttps://developer.nvidia.com/rdp/cudnn-download 这里下载 deb 格式,安装: sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.0_amd64.debsudo cp /var/cudnn-local-repo-ubuntu2204-8.6.0.163/cudnn-local-FAED14DD-keyring.gpg /usr/share/keyrings/sudo apt-get updatesudo apt-get install libcudnn8=8.6.0.163-1+cuda11.8 # 这里输入到=按tab补全即可,安装运行库sudo apt-get install libcudnn8-dev=8.6.0.163-1+cuda11.8 # 通过tab自动补全,安装developer 库sudo apt-get install libcudnn8-samples=8.6.0.163-1+cuda11.8 # 通过tab自动补全,安装示例和文档测试:cp -r /usr/src/cudnn_samples_v8/ $HOME cd ~/cudnn_samples_v8/mnistCUDNN/make clean && make# 如果提示下面截图中的错误,就执行下面语句安装freeimage3库sudo apt-get install libfreeimage3 libfreeimage-dev运行测试: ./mnistCUDNN
|
今日新闻 |
推荐新闻 |
CopyRight 2018-2019 办公设备维修网 版权所有 豫ICP备15022753号-3 |