解决CUDA error: no kernel image is available for execution on the device
1. 电脑配置
GPU 3080 算力8.6
CUDA 11.1
CUDNN 8.2.0
conda 4.9.2
python 3.8.5
2. 问题描述
首先在pytroch官网根据电脑相应配置使用pip命令
pip3 install torch==1.8.1+cu111 torchvision==0.9.1+cu111 torchaudio==0.8.1 -f https://download.pytorch.org/whl/torch_stable.html
安装torch、torchaudio、torchvision以及cudatoolkit,版本如下:
torch==1.8.1+cu111
torchaudio==0.8.1
torchvision==0.9.1+cu111
当时未测试cuda是否可用,疏忽了!!!大家安装完之后一定要先测试cuda在当前环境下是否可用,再去用在自己的脚本上,免得出问题之后不知道具体是什么问题!
——————————————————————————————————
我直接用在了mmdetection给的第一个实例代码上,报错如下:
ibtorch_cuda_cu.so: cannot open shared object file: No such file or directory
网上搜索说可能是pytorch版本过高,当时还是没有检查cuda是否可用,愚蠢!!
于是直接卸载了torch,由于用的pip命令安装,卸载命令如下:
pip uninstall torch
# 会提示连同torch1.8.1+cu111一起卸载
# 我点了确定,貌似这个命令把cudatoolkit也一并卸载了
于是我又重新安装torch1.8.0版本以及cudatoolkit11.1
pip install torch==1.8.0 cudatoolkit==11.1
安装成功后,用以下代码测试cuda是否可用:
import torch
torch.cuda.is_available()
# 返回True 接着用下列代码进一步测试
torch.zeros(1).cuda()
开始报错,如下:
GeForce RTX 3080 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 GeForce RTX 3080 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/
# 同时还有如下报错
RuntimeError: CUDA error: no kernel image is available for execution on the device
大概意思就是说当前GPU的算力与当前版本的Pytorch依赖的CUDA算力不匹配(3080算力为8.6,而当前版本的pytorch依赖的CUDA算力仅支持3.7,5.0,6.0,7.0)
——————————————————————————————————
参考:低版本GPU可在相对高的CUDA版本下运行,例如:算力为8.0的GPU可在算力为8.6的CUAD版本下运行,而相反则不行。同理算力8.x的显卡不可以在支持最高算力7.x的CUDA版本下运行。
因此应该尽量安装更高版本的CUDA,但是让我疑问的是我都装了几乎最新版本,还不支持?
——————————————————————————————————
于是去网上搜集目前torch、cuda相关适配信息,详见博客
——————————————————————————————————
下一步全部卸载重装
conda install pytorch==1.8.0 torchvision==0.9.0 torchaudio==0.8.0 cudatoolkit=11.1 -c pytorch -c conda-forge
装好之后的情况如下:
pytorch==1.8.0 py3.8_cuda11.1_cudnn8.0.5_0
torchaudio==0.8.0
torchvision==0.9.0
再次测试上述命令测试cuda是否可用
测试成功!!cuda已经可用了!!
总结:只有cuda11.1才支持算力为8.6的GPU,大家不要装错了!!!!当然,如果装低版本的pytorch应该也可以、低版本的cudatoolkit应该也可以? 具体我没试过,有空新建一个环境试一下!还有就是一定要知道自己GPU的算力,NVIDIA算力可在此处查看
解决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 CUDA ker
出现问题(已解决)RuntimeError: CUDA error: no kernel image is available for execution on the device CUDA ker ...
- [debug] 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 ( ...
- RTX 3090运行报错: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 安装适用于GeForce RTX ...
- 显卡RTX 3090运行pytorch报错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 安装适用于GeForce RTX ...
- RuntimeError: CUDA error: no kernel image is available for execution on the device
导致的原因一般都是显卡算力和cuda或者torch版本不匹配 比如在conda中安装的pytorch=1.5.0 cuda=10.2 错误:RuntimeError: CUDA error: no k ...
- PyTorch报CUDA error: no kernel image is available for execution on the device问题解决
首先讲一下报错的原因PyTorch高版本对显卡算力是有所要求的,驱动程序只是从软件角度去利用显卡,显卡的算力是不会改变的,报错就在于显卡的算力太低.这里就涉及到了NVIDIA GPU CUDA的com ...
- (ubuntu)YOLOv5报错:RuntimeError: CUDA error: no kernel image is available for execution on the ...
笔者之前在另一台电脑成功跑通了自己修改的yolov5,但在新系统运行时报了如下错误 RuntimeError: CUDA error: no kernel image is available for ...
- RuntimeError: CUDA error: no kernel image is available for execution on the driver
问题:RuntimeError: CUDA error: no kernel image is available for execution on the driver, when use pyto ...
- GT820M显卡使用CUDA的“no kernel image is available for execution on the device”问题解决
最近使用比较老的电脑使用CUDA,一开始安装10.1的windows版本,发现无法使用,经过网上查阅信息发现是显卡驱动不支持,电脑的NVIDIA驱动是390. 然后查询到该驱动支持9.0版本的CUDA ...
最新文章
- 2021.5.13指导论文
- 有人统计了2万篇论文发现:想增加引用量,最好少说「黑话」
- Jsp—02—项目:登录案例
- intelliJ idea运行新的test功能时,报错:class not found ..... empty test suite
- 九月免费手账分享-【奶油星云】
- CSS实现垂直居中的方法
- linux c++ 实现http请求
- hdu 5755 Gambler Bo 高斯消元
- OpenCV(一)---支持向量机 SVM
- C语言练习题(递归)
- JAVA调起clearcase_Eclipse集成配置管理工具ClearCase (ccrc_for_eclipse)
- VC无进程木马下载器源码(利用IE隐藏进程)
- 解决 Error: [WinError 10013] 以一种访问权限不允许的方式做了一个访问套接字的尝试。(酷狗音乐占用8000端口)
- springboot~使用自定义的aspect
- 企业完成云转型的成功之道:云成本优化管理
- Error processing line 1 of D:\**\anaconda3\lib\site-packages\matplotlib-3.3.2-py3.8-nspkg.pth:
- 测试一个显示器有拖影的软件,让“瑕疵”原形毕露,教你检测游戏显示器!
- 运行mongoDB时提示:无法启动此程序,因为计算机中丢失api-ms-win-crt-runtime-|1-1-0.dll请重新安装此程序解决问题 解决办法
- 大学生H5动画设计成品作业 —— 城市环保网
- Activiti(工作流)如何关联业务表