博主装Ubuntu18.04主要是为了用于跑深度学习,所以我们先来搞搞gcc环境

第一步:安装多版本gcc、g++可切换

sudo apt-get install gcc-4.8 gcc-4.8-multilib
sudo apt-get install g++-4.8 g++-4.8-multilib
sudo apt-get install gcc- gcc--multilib
sudo apt-get install g++- g++--multilib
sudo apt-get install gcc- gcc--multilib
sudo apt-get install g++- g++--multilib
sudo apt-get install gcc- gcc--multilib
sudo apt-get install g++- g++--multilib
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.8
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-

  切换版本命令

sudo update-alternatives --config gcc
sudo update-alternatives --config g++

  根据自己想要的环境选择

第二步:准备安装显卡驱动和cuda8.0等相关文件

  最新cuda8.0 及其补丁
  cuda_8.0.61.2_linux.run 
  cuda_8.0.61_375.26_linux.run
  最新支持cuda8.0的CUDNN
  libcudnn7_7.1.4.18-1+cuda8.0_amd64.deb
  libcudnn7-dev_7.1.4.18-1+cuda8.0_amd64.deb
  libcudnn7-doc_7.1.4.18-1+cuda8.0_amd64.deb
  cuda8.0 安装包解压文件
  /001/InstallUtils.pm(从cuda_8.0.61.2_linux.run中解压出来的文件,后面会讲到)
第三步:安装显卡驱动
  • 1、开机 nomodeset 进入系统
    • 开机进引导界面 第一项 按e 进入配置启动
    • 在quiet splash - - -后加上 nomodeset
    • 按F10 保存 进入系统
quiet splash - - -
quiet splash nomodeset
  • 2、禁用系统自带NVIDIA驱动
sudo vim /etc/modprobe.d/blacklist.conf
# 在文件尾加入
blacklist nouveau
options nouveau modeset=
# 保存并退出 执行下面命令 更新引导
sudo update-initramfs –u
  • 3、安装 NVIDIA 驱动
# 切换gcc 版本 到gcc- 以上 (使用高版本感觉会好一点)
# 查看支持的驱动版本
ubuntu-drivers devices
# 安装驱动
sudo ubuntu-drivers autoinstall
# 根据查询的版本安装比较保险 例如
sudo apt-get install nvidia-driver-
# 装驱动 需要关闭 安全启动
  • 5、重启系统
