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 kernel image is available for execution on the device

参考pytorch 报错 RuntimeError: CUDA error: no kernel image is available for execution on the device_可豌豆的博客-CSDN博客

则应该安装1.8.1以上 cuda11.1以上的版本:

否则有提示:

NVIDIA GeForce RTX 3060 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_61 sm_70 sm_75 compute_37.
If you want to use the NVIDIA GeForce RTX 3060 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

  warnings.warn(incompatible_device_warn.format(device_name, capability, " ".join(arch_list), device_name))
 

根据官网指令:Previous PyTorch Versions | PyTorch

conda环境中卸载torch

conda uninstall *torch* cudatoolkit

pip3 install torch==1.10.2+cu113 torchvision==0.11.3+cu113 torchaudio==0.10.2+cu113 -f https://download.pytorch.org/whl/cu113/torch_stable.html

来源:流浪德意志

物联沃分享整理
物联沃-IOTWORD物联网 » RuntimeError: CUDA error: no kernel image is available for execution on the device

发表评论