[已解决]RuntimeError: CUDA error: no kernel image is available for execution on the device

这篇具有很好参考价值的文章主要介绍了[已解决]RuntimeError: CUDA error: no kernel image is available for execution on the device。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

问题描述

在ubuntu服务器上用python炼丹的时候遇到的两个问题,一个warning和一个runtimeErro,我的环境是用conda配置的,我就切换了一下环境,然后切回来就报这两个错误,期间啥也没干,之前重新安装opencv疯狂报错也是这种样子的。

  • warning
    warning:NVIDIA GeForce RTX 3090 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.
    If you want to use the NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/
  • 主要是这个erro:
    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.
    runtimeerror: cuda error: no kernel image is available for execution on the,深度学习,python,深度学习,opencv

问题分析

对于第一个warning,他的意思是我的CUDA版本不对,cuda支持的算力和显卡3090不匹配。去网上搜了,确实有类似的问题,但是我的cudatoolkit=11.3,和3090算力是匹配的,所以这个warning是误导我的,这个时候我们需要在系统里面再确认一下机器的cuda版本,在xshell中输入以下命令查看:

nvidia-smi

runtimeerror: cuda error: no kernel image is available for execution on the,深度学习,python,深度学习,opencv
可以看到CUDA的版本是没有问题的,因此这个问题可以不管,处理了后面的问题之后自然就好了。

对于这个RuntimeErro,意思是显卡的cuda内核有问题,看上去挺离谱的,但是这个问题我已经是第二次遇到了,之前报opencv错误的时候也是这样,上网查了一下,各种办法都有,我试了一遍,只有重装torch是最有效的。
直接先卸载torch:

pip uninstall torch #需要用pip卸载,conda我这里卸不了

runtimeerror: cuda error: no kernel image is available for execution on the,深度学习,python,深度学习,opencv
然后,重新安装torch,我用的conda装的,命令如下:

conda install torch

runtimeerror: cuda error: no kernel image is available for execution on the,深度学习,python,深度学习,opencv
最后再运行咱们的代码发现又能跑了,这个问题就解决了。

总结

报错的具体内容不用研究,只要是这个描述的,基本就是重装torch来解决。文章来源地址https://www.toymoban.com/news/detail-782952.html

到了这里,关于[已解决]RuntimeError: CUDA error: no kernel image is available for execution on the device的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 当出现RuntimeError:CUDA error:no kernel image is available for execution on the device 问题时候的pytorch安装方法

    当出现一个明显的特征就是出现: RuntimeError:CUDA error:no kernel image is av ailable for execution on the device 这就说明你的显卡太低了 可以到这个路径下C:Program FilesNVIDIA GPU Computing ToolkitCUDAv11.1extrasdemo_suite, 找到deviceQuenry.exe这个文件拖到cmd命令窗口运行可以看到自身电脑的算力  从

    2024年02月01日
    浏览(50)
  • 【Lora模型训练过程报错】Error no kernel image is available for execution on the device at line

    在使用 sd-script训练自己的Lora模型时,可能会出现“Error no kernel image is available for execution on the device at line 167 ”的错误: 这是因为旧的显卡 例如10系列不支持unit8类型 ,需要在 训练的配置文件中,修改:

    2024年02月11日
    浏览(30)
  • 解决RuntimeError:No CUDA GPUs are available

    解决RuntimeError:No CUDA GPUs are available 如果本来显卡是能用的 版本这些也能对的上。 基本解决方法为 在使用之前检查cuda是否可用 不检测默认不可用。 或者在文件头加入import torch torch.cuda.current_device() torch.cuda._initialized = True // 检测一下cuda是否可用 print(torch.cuda.is_available()) F

    2024年02月03日
    浏览(25)
  • 已解决RuntimeError: CUDA error: invalid device ordinal CUDA kernel errors might be asynchronously repo

    参考链接 当运行以下代码出现报错: 报错信息如下 RuntimeError: CUDA error: invalid device ordinal 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. 报错完整截图 报错的信息告诉我们,编号\\\"1\\\"是无效的设

    2024年02月04日
    浏览(38)
  • RuntimeError: No CUDA GPUs are available

    在之前运行代码时正常没有任何问题,但是后面莫名其妙突然报错:RuntimeError: No CUDA GPUs are available 一开始还有这个:No CUDA runtime is found, using CUDA_HOME=\\\'/usr/local/cuda\\\' 这里主要有几个考虑的方面: 1、用于运行代码的GPU号设置问题 如果你的代码里面有下面这句话 (1)如果使用的

    2024年02月16日
    浏览(31)
  • BUG:RuntimeError: CUDA error: invalid device ordinal CUDA kernel errors might be asynchronously repo

    参考链接 当运行以下代码出现报错: 报错信息如下 RuntimeError: CUDA error: invalid device ordinal 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. 报错完整截图 报错的信息告诉我们,编号\\\"1\\\"是无效的设

    2024年02月12日
    浏览(40)
  • RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is Fal

    今天在跑 yolov7 的时候遇见,模型加载问题,因为我是使用CPU来加载 pt 模型的,但是出现了错误; RuntimeError: Attempting to deserialize object on a CUDA device but torch.cuda.is_available() is False. If you are running on a CPU-only machine, please use torch.load with map_location=torch.device(\\\'cpu\\\') to map your storages to

    2024年02月11日
    浏览(43)
  • Bug小能手系列(python)_13: RuntimeError: CUDA error: device-side assert triggered CUDA kernel errors might

    在运行 Python 代码时出现报错: RuntimeError: CUDA error: device-side assert triggered 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. 注意:报错对应的代码部分与实际出现错误的部分是不同的。具体报错

    2024年02月04日
    浏览(30)
  • [pytorch] torch.cuda.is_available() False 解决方法

            进入虚拟环境后pip list查看虚拟环境里的包,已有torch以及对应的版本号,但是torch调用cuda失败,情况如下:  出现这种情况通常是下载了CPU版本的pytorch,一般通过命令下载的pytorch(包括官网提供的命令)是CPU版本的,可以通过查询anaconda里的安装包判断是否安装

    2023年04月08日
    浏览(23)
  • 【一文解决】已安装CUDA与Pytorch但torch.cuda.is_available()为False

    已经安装CUDA与Pytorch。但执行如下Python脚本,输出结果为False: 出现这个问题的原因很多,很多文章的分析并不全面。博主遇到这个问题时,也是不断整合网络上零零散散的信息,浪费了不少功夫,因此写下了本文。如果你也遇到了这个问题, 本文致力于帮助你通过这一篇文

    2024年02月09日
    浏览(25)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包