美文网首页
安装 CUDA、cuDNN

安装 CUDA、cuDNN

作者: iVikings | 来源:发表于2024-01-17 13:26 被阅读0次

    卸载 CUDA

    cd /usr/local/cuda-11.8/bin
    
    sudo ./cuda-uninstaller
    
    cd /usr/local
    
    sudo rm -rf cuda-11.8
    

    下载 CUDA

    https://developer.nvidia.com/cuda-toolkit-archive
    https://developer.nvidia.com/cuda-11-8-0-download-archive

    CentOS8-cuda_11.8.png Ubuntu-22.04-cuda_12.2.png

    更新 CUDA

    sudo sh ./cuda_11.8.0_520.61.05_linux.run --toolkit --silent --override
    

    修改环境变量

    vim ~/.bashrc
    
    # 或 sudo gedit ~/.bashrc
    
    export PATH=/usr/local/cuda-11.8/bin:$PATH
    export LD_LIBRARY_PATH=/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH
    
    # centos
    export PATH=$PATH:/opt/xxx/ffmpeg-6.1-amd64-static/
    # export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/usr/local/cuda-11.8/lib64
    export PATH=$PATH:/usr/local/cuda-11.8/bin
    export CUDA_HOME=/usr/local/cuda-11.8
    
    source ~/.bashrc
    

    检验

    nvcc -V
    

    安装 cuDNN

    • 下载 cuDNN
    https://developer.nvidia.com/rdp/cudnn-archive
    
    cuDNN.png
    • 解压
    tar -xvf cudnn-linux-x86_64-8.9.6.50_cuda11-archive.tar.xz
    
    cd cudnn-linux-x86_64-8.9.6.50_cuda11-archive
    
    ls
    include  lib  LICENSE
    
    • 将 cuDNN 对应文件拷贝到 CUDA 对应路径
    sudo cp include/cudnn*.h /usr/local/cuda-11.8/include
    sudo cp lib/libcudnn* /usr/local/cuda-11.8/lib64
    sudo chmod a+r /usr/local/cuda-11.8/include/cudnn*.h /usr/local/cuda-11.8/lib64/libcudnn*
    
    • 检测 cuDNN
    cat /usr/local/cuda/include/cudnn_version.h | grep CUDNN_MAJOR -A 2
    

    相关文章

      网友评论

          本文标题:安装 CUDA、cuDNN

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