美文网首页
Ubuntu18.04 install cuda

Ubuntu18.04 install cuda

作者: 陈定邦 | 来源:发表于2018-11-04 21:54 被阅读0次
    tags: gcc version

    1. change your gcc version, in the ubuntu18.04, the gcc version is 7.3.0, but cuda can't support it now, so we will change it

    sudo apt install gcc-5 g++-5

    after that we use update-alternatives to manage gcc version

    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 50 --slave /usr/bin/g++ g++ /usr/bin/g++-5
    sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-7 70 --slave /usr/bin/g++ g++ /usr/bin/g++-7
    sudo update-alternatives --config gcc

    image

    you can use this conmmand to show all package version

    update-alternatives --list [package name]

    tags: add PPA

    2. add the PPA (Personal Package Archive) repository

    sudo add-apt-repository ppa:graphics-drivers/ppa

    check the recommended graphic driver

    ubuntu-driver devices

    then you will see like this

    image

    if you already install the graphic driver, then you can use "nvidia-smi" to see the graphic usage situation

    image
    tags: download cuda (this version is 9.1) && install it

    3. this case use the cuda_9.1.85_387.26_linux.run, you can download this run file by the link below

    https://developer.nvidia.com/cuda-91-download-archive?target_os=Linux&target_arch=x86_64&target_distro=Ubuntu&target_version=1704&target_type=runfilelocal

    then you can use sh commend to executing it

    sudo sh XXX.run

    pay attention, you musk reject installing the graphic driver!!!

    after that add the path to the .bashrc

    echo "export PATH=/usr/local/cuda-9.1/bin:$PATH" >> ~/.bashrc
    echo 'export LD_LIBRARY_PATH=/usr/local/cuda-9.1/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
    source ~/.bashrc
    

    英文很垃圾请见谅

    相关文章

      网友评论

          本文标题:Ubuntu18.04 install cuda

          本文链接:https://www.haomeiwen.com/subject/rewdxqtx.html