报错解决之GeForce RTX *** with CUDA capability sm_86 is not compatible with the current PyTorch...

本文详细分析了在使用PyTorch进行深度学习时遇到的CUDA兼容性错误,解释了CUDA能力与版本之间的关系,并提供了解决方案——更新CUDA版本以匹配PyTorch。通过调整CUDA版本,确保显卡算力与支持的CUDA版本相匹配,可以避免此类错误并顺利进行模型训练。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

报错信息

深度学习神经网络模型训练的时候,可能会报出如下错误:

GeForce RTX *** 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.

问题分析

报错信息中的CUDA capability sm_86意思是算力8.6,即该RTX型号的显卡算力是8.6,但是当前的PyTorch依赖的CUDA版本支持的算力只有3.75.06.06.17.07.5

经查阅资料1,得到下述说明:

A CUDA application binary (with one or more GPU kernels) can contain the compiled GPU code in two forms, binary cubin objects and forward-compatible PTX assembly for each kernel. 
Both cubin and PTX are generated for a certain target compute capability. 
A cubin generated for a certain compute capability is supported to run on any GPU with the same major revision and same or higher minor revision of compute capability. 
For example, a cubin generated for compute capability 7.0 is supported to run on a GPU with compute capability 7.5, however a cubin generated for compute capability 7.5 is not supported to run on a GPU with compute capability 7.0, and a cubin generated with compute capability 7.x is not supported to run on a GPU with compute capability 8.x.

由此可知,显卡的算力要低于或等于所支持最高算力的CUDA版本号,例如算力7.0 的显卡可以在支持最高算力7.5 的CUDA 版本下运行,但是算力8.x 的显卡不可以在支持最高算力7.x 的CUDA 版本下运行2

解决方法

既然知道了报错的原因是PyTorch所对应的CUDA版本的问题,所以解决报错的方法很简单,只需更改CUDA 的版本,将其与PyTorch 适配即可,具体可以到PyTorch 官网下载界面下载对应的库文件进行安装,安装方法可以参考之前的这篇文章,离线安装 is recommended


如果我的这篇文章帮助到了你,那我也会感到很高兴,一个人能走多远,在于与谁同行


参考


  1. RTX3080+cuda问题 ↩︎

  2. GeForce RTX 3090 with CUDA capability sm_86 is not compatible with the current PyTorch installation. ↩︎

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值