Ubuntu 18.04 安装 nvidia 驱动

1,系统版本

# cat /etc/issue
Ubuntu 18.04.4 LTS \n \l

2,Ubuntu 18.04 安装 nvidia 驱动

  • 安装推荐驱动版本recommended
# ubuntu-drivers devices

vendor   : NVIDIA Corporation
driver   : nvidia-driver-430 - distro non-free
driver   : nvidia-driver-435 - distro non-free recommended
driver   : xserver-xorg-video-nouveau - distro free builtin
# apt install nvidia-driver-435 -y
  • 查看显卡是否安装成功
# nvidia-smi

3,禁用nouveau

  • 查看没有nouveau
# lsmod | grep nouveau

4,nvidia使用监控nvtop

# apt install cmake libncurses5-dev libncursesw5-dev git -y
# git clone https://github.com/Syllo/nvtop.git
# mkdir -p nvtop/build && cd nvtop/build
# cmake ..
# cmake .. -DNVML_RETRIEVE_HEADER_ONLINE=True
# make
Scanning dependencies of target nvtop
[ 12%] Building C object src/CMakeFiles/nvtop.dir/nvtop.c.o
In file included from /root/nvtop/include/nvtop/interface.h:25:0,
                 from /root/nvtop/src/nvtop.c:32:
/root/nvtop/include/nvtop/extract_gpuinfo.h:76:3: error: unknown type name ‘nvmlDevice_t’
   nvmlDevice_t device_handle;                     // Used to query device
   ^~~~~~~~~~~~
/root/nvtop/include/nvtop/extract_gpuinfo.h:77:20: error: ‘NVML_DEVICE_NAME_BUFFER_SIZE’ undeclared here (not in a function); did you mean ‘_PC_REC_MAX_XFER_SIZE’?
   char device_name[NVML_DEVICE_NAME_BUFFER_SIZE]; // Device Name
                    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~
                    _PC_REC_MAX_XFER_SIZE
/root/nvtop/include/nvtop/extract_gpuinfo.h:108:3: error: unknown type name ‘nvmlProcessInfo_t’
   nvmlProcessInfo_t *process_infos;  // Internal use
   ^~~~~~~~~~~~~~~~~
src/CMakeFiles/nvtop.dir/build.make:62: recipe for target 'src/CMakeFiles/nvtop.dir/nvtop.c.o' failed
make[2]: *** [src/CMakeFiles/nvtop.dir/nvtop.c.o] Error 1
CMakeFiles/Makefile2:117: recipe for target 'src/CMakeFiles/nvtop.dir/all' failed
make[1]: *** [src/CMakeFiles/nvtop.dir/all] Error 2
Makefile:129: recipe for target 'all' failed
make: *** [all] Error 2

参考:

  1. nvtop 安装 nvidia监控
  2. nvtop github
发布了672 篇原创文章 · 获赞 195 · 访问量 129万+

猜你喜欢

转载自blog.csdn.net/u010953692/article/details/105669695