nvidia显卡和CUDA版本关系

1、nvidia显卡和CUDA版本不对会出现的问题

GeForce RTX 3080 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
上面表面上是说PyTorch,实际上是PyTorch依赖的CUDA版本的问题
翻译一下就是:RTX 3080的算力是8.6,但是当前的PyTorch依赖的CUDA版本支持的算力只有3.7、5.0、6.0、6.1、7.0、7.5及3.7以下

2、为什么会出现这个问题

https://docs.nvidia.com/cuda/ampere-compatibility-guide/index.html#application-compatibility-on-ampere

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

翻译一下就是:
算力7.0的显卡可以在支持最高算力7.5的CUDA版本下运行,但是算力7.5的显卡不可以在支持最高算力7.0的CUDA版本下运行
同理算力8.x的显卡不可以在支持最高算力7.x的CUDA版本下运行

3、那我怎么知道nvidia显卡该用什么CUDA版本呢

3.1、简单粗暴的方法:

直接用最新版本的cuda,肯定就可以让所有显卡都可以用
缺点:pytorch不一定支持最新版本的CUDA


pytorch官网

如上图,pytorch支持最新版本的CUDA为11.1,但是CUDA最新版本为11.2,装了CUDA11.2就用不了pytorch

3.2、高级点的方法

看CUDA文档
https://docs.nvidia.com/cuda/ampere-compatibility-guide/index.html#building-ampere-compatible-apps-using-cuda-10-0

The nvcc compiler included with versions 10.x (10.0, 10.1 and 10.2) of the CUDA Toolkit can generate cubins native to the Volta and Turing architectures (compute capability 7.x)

CUDA10.x最高支持算力7.x
另一种理解CUDA10.x支持Volta伏打架构和Turing图灵架构的显卡
https://docs.nvidia.com/cuda/ampere-compatibility-guide/index.html#building-ampere-compatible-apps-using-cuda-11-0

With versions 11.0 of the CUDA Toolkit, nvcc can generate cubin native to the NVIDIA Ampere GPU architecture (compute capability 8.0).

CUDA11.0最高支持算力8.0(注:这感觉应该是8.x)
另一种理解CUDA11.0支持Ampere安培架构的显卡

4、那又怎么知道显卡算力呢

https://developer.nvidia.com/zh-cn/cuda-gpus#compute

显卡算力

点赞再走

参考

https://blog.csdn.net/weixin_43751285/article/details/109648689

你可能感兴趣的:(nvidia显卡和CUDA版本关系)