sudo reboot
# 查看NVIDIA驱动 使用情况
nvidia-smi
  • 6、安装cuda8.0

    • 安装依赖
  • sudo apt-get install freeglut3-dev build-essential libx11-dev libxmu-dev libxi-dev libgl1-mesa-glx libglu1-mesa libglu1-mesa-dev
    • 切换gcc版本到 4.8
  • sudo update-alternatives --config gcc
    • 解压cuda8.0
  • sh cuda_8..61_375.26_linux.run --noexec --target
    # 将runfile文件解压并且放到001文件夹中
    # 将InstalUtil.pm 拷贝到 /etc/perl/
    sudo cp InstalUtil.pm /etc/perl/
    • 安装cuda8.0及补丁
  • # 可选 加运行权限
    chmod u+x cuda_8..61_375.26_linux.run
    chmod u+x cuda_8.0.61.2_linux.run
    # 运行
    sudo ./chmod u+x cuda_8..61_375.26_linux.run Do you accept the previously read EULA?
    accept/decline/quit: accept You are attempting to install on an unsupported configuration. Do you wish to continue?
    (y)es/(n)o [ default is no ]: y Install NVIDIA Accelerated Graphics Driver for Linux-x86_64 375.26?
    (y)es/(n)o/(q)uit: n Install the CUDA 8.0 Toolkit?
    (y)es/(n)o/(q)uit: y Enter Toolkit Location
    [ default is /usr/local/cuda-8.0 ]: Do you want to install a symbolic link at /usr/local/cuda?
    (y)es/(n)o/(q)uit: y Install the CUDA 8.0 Samples?
    (y)es/(n)o/(q)uit: y Enter CUDA Samples Location
    [ default is /home/deep ]: # 安装补丁
    sudo ./cuda_8.0.61.2_linux.run
    • 添加环境变量
  • cd
    vim .bashrc
    # 添加到文件尾部
    export PATH=/usr/local/cuda-8.0/bin:$PATH
    export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64$LD_LIBRARY_PATH
    # 保存 退出
    sudo su
    source .bashrc
    • 重启系统
  • sudo reboot
    • 安装cudnn
  • sudo dpkg -i libcudnn7_7.1.4.-+cuda8.0_amd64.deb
    sudo dpkg -i libcudnn7-dev_7.1.4.-+cuda8.0_amd64.deb
    sudo dpkg -i libcudnn7-doc_7.1.4.-+cuda8.0_amd64.deb
    • 查看cuda版本和cudnn版本
  • # cuda 版本
    cat /usr/local/cuda/version.txt
    # cudnn 版本
    cat /usr/include/x86_64-linux-gnu/cudnn_v7.h | grep CUDNN_MAJOR -A
    • 编译
  • # 不用编译全部 只编译deviceQuery
    cd /home/deep/NVIDIA_CUDA-.0_Samples/1_Utilities/deviceQuery
    make
    • 测试
  • ./deviceQuery
    
    # 出现显卡信息
    ./deviceQuery Starting... CUDA Device Query (Runtime API) version (CUDART static linking) Detected CUDA Capable device(s) Device : "GeForce GTX 1080"
    CUDA Driver Version / Runtime Version 9.1 / 8.0
    CUDA Capability Major/Minor version number: 6.1
    Total amount of global memory: MBytes ( bytes)
    () Multiprocessors, () CUDA Cores/MP: CUDA Cores
    GPU Max Clock rate: MHz (1.73 GHz)
    Memory Clock rate: Mhz
    Memory Bus Width: -bit
    L2 Cache Size: bytes
    Maximum Texture Dimension Size (x,y,z) 1D=(), 2D=(, ), 3D=(, , )
    Maximum Layered 1D Texture Size, (num) layers 1D=(), layers
    Maximum Layered 2D Texture Size, (num) layers 2D=(, ), layers
    Total amount of constant memory: bytes
    Total amount of shared memory per block: bytes
    Total number of registers available per block:
    Warp size:
    Maximum number of threads per multiprocessor:
    Maximum number of threads per block:
    Max dimension size of a thread block (x,y,z): (, , )
    Max dimension size of a grid size (x,y,z): (, , )
    Maximum memory pitch: bytes
    Texture alignment: bytes
    Concurrent copy and kernel execution: Yes with copy engine(s)
    Run time limit on kernels: Yes
    Integrated GPU sharing Host Memory: No
    Support host page-locked memory mapping: Yes
    Alignment requirement for Surfaces: Yes
    Device has ECC support: Disabled
    Device supports Unified Addressing (UVA): Yes
    Device PCI Domain ID / Bus ID / location ID: / /
    Compute Mode:
    < Default (multiple host threads can use ::cudaSetDevice() with device simultaneously) > deviceQuery, CUDA Driver = CUDART, CUDA Driver Version = 9.1, CUDA Runtime Version = 8.0, NumDevs = , Device0 = GeForce GTX
    Result = PASS

如果出现相应的显卡信息表示安装成功了。

 

