• 【软件环境安装与使用】GeForce RTX 3080 with CUDA capability sm_86 is not compatible with the current PyTorch installation.


    前言

    博主在运行edgeai_yolov5的时候,出现了一些意料之外的错误,记之。

    问题

    NVIDIA GeForce RTX 3080 Ti with CUDA capability sm_86 is not compatible with the current PyTorch installation.
    The current PyTorch install supports CUDA capabilities sm_37 sm_50 sm_60 sm_70.
    RuntimeError: CUDA error: no kernel image is available for execution on the device
    CUDA kernel errors might be asynchronously reported at some other API call,so the stacktrace below might be incorrect.
    For debugging consider passing CUDA_LAUNCH_BLOCKING=1.

    原因

    NVIDIA GeForce RTX 3080 Ti with CUDA capability sm_86意思是RTX 3080 Ti的算力是8.6,而当前安装好的pytorch最高只支持到7.5算力的显卡,也就是说显卡算力和pytorch版本不匹配。

    从log可以看出与pytorch、CUDA版本之间是否匹配有关;

    通过以下代码不能确定cuda是否可用,只是检测CUDA是否正确安装并能否被pytorch检测到;

    import torch
    # 在python的命令环境测试该命令 返回是True的,但是在run torch程序的时候报错
    torch.cuda.is_available()

    要测试显卡算力与当前pytorch是否匹配,可以进入python命令行,依次输入如下两行代码:

    如果想要测是你的cuda版本torch是否可以使用,使用以下命令测试可能会更好。

    import torch
    torch.zeros(1).cuda()
     根据对应算力的话,算力为8.x的显卡使用的cuda版本应该大于等于11.0。
    上面表面上是说PyTorch,实际上是PyTorch依赖的CUDA版本的问题。
    RTX 3080的算力是8.6,3080Ti只能适用CUDA11.0以上的版本;需要重新安装对应CUDA可用版本的pytorch版本;
    具体的nvidia、CUDA以及和pytorch版本之间的关系,可以参考here,个人感觉总结的非常清晰到位,点个赞~
     
    解决方法
    出现这个问题主要是edgeai_yolov5中requirements.txt指定安装pytorch=1.9.0版本,
    pip install -r requirements.txt

    pip之后默认安装的环境是torch1.9.0+cuda10.2,而3080ti的算力是8.6,支持的cuda版本应该不小于11.0,所以出错。

    解决办法是修改requirements.txt中的torch相关内容的版本,直接使用conda安装指定的torch和cuda版本即可;

    conda install pytorch torchvision torchaudio cudatoolkit=11.3 -c pytorch  # 最新版本的pytorch,也可以指定pytorch版本
    pip install -r requirements.txt

    参考

    1. GeForce RTX 3080 with CUDA capability sm_86 is not compatible with the current PyTorch installation.

    2. nvidia显卡和CUDA版本关系

  • 相关阅读:
    DOM getElementById
    百度之星2014
    游艇租借
    2014年acm亚洲区域赛·鞍山站
    UVALive 4255 Guess
    UVA 10054 The Necklace
    UVA 10047 The Monocycle
    UVA 11624 Fire!
    第九届黑龙江省赛
    剑指offer系列31-----二叉树的下一个节点
  • 原文地址:https://www.cnblogs.com/happyamyhope/p/16404790.html
Copyright © 2020-2023  润新知