【NeRF-pytorch故障排除】解决 CUDA “no kernel image is available“(Linux)

适用问题

本文解决了“NVIDIA 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 NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/”
上段提示的意思是当前cuda的算力或pytorch和显卡算力不匹配

我的环境配置

显卡:RTX 3090
通过nvidia-smi指令查看:
在这里插入图片描述
绿色部分即为显卡系列,通过报错信息可知其算力是sm_86,如果你的模型没有要求pytorch的版本,可以去查一下跟sm_86对应的pytorch版本。我的模型对pytorch的版本有要求。

pytorch:torch-1.11.0 && torchvision-0.12.0
python:3.8.10
通过python指令查看
在这里插入图片描述
我有两个版本的python,上图为默认版本。python版本的选择可以在pycharm里面进行配置,需要根据pytorch的版本进行选择。

CUDA:RTX 3090要求的cuda的版本要在11以上,并且cuda的版本不能超过上图中红色圈圈内的版本。同时,还要考虑pytorch的版本(根据自己的要求去选择cuda),因此我选择的是cuda11.3。

CUDNN:查看与cuda配套的cudnn版本,这个也一定要下!!我选择的是cudnn–8.2.1
在这里插入图片描述
上面配置具体下载的方法我就不赘述了。

查找解决办法

解决本文问题,借鉴了以下文章:

https://blog.csdn.net/A407567738/article/details/127457398

自测问题

自测代码:

import torch
print(torch.cuda.is_available())
print(torch.zeros(1).cuda())

若报错:

NVIDIA 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 NVIDIA GeForce RTX 3090 GPU with PyTorch, please check the instructions at https://pytorch.org/get-started/locally/

则点击右侧,查看与当前cuda匹配的pytorch:pytorch下载官网
在这里插入图片描述

解决问题

综合考虑,我选择了:

pip install torch==1.11.0+cu113 torchvision==0.12.0+cu113 torchaudio==0.11.0 --extra-index-url https://download.pytorch.org/whl/cu113

这里我下载了一个半小时,时间比较久应该是正常的。

验证结果

Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.zeros(1).cuda()
tensor([0.], device='cuda:0')
>>> 

当出现tensor([0.], device='cuda:0')则说明问题已经解决。

特别说明

本人在解决这个问题前,重新配置了一下cudnn,我觉得我报错的原因还有可能是没有下载正确的cudnn。
详细方法看见这两篇文章:教你如何下载cudnn教你如何移动cudnn/cuda中的文件
一定要记得把解压后的cudnn中cuda的两个文件夹移动到你需要的cuda文件里(上面链接里有教!!!)

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值