cuda config_error ai_generated true

RuntimeError: CUDA lazy loading is not enabled

ID: cuda/cuda-lazy-loading

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

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
12 active

Root Cause

CUDA lazy loading environment variable not set. Improves startup time and memory usage.

generic

Workarounds

  1. 95% success Set CUDA_MODULE_LOADING=LAZY in your environment
    export CUDA_MODULE_LOADING=LAZY

    Sources: https://pytorch.org/docs/stable/notes/cuda.html

  2. 90% success Add to .bashrc or .env file for persistence
    # Add to ~/.bashrc or ~/.zshrc:
    echo 'export CUDA_MODULE_LOADING=LAZY' >> ~/.bashrc
    source ~/.bashrc
    
    # Or in a .env file for your project:
    CUDA_MODULE_LOADING=LAZY
    
    # For Docker containers, add to Dockerfile:
    ENV CUDA_MODULE_LOADING=LAZY

    Sources: https://docs.nvidia.com/cuda/cuda-c-programming-guide/index.html

Dead Ends

Common approaches that don't work:

  1. Set CUDA_MODULE_LOADING=EAGER 70% fail

    EAGER is the default — you want LAZY for better performance

  2. Ignore the warning 55% fail

    Missing lazy loading wastes GPU memory at startup

Error Chain

Frequently confused with: