cuda、cudnn、驱动版本查看及nvidia驱动、cuda安装及卸载

  • 查看cuda 版本
    cat /usr/local/cuda/version.txt

  • 查看cudnn 版本
    cat /usr/local/cuda/include/cudnn.h | grep CUDNN_MAJOR -A 2

  • 查看显卡驱动版本
    cat /proc/driver/nvidia/version
    或输入nvidia-smi

  • cuda安装
    1.驱动安装完成后,下载cuda安装包(https://developer.nvidia.com/cuda-toolkit-archive)
    2.sudo ./cuda_8.0.61_375.26_linux.run
    3.一直按ctrl+F,直到100%
    4.其它的按部就班,但选择不安装驱动
    5.出现***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时,不用管它,此时只要安装的驱动版本更高比它更高即可
    6.将cuda添加到环境变量,在~/.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}}
    7.在NVIDIA_CUDA-8.0_Samples中编译相关samples,能编译通过则说明安装成功

  • nvidia驱动安装
    sudo apt-get purge nvidia*
    sudo add-apt-repository ppa:graphics-drivers/ppa
    sudo apt-get update
    sudo apt-get install nvidia-384 nvidia-settings
    reboot
    注:如果要是不行,可能需要在bios里将显卡先设置成CPU集卡
    验证
    1.输入nvidia-smi查看
    2.prime-select query查看当前选用的显卡

  • cuda卸载
    cd /usr/local/cuda/bin
    sudo ./uninstall_cuda_8.0.pl
    cd /usr/local
    sudo rm -rf cuda-8.0

  • cudnn安装
    参考:https://docs.nvidia.com/deeplearning/sdk/cudnn-install/index.html

  1. Installing from a Tar File

    Navigate to your directory containing the cuDNN Tar file.
    Unzip the cuDNN package.

    $ tar -xzvf cudnn-9.0-linux-x64-v7.tgz

    Copy the following files into the CUDA Toolkit directory, and change the file permissions.

    $ 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 /usr/local/cuda/lib64/libcudnn*

  2. Installing from a Debian File

    Navigate to your directory containing cuDNN Debian file.
    Install the runtime library, for example:

    sudo dpkg -i libcudnn7_7.0.3.11-1+cuda9.0_amd64.deb

    Install the developer library, for example:

    sudo dpkg -i libcudnn7-devel_7.0.3.11-1+cuda9.0_amd64.deb

    Install the code samples and the cuDNN Library User Guide, for example:

    sudo dpkg -i libcudnn7-doc_7.0.3.11-1+cuda9.0_amd64.deb

你可能感兴趣的:(深度学习,linux)