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

在这里插入图片描述

详细记录 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
    
  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
    
  4. 验证
    nvcc -V
    cd /usr/local/cuda-11.8/samples/1_Utilities/deviceQuery
    sudo make
    ./deviceQuery
    
    cd ../bandwidthTest
    sudo make
    ./bandwidthTest
       
    # 如果这两个测试的最后结果都是Result = PASS,说明CUDA安装成功.
    
  5. 后悔药
    # uninstall cuda
    sudo /usr/local/cuda-11.8/bin/cuda-uninstaller
    # uninstall nvidia driver
    #sudo /usr/bin/nvidia-uninstall
    

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
    
  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
    
  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 
    
  5. 验证

    cd /usr/src/cudnn_samples_v8/mnistCUDNN
    make clean && make
    ./mnistCUDNN
    Test passed!
    
  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
    
  7. 后悔药

    sudo yum erase "cudnn-local-repo*" -y
    sudo yum erase "libcudnn*"
    

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
    
  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
    
  3. 验证

    rpm -qa | grep tensorrt
    # You should see something similar to the following:
    tensorrt-8.5.3.x-1.cuda11.8.x86_64
    
  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
    

END

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

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

在这里插入图片描述

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值