Pytorch CUDA 错误:没有内核映像可用于在带有 cuda 11.1 的 RTX 3090 上的设备上执行
Posted
技术标签:
【中文标题】Pytorch CUDA 错误:没有内核映像可用于在带有 cuda 11.1 的 RTX 3090 上的设备上执行【英文标题】:Pytorch CUDA error: no kernel image is available for execution on the device on RTX 3090 with cuda 11.1 【发布时间】:2021-04-20 16:41:18 【问题描述】:如果我运行以下命令:
import torch
import sys
print('A', sys.version)
print('B', torch.__version__)
print('C', torch.cuda.is_available())
print('D', torch.backends.cudnn.enabled)
device = torch.device('cuda')
print('E', torch.cuda.get_device_properties(device))
print('F', torch.tensor([1.0, 2.0]).cuda())
我明白了:
A 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0]
B 1.8.0.dev20210115+cu110
C True
D True
E _CudaDeviceProperties(name='GeForce RTX 3090', major=8, minor=6, total_memory=24267MB, multi_processor_count=82)
F
<stacktrace>
CUDA error: no kernel image is available for execution on the device
关于我的系统的更多信息:
Nvidia 版本:NVIDIA-SMI 455.38 驱动程序版本:455.38 CUDA 版本:11.1 python 3.7,Ubuntu 18.04【问题讨论】:
【参考方案1】:在这里找到了解决我的问题的方法:https://github.com/pytorch/pytorch/issues/31285#issuecomment-739139454
pip install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu110/torch_nightly.html -U
然后我的代码 sn-p 给出:
A 3.7.5 (default, Nov 7 2019, 10:50:52)
[GCC 8.3.0]
B 1.8.0.dev20210115+cu110
C True
D True
E _CudaDeviceProperties(name='GeForce RTX 3090', major=8, minor=6, total_memory=24267MB, multi_processor_count=82)
F tensor([1., 2.], device='cuda:0')
【讨论】:
还是不行以上是关于Pytorch CUDA 错误:没有内核映像可用于在带有 cuda 11.1 的 RTX 3090 上的设备上执行的主要内容,如果未能解决你的问题,请参考以下文章
Tensorflow-gpu 问题(CUDA 运行时错误:设备内核映像无效)
在 Ubuntu 上安装 CUDA + RAPIDS - “没有可用的内核映像”
在 WSL2 上使用 Cuda 让我“没有可在设备上执行的内核映像”。
PyTorch:NVIDIA NGC 映像还是 Docker Hub 映像?
Pytorch RuntimeError: CUDA error: out of memory at loss.backward() , 使用 CPU 时没有错误