Install nvidia driver,CUDA

Install NVIDIA driver

lspci | grep VGA # 查看集成显卡
lspci | grep NVIDIA # 查看NVIDIA显卡

  • 卸载原有驱动
    sudo apt-get remove –purge nvidia*

  • bios禁用禁用secure boot,也就是设置为disable

  • 禁用nouveau
    sudo vim /etc/modprobe.d/blacklist.conf
    在最后一行添加:blacklist nouveau
    sudo update-initramfs -u
    reboot
    lsmod | grep nouveau # 没输出代表禁用生效

  • 停止可视化桌面:
    sudo telinit 3
    service lightdm stop

  • sudo chmod a+x NVIDIA-Linux-x86_64-390.48.run

  • sudo sh ./NVIDIA-Linux-x86_64-390.48.run --no-opengl-files

  • download URL: https://www.nvidia.com/Download/index.aspx?lang=en-us

  • cd yourdirectory

  • sudo bash NVIDIA-Linux-x86_64-430.50.run

  • other command:

nvidia-setting
nvidia-smi

lspci | grep VGA # 查看集成显卡
lspci | grep NVIDIA # 查看NVIDIA显卡

查看nouveau是否启动运行可以执行下面命令:
lsmod | grep nouveau
没有返回代表没有运行。

NVIDIA提供了一个切换显卡的命令:
sudo prime-select nvidia # 切换nvidia显卡
sudo prime-select intel # 切换intel显卡
sudo prime-select query # 查看当前使用的显卡

Install CUDA

  • download CUDA
  • Run sudo bash cuda_9.0.176_384.81_linux.run , Follow the command-line prompts
  • log:
Do you accept the previously read EULA?
accept/decline/quit: accept

Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 384.81?
(y)es/(n)o/(q)uit: n

Install the CUDA 9.0 Toolkit?
(y)es/(n)o/(q)uit: y

Enter Toolkit Location
[ default is /usr/local/cuda-9.0 ]: /remote-home/zhengsixiao/cuda

Do you want to install a symbolic link at /usr/local/cuda?
(y)es/(n)o/(q)uit: n

Install the CUDA 9.0 Samples?
(y)es/(n)o/(q)uit: n

Installing the CUDA Toolkit in /remote-home/zhengsixiao/cuda ...

===========
= Summary =
===========

Driver:   Not Selected
Toolkit:  Installed in /remote-home/zhengsixiao/cuda
Samples:  Not Selected

Please make sure that
-   PATH includes /remote-home/zhengsixiao/cuda/bin
-   LD_LIBRARY_PATH includes /remote-home/zhengsixiao/cuda/lib64, or, add /remote-home/zhengsixiao/cuda/lib64 to /etc/ld.so.conf and run ldconfig as root

To uninstall the CUDA Toolkit, run the uninstall script in /remote-home/zhengsixiao/cuda/bin

Please see CUDA_Installation_Guide_Linux.pdf in /remote-home/zhengsixiao/cuda/doc/pdf for detailed information on setting up CUDA.
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容