> For the complete documentation index, see [llms.txt](https://docs.clore.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.clore.ai/guides/guides_v2-zh/ru-men-zhi-nan/cuda-pytorch-compatibility.md).

# CUDA 与 PyTorch 兼容性

选择与你租用的显卡匹配的 CUDA 构建——这是比其他任何设置都更容易导致 Clore.ai 部署出错的一项

{% hint style="danger" %}
**如果你租用 RTX 50 系列显卡并运行 CUDA 12.4 镜像，什么都不会工作。** 你会看到 `该设备上没有可用于执行的内核镜像`。Blackwell 需要 **CUDA 12.8 或更新版本** 以及 **PyTorch 2.7 或更新版本**。这是 Clore.ai 上最常见的部署失败原因，而且只需一行即可修复。
{% endhint %}

本合集中的每一份指南都附带一个基础镜像。如果你更改了它，或者你自己安装 PyTorch，CUDA 构建版本就必须与所租 GPU 的架构相匹配。Clore.ai 是一个市场，而不是一个统一集群：其机群覆盖从 2017 年的 Pascal 挖矿卡到 2025 年的 Blackwell 工作站卡，没有任何单一镜像能兼容全部。

## 对应矩阵

| 架构            | 计算能力。           | Clore.ai 上的显卡                                   | 使用此项                                            |
| ------------- | --------------- | ----------------------------------------------- | ----------------------------------------------- |
| **Blackwell** | sm\_120         | RTX 5090、5080、5070 Ti、5070、5060 Ti、RTX PRO 6000 | PyTorch **≥ 2.7** 于 **cu128** 或 **cu13x**       |
| **Ada**       | sm\_89          | RTX 4090、4080、4070 Ti、4060 Ti                   | 在 cu121 … cu13x 上使用 PyTorch ≥ 2.1（推荐 cu128）     |
| **Ampere**    | sm\_86 / sm\_80 | RTX 3090、3080、3070、3060、A6000、A2000、CMP 90HX    | 在 cu118 … cu13x 上使用 PyTorch ≥ 1.13（推荐 cu128）    |
| **Turing**    | sm\_75          | RTX 2080 Ti、GTX 1660、CMP 30HX/40HX/50HX         | 任何 cu118 … cu13x                                |
| **Volta**     | sm\_70          | Tesla V100（16GB 和 32GB SXM2）                    | PyTorch **≤ 2.10** 在 cu128 上，或任何 **cu126** 构建版本 |
| **Pascal**    | sm\_61          | P104-100 及类似矿卡                                  | PyTorch **≤ 2.7** 于 **cu124** 或更早版本             |

有两处弃用最容易让人踩坑：

* **PyTorch 2.8 的 cu128 构建已不再支持 Maxwell 和 Pascal** （sm\_50、sm\_60）。
* **PyTorch 2.11 的 cu128 和 cu129 二进制包已移除 Volta 支持** （cuDNN 9.15.1 与 Volta 不兼容）。V100 租用者应固定 `2.10.0-cuda12.8` 或者使用 cu126 构建版本。
* **CUDA 13.0 本身从 Turing 开始支持** （sm\_75）。任何 `cuda13x` 镜像在设计上就不包含 Volta 和 Pascal。

## 可用的基础镜像

```bash
# 适用于从 Ampere 到 Blackwell 的默认选择——指南中使用的就是这个
pytorch/pytorch:2.11.0-cuda12.8-cudnn9-devel     # 构建工具、编译器、nvcc
pytorch/pytorch:2.11.0-cuda12.8-cudnn9-runtime   # 更小，不含 nvcc

# 最新版本，仅适用于 Turing 及以上（不包括 V100，不包括 Pascal）
pytorch/pytorch:2.13.0-cuda13.2-cudnn9-devel

# Tesla V100（sm_70）
pytorch/pytorch:2.10.0-cuda12.8-cudnn9-devel

# Pascal 矿卡（sm_61）
pytorch/pytorch:2.5.1-cuda12.4-cudnn9-devel
```

将 PyTorch 安装到你自己的镜像中：

```bash
# Ampere / Ada / Blackwell
pip install torch torchvision torchaudio --index-url https://download.pytorch.org/whl/cu128

# Volta（V100）
pip install "torch<=2.10" torchvision torchaudio --index-url https://download.pytorch.org/whl/cu126
```

## 检查你实际租到的是什么

```bash
# 驱动及其暴露的 CUDA 版本
nvidia-smi

# 显卡的计算能力，直接从 torch 获取
python -c "import torch; print(torch.cuda.get_device_name(0), torch.cuda.get_device_capability(0))"
# RTX 5090  -> (12, 0)   RTX 4090 -> (8, 9)   RTX 3090 -> (8, 6)   V100 -> (7, 0)

# 这个构建实际包含哪些架构的内核
python -c "import torch; print(torch.cuda.get_arch_list())"
```

如果 `get_device_capability` 返回 `(12, 0)` 以及 `get_arch_list()` 没有 `sm_120`，说明你用了错误的镜像。你再改别的也没用。

{% hint style="info" %}
**租用前先筛选。** 市场会公开每台主机的 CUDA 版本。大约 **Clore.ai 目前约 65% 的 GPU 使用 13.x 驱动** ，35% 使用 12.x，因此 `cu128` 镜像是最安全的默认选择：CUDA 的小版本兼容性让它能在两者上运行。
{% endhint %}

## 错误信息解析

| 你看到的内容                               | 含义                              | 修复                                     |
| ------------------------------------ | ------------------------------- | -------------------------------------- |
| `该设备上没有可用于执行的内核镜像`                   | 该构建没有针对你显卡架构的内核                 | 让镜像与上面的矩阵匹配                            |
| `CUDA 错误：没有可用的内核镜像……sm_120`          | Blackwell 显卡，2.7 之前版本或 cu124 构建 | 切换到 `cu128` + PyTorch ≥ 2.7            |
| `CUDA 驱动版本不足以支持 CUDA 运行时版本`          | 镜像需要比主机上更高版本的驱动                 | 选择更低版本的 CUDA 镜像，或者租用装有更新驱动的主机          |
| `torch.cuda.is_available() == False` | 容器启动时未获得 GPU 访问权限               | 重新部署；确保订单确实挂载了 GPU                     |
| `未定义符号：__cudaPopCallConfiguration`   | 同一环境中混用了多个 CUDA 版本              | 从一个干净的基础镜像重新构建；不要 `pip 安装` 再装第二个 torch |
| 在 4090 上可用，在 5090 上失败                | 经典的架构不匹配                        | 这个镜像属于 Ada 时代；切换到 cu128                |

## Flash Attention 及其相关扩展

编译型扩展与 PyTorch 有同样的限制，而且通常会落后一个版本：

```bash
# 基于你已经安装的 torch 构建，而不是重新装一个新的
pip install flash-attn --no-build-isolation

# vLLM 和 SGLang 自带自己的 CUDA 构建——请使用它们的镜像，而不是
# 把它们安装到 PyTorch 镜像里，否则你会得到两个 torch
docker pull vllm/vllm-openai:latest
docker pull lmsysorg/sglang:latest
```

`vllm/vllm-openai:latest` 以及 `lmsysorg/sglang:latest` 两者都包含 Blackwell 内核。如果你为了可复现性固定了较旧的标签，请确认它是在 RTX 50 系列之后发布的，否则你就会继承本页正在说明的那个问题。

## 下一步

* [Docker 镜像目录](/guides/guides_v2-zh/ru-men-zhi-nan/docker-images.md) ——按工作负载提供的可直接部署镜像
* [GPU 对比](/guides/guides_v2-zh/ru-men-zhi-nan/gpu-comparison.md) ——哪种显卡对应哪种模型
* [GPU 价格](/guides/guides_v2-zh/ru-men-zhi-nan/pricing.md) ——实时市场区间
* [故障排查](/guides/guides_v2-zh/ru-men-zhi-nan/clore-troubleshooting.md) ——其余失败模式

### 链接

* [PyTorch 旧版本和 CUDA 构建](https://pytorch.org/get-started/previous-versions/)
* [Docker Hub 上的 pytorch/pytorch](https://hub.docker.com/r/pytorch/pytorch/tags)
* [CUDA GPU 计算能力](https://developer.nvidia.com/cuda-gpus)
* **租用 GPU：** [RTX 5090 32GB](https://clore.ai/rent-5090.html) · [RTX 4090 24GB](https://clore.ai/rent-4090.html) · [市场](https://clore.ai/marketplace)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.clore.ai/guides/guides_v2-zh/ru-men-zhi-nan/cuda-pytorch-compatibility.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
