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

问题描述

在pycharm调试程序是出现以下错误:

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.
 

问题分析

在网上查找的解决方案都说的是电脑显卡、cuda、torch之间的版本不匹配,于是我查看我所配置的cuda、torch版本和显卡算力。

cuda是10.2 ,torch是 1.9.0,显卡算力3.5。cuda与torch之间是匹配的,那就是显卡算力的问题。

在试过网上很多的方法之后发现还是没法解决问题,一直看到这篇博客:【深度学习】 为Tesla K40c(显卡算力小于3.5)安装pytorch(要求显卡算力3.7以上)笔记_found gpu0 nvidia geforce gt 730 which is of cuda -CSDN博客

才知道现在官网的pytorch支持的最低算力是3.7的,所以使用直接安装的torch就会出现上面说的那个报错。

解决方法

根据上面这篇博客里的链接:https://blog.nelsonliu.me/2020/10/13/newer-pytorch-binaries-for-older-gpus/,下载这位大佬专门为old gpu编译的pytorch。注意,要下载与自己cuda版本匹配的pytorch。

评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值