cuda compatibility ai_generated true

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

ID: cuda/no-kernel-image-for-device

Also available as: JSON · Markdown
90%Fix Rate
92%Confidence
50Evidence
2023-01-01First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
12 active

Root Cause

The compiled CUDA binary doesn't include kernels for the GPU architecture (compute capability mismatch).

generic

Workarounds

  1. 93% success Rebuild with the correct CUDA architecture: set TORCH_CUDA_ARCH_LIST or pass -arch=sm_XX
    For RTX 3090 use sm_86, RTX 4090 use sm_89, A100 use sm_80

    Sources: https://developer.nvidia.com/cuda-gpus

  2. 90% success Install pre-built binaries that support your GPU: pip install torch --index-url https://download.pytorch.org/whl/cu121
    PyTorch wheels include all common architectures

Dead Ends

Common approaches that don't work:

  1. Installing a different CUDA toolkit version 70% fail

    The toolkit version doesn't determine compiled architectures

  2. Using CUDA_VISIBLE_DEVICES to select a different GPU 80% fail

    All GPUs on the machine likely have the same architecture

Error Chain

Frequently confused with: