# CUDA错误：没有可用于在设备上执行的内核映像 (cudaErrorNoKernelImageAvailable)

- **ID:** `cuda/device-incompatible-cubin`
- **领域:** cuda
- **类别:** build_error
- **错误码:** `cudaErrorNoKernelImageAvailable`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

编译的CUDA二进制文件（cubin）是为与当前使用的GPU架构不同的架构生成的，例如sm_80与sm_86。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| CUDA 12.0 | active | — | — |
| PyTorch 2.0.0 | active | — | — |
| NVIDIA A100 (sm_80) | active | — | — |

## 解决方案

1. ```
   Recompile the kernel with the correct architecture. For PyTorch, set environment variable `TORCH_CUDA_ARCH_LIST='8.6'` for Ampere GPUs. For custom CUDA code, compile with `-arch=sm_86`.
   ```

## 无效尝试

- **** — The issue is architecture-specific, not CUDA version. (80% 失败率)
- **** — Caching only affects runtime memory, not compiled code. (95% 失败率)
