RuntimeError: CUDA error: no kernel image is available for execution on the device

GeForce RTX 3090 GPU安装torch之后,运行报错:

GeForce RTX 3090 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 3090 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

运行:

python -c "import torch;print(torch.max(torch.rand((30,30),device='cuda')))"

报错:

GeForce RTX 3090 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 3090 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))
Traceback (most recent call last):
  File "", line 1, in 
RuntimeError: CUDA error: no kernel image is available for execution on the device

应该是版本不兼容,此时的版本为:

torch                   1.8.1
torchvision             0.9.1

删除现在的torch:

pip uninstall torch torchvision torchaudio

重新安装:

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.7.0+cu110
torchaudio              0.7.0
torchvision             0.8.1+cu110

此时再次运行原来的代码,成功

你可能感兴趣的:(Error,3090,error)