# RuntimeError: cuDNN error: CUDNN_STATUS_NOT_INITIALIZED when calling cudnnCreate

- **ID:** `pytorch/cudnn-status-not-initialized`
- **Domain:** pytorch
- **Category:** runtime_error
- **Error Code:** `CUDNN_STATUS_NOT_INITIALIZED`
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

cuDNN library failed to initialize, often due to incompatible CUDA/cuDNN versions, missing library files, or corrupted installation.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| pytorch>=1.10 | active | — | — |
| cuda>=11.0 | active | — | — |
| cudnn>=8.0 | active | — | — |

## Workarounds

1. **Verify CUDA and cuDNN versions match PyTorch requirements: run `python -c "import torch; print(torch.version.cuda); print(torch.backends.cudnn.version())"` and compare with PyTorch documentation.** (90% success)
   ```
   Verify CUDA and cuDNN versions match PyTorch requirements: run `python -c "import torch; print(torch.version.cuda); print(torch.backends.cudnn.version())"` and compare with PyTorch documentation.
   ```
2. **Reinstall cuDNN by downloading the correct version from NVIDIA and copying library files to the CUDA toolkit directory (e.g., /usr/local/cuda/lib64).** (85% success)
   ```
   Reinstall cuDNN by downloading the correct version from NVIDIA and copying library files to the CUDA toolkit directory (e.g., /usr/local/cuda/lib64).
   ```
3. **Use a PyTorch Docker image with pre-matched CUDA/cuDNN versions: `docker pull pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel`** (80% success)
   ```
   Use a PyTorch Docker image with pre-matched CUDA/cuDNN versions: `docker pull pytorch/pytorch:2.0.1-cuda11.7-cudnn8-devel`
   ```

## Dead Ends

- **Reinstalling PyTorch without changing CUDA version** — If the underlying CUDA/cuDNN mismatch persists, reinstalling PyTorch alone does not resolve it. (85% fail)
- **Setting environment variable CUDNN_LOGINFO_DBG=1** — This only enables logging, does not fix the initialization issue. (90% fail)
- **Downgrading PyTorch to an older version** — May temporarily work but is not a proper fix; the root cause is version compatibility. (70% fail)
