RuntimeError: CUDA error: no kernel image is available for execution on the device(NVIDIA 3090)
问题:
- 环境:nvidia 3090 显卡
- 问题:安装了pytorch之后运行程序出现错误
神奇的是 torch.cuda.is_available()
是 true 的 !
找到的原因:
-
可能是安装的 torch 的版本与本地 cuda 对应的版本不对,即使使用
nvcc -V
显示的版本是 cuda 是 9.1 的。 -
但是
nvidia-smi
出来的却是 11.2 的。
然后我是用命令
pip3 install --pre torch torchvision -f https://download.pytorch.org/whl/nightly/cu111/torch_nightly.html -U
重新安装的 torch torchvision
。这里存疑,不过解决了问题