赞
踩
Ubuntu16.04&18.04系统安装nvidia驱动,cuda,cudnn! |
Ubuntu更新nvidia显卡驱动:https://blog.csdn.net/m0_38068876/article/details/127851813
显卡、显卡驱动版本、cuda版本和Pytorch相互之间的依赖关系:https://blog.csdn.net/qq_41888086/article/details/120496474
我们这里不需要人为的安装一个显卡的驱动,因为cuda里面会自带一个比较新的显卡驱动,它可能并不是最新的显卡驱动,但是总的说来他还是可以使用的。
如果想单独安装可以参考这篇博客:Ubuntu16.04 RTX2080 安装NVIDIA驱动+cuda10.0+cudnn7.3.1
首先在google里面搜索cuda10.0。链接:cuda10
https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#prerequisites
我们安装完cuda之后,在linux环境下面,电脑是需要重新启动的,如果这里不重启的话,直接nvidia-可以看到已经有smi这个命令了。但是nvidia-smi这个命令是不能和显卡进行交互的。所以出现这个问题不需要在下载一个nvidia了,这个时候只需要重启一下系统。
sudo apt install nvidia-cuda-toolkit
NVIDIA Docs Hub NVIDIA cuDNN NVIDIA cuDNN Installation Guide:https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html
export PATH=$PATH:/usr/local/cuda-10.0/bin
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-10.0/lib64
export LIBRARY_PATH=$LIBRARY_PATH:/usr/local/cuda-10.0/lib64
source /etc/profile
export CUDA_HOME=/usr/local/cuda-10.0
export LD_LIBRARY_PATH=${CUDA_HOME}/lib64
export PATH=${CUDA_HOME}/bin:${PATH}
直接make或者make -j16 #并行运行7个作业
#include <stdio.h> #include <opencv2/opencv.hpp> using namespace cv; int main(int argc, char** argv ) { if ( argc != 2 ) { printf("usage: DisplayImage.out ./one.png\n"); return -1; } Mat image; image = imread( argv[1], 1 ); if ( !image.data ) { printf("No image data \n"); return -1; } namedWindow("Display Image", WINDOW_AUTOSIZE ); imshow("Display Image", image); waitKey(0); return 0; }
cmake_minimum_required(VERSION 2.8)
project( DisplayImage )
find_package( OpenCV REQUIRED )
include_directories( ${OpenCV_INCLUDE_DIRS} )
add_executable( DisplayImage DisplayImage.cpp )
target_link_libraries( DisplayImage ${OpenCV_LIBS} )
cd <DisplayImage_directory>
cmake .
make
./DisplayImage lena.jpg
$ sudo apt-get install -y gcc-4.8
$ sudo apt-get install -y g++-4.8
$ cd /usr/bin
$ sudo rm gcc
$ sudo ln -s gcc-4.8 gcc
$ sudo rm g++
$ sudo ln -s g++-4.8 g++
sudo apt-get update && sudo apt-get upgrade
sudo /usr/bin/nvidia-uninstall
sudo apt-get remove --purge nvidia*
wang@zhangkf:~$ sudo service lightdm stop
[sudo] password for zhang:
strong@foreverstrong:~$
sudo /usr/bin/nvidia-uninstall
sudo apt-cache search nvidia*
ubuntu-drivers devices
== /sys/devices/pci0000:16/0000:16:00.0/0000:17:00.0/0000:18:10.0/0000:19:00.0 ==
manual_install: True
modalias : pci:v000010DEd00001E07sv000010DEsd000012A4bc03sc00i00
vendor : NVIDIA Corporation
driver : nvidia-418 - third-party free
driver : nvidia-430 - third-party free recommended
driver : nvidia-410 - third-party free
driver : xserver-xorg-video-nouveau - distro free builtin
driver : nvidia-415 - third-party free
- BIOS 中务必关闭 Secure Boot。不然会出现 Unable to load the ‘nvidia-drm’ kernel module. 的报错。
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。