You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

PyTorch CUDA报错:PTX工具链不兼容,V100需降级CUDA?

问题描述

硬件及驱动信息

(pytorch) [s.1915438@cl1 aneurysm]$ srun nvidia-smi
Sun Jul 17 16:17:27 2022       
+-----------------------------------------------------------------------------+
| NVIDIA-SMI 495.29.05    Driver Version: 495.29.05    CUDA Version: 11.5     |
|-------------------------------+----------------------+----------------------+
| GPU  Name        Persistence-M| Bus-Id        Disp.A | Volatile Uncorr. ECC |
| Fan  Temp  Perf  Pwr:Usage/Cap|         Memory-Usage | GPU-Util  Compute M. |
|                               |                      |               MIG M. |
|===============================+======================+======================|
|   0  Tesla V100-PCIE...  On   | 00000000:D8:00.0 Off |                    0 |
| N/A   31C    P0    25W / 250W |      0MiB / 16160MiB |      0%      Default |
|                               |                      |                  N/A |
+-------------------------------+----------------------+----------------------+
                                                                               
+-----------------------------------------------------------------------------+
| Processes:                                                                  |
|  GPU   GI   CI        PID   Type   Process name                  GPU Memory |
|        ID   ID                                                   Usage      |
|=============================================================================|
|  No running processes found                                                 |
+-----------------------------------------------------------------------------+

Python、PyTorch及CUDA版本信息

Python 3.8.13 (default, Mar 28 2022, 11:38:47) 
[GCC 7.5.0] :: Anaconda, Inc. on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import torch
>>> torch.__version__
'1.12.0+cu113'

运行错误

(pytorch) [s.1915438@cl1 aneurysm]$ srun python aneurysm.py
terminate called after throwing an instance of 'std::runtime_error'
  what():  the provided PTX was compiled with an unsupported toolchain.
srun: error: ccs2114: task 0: Aborted

问题:这是兼容性问题吗?是否需要将CUDA降级到10.2版本,因为V100显卡比较老旧?


解答

这确实是CUDA工具链与PyTorch、显卡驱动的兼容性问题,但完全不需要降级到CUDA 10.2——Tesla V100的计算能力为7.0,完全支持CUDA 11.x系列(CUDA 11.x兼容计算能力3.5到8.6的GPU)。

问题根源

当前环境的核心矛盾是版本不匹配:

  • 系统显卡驱动支持的最高CUDA版本为11.5(nvidia-smi显示)
  • 但PyTorch使用的是预编译的CUDA 11.3版本(torch.__version__显示1.12.0+cu113)
  • 错误提示的PTX工具链不兼容,本质是PyTorch内置的CUDA工具链与系统驱动的CUDA版本不匹配,或者模型中自定义CUDA算子/PTX代码是用更高版本工具链编译的,无法被当前驱动识别。

解决步骤

  1. 匹配PyTorch与系统CUDA版本
    安装与系统CUDA 11.5适配的PyTorch版本,以PyTorch 1.12.0为例:

    # pip安装
    pip install torch==1.12.0+cu115 torchvision==0.13.0+cu115 torchaudio==0.12.0 --extra-index-url https://download.pytorch.org/whl/cu115
    
    # conda安装
    conda install pytorch==1.12.0 torchvision==0.13.0 torchaudio==0.12.0 cudatoolkit=11.5 -c pytorch
    
  2. 检查自定义算子编译环境
    如果模型包含自定义CUDA算子,需确保编译这些算子时使用的CUDA工具链版本与PyTorch的CUDA版本一致,且不高于系统驱动支持的CUDA版本(11.5)。

  3. 无需降级CUDA版本
    Tesla V100的硬件规格完全适配CUDA 11.x,降级到10.2会浪费显卡性能,属于不必要操作。

验证方法

安装完成后,运行以下代码确认环境是否正常:

import torch
print(torch.cuda.is_available())
print(torch.version.cuda)

若输出True和11.5,说明环境匹配成功。


内容的提问来源于stack exchange,提问作者Prakhar Sharma

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.08.25 23:45:37