ubuntu18.04开机后NVIDIA显卡驱动加载失败
1.开机按esc进⼊ubuntu⾼级选项,选择内核版本,之后回车
注意:记住此版本号
2.接下来按照如下操作
# If you change this file, run 'update-grub' afterwards to update
# /boot/grub/grub.cfg.
# For full documentation of the options in this file, see:
#  info -f grub -n 'Simple configuration'
# GRUB_DEFAULT=0
GRUB_DEFAULT="1> 2"  # 修改后的配置
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=0
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
# Uncomment to enable BadRAM filtering, modify to suit your needs
# This works with Linux (no patch required) and with any kernel that obtains
# the memory map information from GRUB (GNU Mach, kernel of FreeBSD ...)
#GRUB_BADRAM="0x01234567,0xfefefefe,0x89abcdef,0xefefefef"
# Uncomment to disable graphical terminal (grub-pc only)
#GRUB_TERMINAL=console
# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
#GRUB_GFXMODE=640x480
# Uncomment if you don't want GRUB to pass "root=UUID=xxx" parameter to Linux
#GRUB_DISABLE_LINUX_UUID=true
# Uncomment to disable generation of recovery mode menu entries
#GRUB_DISABLE_RECOVERY="true"
# Uncomment to get a beep at grub start
#GRUB_INIT_TUNE="480 440 1"
ubuntu vim命令
3.重启之后采⽤uname -r 查看当前的内核版本
执⾏darknet下⾯的⽂件后出现新的问题
(yolov4) waq@waq-MS-7885:~/Downloads/ai/Vitis-AI-1.3.2/yolo_dploy/darknet-master$ ./darknet detector train  cfg/voc.data cfg/yolov4.cfg  yolov4.weights -map CUDA status Error: file: ./src/dark_cuda.c : () : line: 38 : build time: Nov 22 2021 - 20:42:38
CUDA Error: unknown error
Darknet error location: ./src/dark_cuda.c, check_error, line #69
CUDA Error: unknown error: Bad file descriptor
(yolov4) waq@waq-MS-7885:~/Downloads/ai/Vitis-AI-1.3.2/yolo_dploy/darknet-master$
搜集资料发现是cuda的问题,哎,再重新装⼀次cuda
1.官⽹下载安装⽂件,我这⾥下载的是run⽂件,安装之前卸载掉之前安装的旧版本cuda10.1(具体版本查看nvcc --version)
⼀般默认安装路径是/usr/local/ 下⾯,卸载旧版本进⼊到 /usr/local/cuda-10.1/bin下⾯,执⾏ sudo ./cuda-uninstaller⽂件,最后成功卸载,可以紧接着删除⽂件夹即可
2.安装新下载的run⽂件
注意选择安装的时候不要勾选驱动,去掉x即可,其他的勾选,安装完之后会有⼀个summary:
===========
= Summary =
===========
Driver:  Not Selected
Toolkit:  Installed in /usr/local/cuda-10.1/
Samples:  Installed in /home/waq/, but missing recommended libraries
Please make sure that
-  PATH includes /usr/local/cuda-10.1/bin
-  LD_LIBRARY_PATH includes /usr/local/cuda-10.1/lib64, or, add /usr/local/cuda-10.1/lib64 to /etc/f and run ldconfig as root
To uninstall the CUDA Toolkit, run cuda-uninstaller in /usr/local/cuda-10.1/bin
Please see CUDA_Installation_Guide_Linux.pdf in /usr/local/cuda-10.1/doc/pdf for detailed information on setting up CUDA.
***WARNING: Incomplete installation! This installation did not install the CUDA Driver. A driver of version at least 418.00 is required for CUDA 10.1 functionality to work. To install the driver using this installer, run the following command, replacing <CudaInstaller> with the name of this run file:
sudo <CudaInstaller>.run --silent --driver
Logfile is /var/log/cuda-installer.log
3.安装完成之后添加环境变量,在home⽬录下,ctrl+H打开隐藏的⽂件,到.bashrc,打开添加路径(vi ~/vim .bashrc)
4.完成之后测试官⽅的例⼦,⼀直失败
./
CUDA Device Query (Runtime API) version (CUDART static linking)
cudaGetDeviceCount returned 999
-> unknown error
Result = FAIL
sudo apt-get update
sudo apt-get install gcc-8
sudo apt-get install g++-8
cd /usr/bin
sudo rm gcc g++
sudo ln -s gcc-8 gcc
sudo ln -s g++-8 g++
blog.csdn/weixin_44128857/article/details/108554751
3.修改完gcc版本之后,安装cuda,然后再添加环境变量,最后测试
注意cuda版本需要对应,我截图中版本不同,所以需要将环境变量⾥⾯的版本修改为具体安装的版本
下载完成后解压并进⼊⽂件夹:
sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
sudo chmod a+r /usr/local/cuda/include/cudnn.h
sudo chmod a+r /usr/local/cuda/lib64/libcudnn*
在终端查看CUDNN版本:
cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2
输出结果:
#define CUDNN_MAJOR 7
#define CUDNN_MINOR 5
#define CUDNN_PATCHLEVEL 0
--
#define CUDNN_VERSION (CUDNN_MAJOR * 1000 + CUDNN_MINOR * 100 + CUDNN_PATCHLEVEL)
#include "driver_types.h"

版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系QQ:729038198,我们将在24小时内删除。