当前位置:   article > 正文

Redhat8 安装 cuda11.8 + cudnn 8.6 + trt8.5.3 保姆级教程_redhat安装cudnn

redhat安装cudnn

在这里插入图片描述

详细记录 redhat 8 系统, 从 0 -1 安装 Cuda, Cudnn , Tensorrt 全部过程。

Driver

  1. 我安装的是 NVIDIA-Linux-x86_64-525.89.02.run
  2. 安装步骤自行百度下,这个我大哥做系统时候给我安装完事了。
  3. 安装驱动时候 一定选支持11.8的驱动,使用 nividia-smi 查询一下。
    在这里插入图片描述

Cuda 11.8

  1. 下载地址: https://developer.nvidia.com/cuda-11.1.0-download-archive?target_os=Linux&target_arch=x86_64&target_distro=RHEL&target_version=7&target_type=rpmlocal
  2. install
    # 不选 driver 和 nvidia-fs
    sudo sh ./cuda_11.8.0_520.61.05_linux.run
    
    • 1
    • 2
  3. 配环境变量
    sudo vim ~/.bashrc
    export PATH="/usr/local/cuda-11.8/bin:$PATH"
    export LD_LIBRARY_PATH="/usr/local/cuda-11.8/lib64:$LD_LIBRARY_PATH"
    source ~/.bashrc
    
    • 1
    • 2
    • 3
    • 4
  4. 验证
    nvcc -V
    cd /usr/local/cuda-11.8/samples/1_Utilities/deviceQuery
    sudo make
    ./deviceQuery
    
    cd ../bandwidthTest
    sudo make
    ./bandwidthTest
       
    # 如果这两个测试的最后结果都是Result = PASS,说明CUDA安装成功.
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
  5. 后悔药
    # uninstall cuda
    sudo /usr/local/cuda-11.8/bin/cuda-uninstaller
    # uninstall nvidia driver
    #sudo /usr/bin/nvidia-uninstall
    
    • 1
    • 2
    • 3
    • 4

Cudnn 8.6

  1. 参考: https://docs.nvidia.com/deeplearning/cudnn/install-guide/index.html#installcuda

  2. 安装

    sudo rpm -i cudnn-local-repo-rhel8-8.6.0.163-1.0-1.x86_64.rpm
    # Refresh the repository metadata.
    sudo yum clean all
    # Install the runtime library.
    sudo yum install libcudnn8-8.6.0.163-1.cuda11.8 -y
    sudo yum install libcudnn8-devel-8.6.0.163-1.cuda11.8 -y
    sudo yum install libcudnn8-samples-8.6.0.163-1.cuda11.8 -y
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
  3. 不出意外会出现如下错误

      Problem: conflicting requests
       - nothing provides libcublas.so.11()(64bit) needed by libcudnn8-8.6.0.163-1.cuda11.8.x86_64
       - nothing provides libcublasLt.so.11()(64bit) needed by libcudnn8-8.6.0.163-1.cuda11.8.x86_64
    
    • 1
    • 2
    • 3
  4. 下载先关依赖rpm ,如果还出现什么依赖库问题,去下载相应rpm,应该都能解决.
    1. https://rhel.pkgs.org/ , 搜索 cuda-toolkit-config-common-11.8.89-1.noarch.rpm cuda-toolkit-11-config-common-11.8.89-1.noarch.rpm cuda-toolkit-11-8-config-common-11.8.89-1.noarch.rpm libcublas-11-8-11.11.3.6-1.x86_64.rpm libcublas-devel-11-8-11.11.3.6-1.x86_64.rpm
    2. https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/ , 搜索 cuda-cudart-devel-11-8-11.8.89-1.x86_64.rpm

    # install
    sudo yum install cuda-toolkit-config-common-11.8.89-1.noarch.rpm -y 
    sudo yum install cuda-toolkit-11-config-common-11.8.89-1.noarch.rpm -y 
    sudo yum install cuda-toolkit-11-8-config-common-11.8.89-1.noarch.rpm -y 
    sudo yum install libcublas-11-8-11.11.3.6-1.x86_64.rpm -y 
    sudo yum install libcublas-devel-11-8-11.11.3.6-1.x86_64.rpm -y 
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  5. 验证

    cd /usr/src/cudnn_samples_v8/mnistCUDNN
    make clean && make
    ./mnistCUDNN
    Test passed!
    
    • 1
    • 2
    • 3
    • 4
  6. 不出意外还会出现错误,fatal error: FreeImage.h: No such file or directory. 按照网上的办法都是安装 freeimagefreeimage-devel, 但我安装会出现 not match… 错误, 所以还是老套路,本地下载包安装。

    wget https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/j/jxrlib-1.1-1.el8.x86_64.rpm
    sudo yum install jxrlib-1.1-1.el8.x86_64.rpm
    wget https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/f/freeimage-3.17.0-5.el8.x86_64.rpm
    sudo yum install freeimage
    wget https://download-ib01.fedoraproject.org/pub/epel/8/Everything/x86_64/Packages/f/freeimage-devel-3.17.0-5.el8.x86_64.rpm
    sudo yum install freeimage-devel
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
  7. 后悔药

    sudo yum erase "cudnn-local-repo*" -y
    sudo yum erase "libcudnn*"
    
    • 1
    • 2

Tensorrt

  1. 安装 https://docs.nvidia.com/deeplearning/tensorrt/install-guide/index.html#installing

    os="rhelx"
    tag="cudax.x-trt8.x.x.x-ga-yyyymmdd"
    sudo rpm -Uvh nv-tensorrt-repo-${os}-${tag}-1-1.x86_64.rpm
    sudo yum clean expire-cache
    sudo yum install tensorrt
    
    • 1
    • 2
    • 3
    • 4
    • 5
  2. 按照官方教程安装,还是会提示缺少依赖,也不知道那里有问题。有大佬知道,麻烦指导下,好人一生平安啊。 最后还是老套路,下载相应依赖。

    wget https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-cccl-11-8-11.8.89-1.x86_64.rpm
    sudo yum install cuda-cccl-11-8-11.8.89-1.x86_64.rpm -y
    wget https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-nvcc-11-8-11.8.89-1.x86_64.rpm
    sudo yum install cuda-nvcc-11-8-11.8.89-1.x86_64.rpm -y
    wget https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-cudart-11-8-11.8.89-1.x86_64.rpm
    sudo yum install cuda-cudart-11-8-11.8.89-1.x86_64.rpm -y
    wget https://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-cudart-devel-11-8-11.8.89-1.x86_64.rpm
    sudo yum install cuda-cudart-devel-11-8-11.8.89-1.x86_64.rpm -y
    sudo yum install tensorrt
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
  3. 验证

    rpm -qa | grep tensorrt
    # You should see something similar to the following:
    tensorrt-8.5.3.x-1.cuda11.8.x86_64
    
    • 1
    • 2
    • 3
  4. 后悔药

    sudo yum erase "libnvinfer*" -y
    sudo yum erase "nv-tensorrt-repo*" -y
    sudo yum erase "nv-tensorrt-local-repo*" -y
    sudo yum erase graphsurgeon-tf onnx-graphsurgeon -y
    sudo yum erase uff-converter-tf -y
    sudo yum autoremove -y
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6

END

  1. 以上记录全部的安装过程,有需要的小伙伴可以参考一下。
  2. 码字不易,欢迎三连 。

愿你看尽繁华,归来仍是少年

在这里插入图片描述

声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/很楠不爱3/article/detail/128527
推荐阅读
相关标签
  

闽ICP备14008679号