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 3090显卡的pytorch

卸载当前版本的pytorch, 重新按照以下安装

pip uninstall torch
 
# torch 1.7.0+cu110
pip install torch==1.7.0+cu110 torchvision==0.8.1+cu110 torchaudio===0.7.0 -f https://download.pytorch.org/whl/torch_stable.html
 
# 更新:现在可使用torch 1.8.2 啦!!
conda install pytorch torchvision torchaudio cudatoolkit=11.1 -c pytorch-lts -c nvidia

如果安装失败可以尝试离线安装,具体参考我的另一篇博客

Pytorch安装太慢/安装不了怎么办?那就离线安装Pytorch_wisteri的博客-CSDN博客

另一个小问题

Pytorch错误:Torch not compiled with CUDA enabled

 在用Pytorch炼丹的过程中,很意外地碰到了一个错误提示AssertionError: Torch not compiled with CUDA enabled。

代码本身可以确定是没有问题的,因为只是在往日已经跑过的代码上加入了小改动。最后发现问题出现在Pytorch和CUDA版本不兼容的问题上。问题的发现可以在终端中输入'python3'命令,运行python3后,输入

import torch
print(torch.__version__)
print(torch.cuda.is_available())

如果输出的结果是False,那么说明当前的Pytorch版本无法使用显卡。

解决办法:

应该是你装的是cpu版本的Pytorch,卸载重装cuda版本的Pytorch。

  • 4
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值