• ubuntu16.04 NVIDIA CUDA8.0 以及cuDNN安装


    下载CUDA

    官网下载 按照自己的实际情况进行选择,下载合适的版本。

    官方安装指南

    注意这里下载的是cuda8.0的runfile(local)文件。 

    安装CUDA

    下载完成后,解压到当前目录,切换到该目录输入:

      sh cuda_8.0.44_linux.run –override //_8.0.44是本文采用的版本,安装时根据实际调整。

    初始化安装

    初始安装是,出现很多选择的选项,直接Ctrl+C,之后的选项参考如下:

    Do you accept the previously read EULA?
    accept/decline/quit: accept
    Install NVIDIA Accelerated Graphics Driver for Linux-x86_64
    361.62?
    (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 ]:

    输入accept接受条款

    输入n不安装nvidia图像驱动,之前已经安装过了

    输入y安装cuda 8.0工具

    回车确认cuda默认安装路径:/usr/local/cuda-8.0

    输入y用sudo权限运行安装,输入密码

    输入y或者n安装或者不安装指向/usr/local/cuda的符号链接

    输入y安装CUDA 8.0 Samples,以便后面测试

    回车确认CUDA 8.0 Samples默认安装路径。

    安装过程

    Installing the CUDA Toolkit in /usr/local/cuda-8.0 ...
    Missing recommended library: libGLU.so
    Missing recommended library: libX11.so
    Missing recommended library: libXi.so
    Missing recommended library: libXmu.so
    Installing the CUDA Samples in /home/zhou ...
    Copying samples to /home/zhou/NVIDIA_CUDA-8.0_Samples now...
    Finished copying samples.
    ===========
    = Summary =
    ===========
    Driver: Not Selected
    Toolkit: Installed in /usr/local/cuda-8.0
    Samples: Installed in /home/zhou, but missing recommended
    libraries
    Please make sure that
    - PATH includes /usr/local/cuda-8.0/bin
    - LD_LIBRARY_PATH includes /usr/local/cuda-8.0/lib64, or, add
    /usr/local/cuda-8.0/lib64 to /etc/ld.so.conf and run ldconfig as
    root
    To uninstall the CUDA Toolkit, run the uninstall script in
    /usr/local/cuda-8.0/bin
    Please see CUDA_Installation_Guide_Linux.pdf in
    /usr/local/cuda-8.0/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 361.00 is
    required for CUDA 8.0 functionality to work.
    To install the driver using this installer, run the following
    command, replacing with the name of this run file:
    sudo .run -silent -driver
    Logfile is /tmp/cuda_install_2961.log

    添加环境路径

    安装完毕后,再声明一下环境变量,并将其写入到 ~/.bashrc 的尾部:

    sudo gedit ~/.bashrc

    尾部添加:

    export PATH=/usr/local/cuda-8.0/bin${PATH:+:${PATH}}
    export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64${LD_LIBRARY_PATH:+:${LD_LIBRARY_PATH}}

    然后设置环境变量和动态链接库,在命令行输入:

    sudo gedit /etc/profile

    在打开的文件末尾加入:

    export PATH=/usr/local/cuda/bin:$PATH

    保存之后,创建链接文件:

    sudo gedit /etc/ld.so.conf.d/cuda.conf

    在打开的文件中添加如下语句:

    /usr/local/cuda/lib64

    然后执行:

    sudo ldconfig

    使链接立即生效。

    测试

    cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery  
    make -j4  
    sudo ./deviceQuery  

    若会输出相应的显卡性能信息,表明cuda安装成功。

    cuDNN安装

    下载cuDNN,解压。

    tar -zxvf cudnn-8.0-linux-x64-v7.tgz

     得到一个cuda文件夹,进入之后会有include文件夹和lib64文件夹

    执行下列命令:

    sudo cp cuda/include/cudnn.h /usr/local/cuda/include/
    sudo cp cuda/lib64/libcudnn* /usr/local/cuda/lib64/
    sudo chmod a+r /usr/local/cuda/include/cudnn.h
    sudo chmod a+r /usr/local/cuda/lib64/libcudnn*

     

    作者:Young
    联系:chayliu@126.com
    签名:天道酬勤 厚积薄发

    ---------------------------------------------------------

  • 相关阅读:
    stat命令的实现-mysate 2075310
    实现mypwd
    2019-2020-1 20175310 20175317 20175320 实验五 通讯协议设计
    2019-2020-1 20175310 20175317 20175320 实验四 外设驱动程序设计
    课上测试
    2019-2020-1 20175310 《信息安全系统设计基础》第九周学习总结
    2019-2020-1 20175310 20175317 20175320 实验三 实时系统
    2019-2020-1 20175310 20175317 20175320 实验二 固件程序设计
    2019-2020-1 20175310 20175317 20175320 实验一 开发环境的熟悉
    2019-2020-1 20175310 《信息安全系统设计基础》第6周学习总结
  • 原文地址:https://www.cnblogs.com/chay/p/8038251.html
Copyright © 2020-2023  润新知