ubuntu 18.04安装cuda驱动
参考 https://www.pugetsystems.com/labs/hpc/How-to-install-CUDA-9-2
-on-Ubuntu-18-04-1184/
下载Ubuntu18.04 desktop, 制作USB启动,安装
在Software & Updates"中检查 nvidia驱动,必须是396版
如果驱动的版本号不对:
apt purge nvidia*
add-apt-repository ppa:graphics-drivers/ppa
sudo apt install nvidia-kernel-source-396
sudo apt install nvidia-driver-396
重启电脑-
sudo apt-get install freeglut3 freeglut3-dev libxi-dev libxmu-dev
4.下载17.10的CUDA "run" file installer 然后安装sudo sh cuda_9.2.88_396.26_linux.run
You are attempting to install on an unsupported configuration. Do you wish to continue?
(y)es/(n)o [ default is no ]: yInstall NVIDIA Accelerated Graphics Driver for Linux-x86_64 396.26? (y)es/(n)o/(q)uit: n !!!!!!!!!重要!!!!!! Install the CUDA 9.2 Toolkit? (y)es/(n)o/(q)uit: y Enter Toolkit Location [ default is /usr/local/cuda-9.2 ]:
Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: yInstall the CUDA 9.2 Samples?
(y)es/(n)o/(q)uit: yEnter CUDA Samples Location
[ default is /home/kinghorn ]: /usr/local/cuda-9.2 Install the cuBLAS patch
wget https://developer.nvidia.com/compute/cuda/9.2/Prod/patches/1/cuda_9.2.88.1_linux
sudo chmod +x cuda_9.2.88.1_linux.run
sudo ./cuda_9.2.88.1_linux.run --silent --accept-eula-
Setup your environment variables
To configure the CUDA environment for all users (and applications) on your system create the file (use sudo and a text editor of your choice)
/etc/profile.d/cuda.sh
with the following content,
export PATH=$PATH:/usr/local/cuda/bin
export CUDADIR=/usr/local/cudaAlso create the file, /etc/ld.so.conf.d/cuda.conf
and add the line, /usr/local/cuda/lib64
Then run: sudo ldconfig
7 重启电脑
- Test CUDA by building the "samples"
编译和运行测试代码 - 安装和运行pytorch, gpu 运行
import torch
torch.cuda.current_device()
In [3]: torch.cuda.device(0)
In [4]: torch.cuda.device_count()
In [5]: torch.cuda.get_device_name(0)
推荐阅读
-
Ubuntu18.04 安装mysql8.0.11的图文教程
-
Ubuntu 18.04下mysql 8.0 安装配置方法图文教程
-
linux系统ubuntu18.04安装mysql 5.7
-
在ubuntu下查看显卡驱动是否已经成功安装的方法
-
记录:Ubuntu 18.04 安装 tensorflow-gpu 版本
-
Ubuntu18.04+cuda10.1+python3.7下配置pytorch0.4.0步骤
-
linux系统ubuntu18.04安装mysql(5.7)
-
Linux (Ubuntu 18.04) 下安装vim编辑器的方法
-
Ubuntu18.04直接安装python3.7或者升级自带的python3.6版本之后导致终端无法打开的解决办法
-
在ubuntu18.04版本安装vscode(2种)