Ubuntu18.04安装完应该做的一些事 显卡驱动安装和cuda8.0的更多相关文章

  1. Ubuntu18.04 NVIDIA显卡驱动 安装大全

    离线安装NVIDIA显卡驱动 费了一天的劲,走了好多的坑,最主要的原因是gcc版本的问题,一定要用最新版本的gcc!!! 1)官网下载显卡驱动 2)apt 下载gcc包及其依赖包,可用apt-cach ...

  2. Ubuntu18.04 显卡驱动安装(解决各种疑难杂症)

    步骤 下载驱动 准备工作 进行安装 检查安装 下载驱动 首先我们需要去官网下载显卡驱动 打开浏览器,在百度搜索框中搜索:显卡驱动 下载 在手动搜索驱动程序一栏,根据自己的显卡进行选择 产品系列中,No ...

  3. ubuntu环境下,ubuntu16.04装机到nvdia显卡驱动安装、cuda8安装、cudnn安装

    首先是安装ubuntu16.04 A.制作u盘启动盘(提前准备好.ios文件): 1.安装u盘制作工具unetbootinsudo apt-get install unetbootin2.格式化u盘s ...

  4. ubuntu显卡驱动安装及设置

    转自: Ubuntu 14.04 Nvidia显卡驱动安装及设置   更换主板修复grub 引导后,无法从Nvidia进入系统(光标闪烁), 可能是显卡驱动出了问题. 1. 进入BIOS设置, 从集成 ...

  5. Ubuntu Intel显卡驱动安装 (Ubuntu 14.04--Ubuntu 16.10 + Intel® Graphics Update Tool)

    最近使用在使用Ubuntu时,发现大部分情况下,不安装显卡驱动,使用默认驱动,都是没有问题的,但对于一些比较奇特配置的电脑,如下所示,如果使用默认驱动,会时常莫名其妙死机crash,尤其是在使用Ope ...

  6. archlinux-小米pro15_2020款使用archlinux(MX350显卡驱动安装)

    1.官网下载archlinux ISO镜像 https://archlinux.org/download/   使用磁力链接下载 2.使用软碟通将镜像写入U盘,制作成U盘启动盘 3.进入BIOS 关掉 ...

  7. GIT安装完需要做以下配置

    安装完GIT后需要做以下配置: 一.找到git的安装目录,查找etc目录下的gitconfig配置文件,编辑此文件在最后一行添加如下内容: [gui]     encoding = utf-8 [sv ...

  8. ubuntu14.04安装、NVIDIA显卡驱动安装及CUDA8.0、Cudnn5.1的环境搭建

    安装环境:hp-Z440工作站.64位Ubuntu14.04(64位Ubuntu16.04).Cuda8.0.Cudnn5.1.Nvidia GeForce GT 705.Tesla K40c 本文可 ...

  9. 联想Y7000安装Ubuntu16.04/Win10双系统,wifi问题,显卡驱动和CUDA10安装

    https://blog.csdn.net/la9881275/article/details/86720752 Ubuntu16.04系统安装拿到Ubuntu镜像制作装机优盘,这里就不写了.我的优盘 ...

随机推荐

  1. ArcEngnine中IHookHelper的用法

    一.IHookHelper 主要在用在自定义类型于AE带的的ICommand或ITool等 1.实例化IHookHelper 对象:IHookHelper m_hookHelper = new Hoo ...

  2. Android网络通信库Volley简介(转)

    以前反编译过android market,发现里面有用到volley,起这么个名字不知道啥用的,现在才知道主讲者Ficus Kirkpatrick 就是负责开发Google play 的. 看完视频, ...

  3. 微信jssdk 返回的 config invalid signature

    这几天一直在调试wxjssdk,按照api的需求,http://mp.weixin.qq.com/wiki/7/aaa137b55fb2e0456bf8dd9148dd613f.html ,先是根据a ...

  4. Nancy使用Razor视图引擎时,提示对C:\Windows\temp 没有权限访问的问题

    Nancy下使用Razor视图需要添加DLL文件引用,通过Nuget安装: 发布网站,在IIS上建立站点后,提示错误:对C:\Windows\temp\XXXX 的访问被拒绝(在VS里F5调试的时候没 ...

  5. angular attrs.$observe和$scope.$watch的区别

    http://stackoverflow.com/questions/14876112/difference-between-the-observe-and-watch-methods https:/ ...

  6. javaEE版本的eclipse中导入工程,发现server里面找不到工程,根本发布不了也不能运行

    原文:http://www.cnblogs.com/sxmcACM/p/3674545.html 1.具体解决方法 首先确保,你导入的工程所用的JDK版本和你的机器上安装的版本是同一版本, 如果不同做 ...

  7. $.on()方法和addEventListener改变this指向

    jQuery $.on()方法和addEventListener改变this指向 标签(空格分隔): jQuery JavaScript jQuery $.on() jq的绑定事件使用$([selec ...

  8. Oracle修改表名的几种方式

    因为原来所在表不想被删除,但又需要新建立一个相同表名的表,故先把原来的表的表名更改为另一个临时表名. 查看当前用户下所有的表  select tname from tab where tabtype= ...

  9. css笔记 2

    定义一个类选择器.center {text-align: center} h1 有 center 类.这意味将遵守 ".center" 选择器中的规则.<h1 class=& ...

  10. June 18th 2017 Week 25th Sunday

    Life was like a box of chocolates, you never know what you're gonna get. 人生就像一盒巧克力,结果往往出人意料. Compare ...