cudaErrorNoKernelImageAvailable cuda build_error ai_generated true

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

CUDA error: no kernel image is available for execution on the device (cudaErrorNoKernelImageAvailable)

ID: cuda/device-incompatible-cubin

其他格式: JSON · Markdown 中文 · English
90%修复率
88%置信度
1证据数
2024-01-10首次发现

版本兼容性

版本状态引入弃用备注
CUDA 12.0 active
PyTorch 2.0.0 active
NVIDIA A100 (sm_80) active

根因分析

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

English

The compiled CUDA binary (cubin) was generated for a different GPU architecture than the one currently in use, e.g., sm_80 vs sm_86.

generic

官方文档

https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#gpu-compilation

解决方案

  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`.

无效尝试

常见但无效的做法:

  1. 80% 失败

    The issue is architecture-specific, not CUDA version.

  2. 95% 失败

    Caching only affects runtime memory, not compiled code.