在Mint-ubuntu下安装CUDA


关注九天学者微信公众号(扫码关注)第一时间获取技术贴更新!


2018年1月底,被德国导师派到洛桑大学的Yury研究组学习HPC-CUDA课程一个星期。回来决定把自己的Thinkpad重新利用起来,安装CUDA进行动力学模拟测试。我的安装实在Mint刚安装上没有进行任何操作的前提下进行的。

Pre-install

  • Verify you have a CUDA-Capable GPU
    $ lspci | grep -i nvidia

  • Verify you have a Supported Version of Linux
    uname -m && cat /etc/*release

  • gcc version
    gcc --version

  • kernal
    uname -r

  • install tool kits for kernal

  • sudo apt-get install linux-headers-$(uname -r)

Download the NVIDIA CUDA Toolkit

Donload (runfile(local)) .runversion
[图片上传失败...(image-608c77-1540036446704)]

Install

Disable Nouveau

  • check :lsmod | grep nouveau if nothing print out, it means nouveau is disabled. Otherwise,
  • disable:sudo vi /etc/modprobe.d/blacklist-nouveau.confadd the following command
blacklist nouveau
options nouveau modeset=0

quit&save

  • active: sudo update-initramfs –u
    if it gives the following warning, you need to make some settings

update-initramfs: Generating /boot/initrd.img-3.13.0-24-generic
Warning: No support for locale: en_US.UTF-8

run : sudo locale-gen --purge --no-archive
then :sudo update-initramfs -u -t

  • check again :lsmod | grep nouveau

reboot

sudo reboot

text mode

use key ctrl+alt+F1 into text mode and login with your username and password.

close graphic interface

sudo service lightdm stop

run .run file to install CUDA

sudo bash cuda_9.1.85_387.26_linux.run
first accept licences, and then type y or enter to the next steps, but for OpenGL selection, you'd better type n. If install successfully, it will display word of installed

reboot again

sudo reboot

open graphic interface

sudo service lightdm start

add PATH

export PATH=/usr/local/cuda-9.0/bin:$PATH
export LD_LIBRARY_PATH=/usr/local/cuda-9.0/lib64:$LD_LIBRARY_PATH

屏幕分辨率问题

如果出现屏幕分辨率很低的情况,请按照下面的命令操作即可恢复。注销进入登录界面,按ctrl+alt+F1进入命令行终端,输入账户名和密码后,输入如下命令。

sudo mv /etc/X11/xorg.conf /etc/X11/xorg.conf.backup
sudo touch /etc/X11/xorg.conf

重新启动
登录进入ubuntu主界面如果分辨率还没有改变,桌面右上角设置->系统设置->显示->分辨率。此刻可以发现分辨率选项增多选一个分辨率最高的选项点击应用即可。

Reference

Ubuntu 14.04安装CUDA-8.0
ubuntu16.04 安装cuda8.0后,屏幕分辨率过低且不可调节
ref2


关注九天学者微信公众号(扫码关注)第一时间获取技术贴更新!


上一篇:学位论文写作的正确打开方式:程序员的理性与倔强


下一篇:云·企业官网定制——网站建设篇之——阿里云心选商城