概述
- 安装Nvidia显卡驱动
Ubuntu 18.04 新系统装完后,先更新一下,
sudo apt-get update
sudo apt-get upgrade
然后查看一下ubuntu支持的最新的英伟达显卡固件(确保自己有英伟达显卡),并查看最新适配显卡驱动。
sudo apt-cache search nvidia
ubuntu-drivers devices
点击进入Software&Updates ->Additional Drivers, 选择最新驱动进行更新,更新完重启。
- 安装CUDA Toolkit
下载好cuda10.1(下载文件为cuda_10.1.243_418.87.00_linux.run),打开下载文件夹,执行
sudo sh cuda_10.1.243_418.87.00_linux.run
因为已经安装了驱动,所以不用再安装了,其他按照指示安装即可。
安装完成之后,会出现提示:
Installing the CUDA Toolkit in /usr/local/cuda-10.1 …
Installing the CUDA Samples in /root …
Copying samples to /home/derek/NVIDIA_CUDA-10.1_Samples now…
Finished copying samples.
= Summary =
Driver: Installed
Toolkit: Installed in /usr/local/cuda-10.1
Samples: Installed in /home/derek
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/ld.so.conf and run ldconfig as root
To uninstall the CUDA Toolkit, run the uninstall script 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 413.00 is required for CUDA 10.1 functionality to work.
To install the driver using this installer, run the following command, replacing with the name of this run filesudo.run -silent -driver
这时候需要按照上面说的,把一下内容加入到PATH。
– PATH includes /usr/local/cuda-10.1/bin
– LD_LIBRARY_PATH includes /usr/local/cuda-10.1/lib64
下面我们打开~/.bashrc
sudo gedit ~/.bashrc
在最后加入:
export PATH=/usr/local/cuda-10.1/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda/lib64:$LD_LIBRARY_PATH
然后在命令行输入以下内容立即生效:
source ~/.bashrc
现在我们来验证一下是否安装完成:
cd /usr/local/cuda-10.1/samples/1_Utilities/deviceQuery
sudo make
./deviceQuery
出现一大堆废话不用管,最后有result=pass即为成功。
- 安装cudnn
依旧打开现在文件夹,并打开命令行,在命令行中输入,
sudo dpkg -i libcudnn7_7.6.5.32-1+cuda10.1_amd64.deb
等待就好,没有报错即可继续。
最后
以上就是背后玫瑰为你收集整理的Ubuntu 18.04新系统安装cuda/cudnn的全部内容,希望文章能够帮你解决Ubuntu 18.04新系统安装cuda/cudnn所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
发表评论 取消回复