# CUDA 13.2 on Jetson Orin (JetPack 6)
## Problem
PyTorch nightly built for CUDA 13.2 (`cu132`) fails on Jetson Orin running JetPack 6.2.2,
because the bundled NVIDIA driver (540.5.0) only supports up to CUDA 12.6:
```
RuntimeError: The NVIDIA driver on your system is too old (found version 12060).
```
## System Info
| Component | Version |
|------------------|--------------------------------|
| Board | NVIDIA Jetson Orin |
| JetPack | 6.2.2 (L4T R36.5.0) |
| Kernel | 5.15.185-tegra |
| NVIDIA Driver | 540.5.0 |
| System CUDA | 12.6 |
| OS | Ubuntu 22.04.5 LTS (aarch64) |
| PyTorch | 2.12.0.dev20260321+cu132 |
| Python | 3.10.12 |
## Solution: CUDA Forward Compatibility (cuda-compat-orin-13-2)
CUDA 13.2 introduced unified SBSA toolkit support for Jetson Orin. NVIDIA provides a
**CUDA Forward Compatibility** package (`cuda-compat-orin-13-2`) that supplies user-mode
CUDA 13.2 driver libraries that run on top of the existing JetPack 6 kernel driver.
No kernel driver update or JetPack reflash is required.
Reference: [CUDA 13.2 Blog Post](https://developer.nvidia.com/blog/cuda-13-2-introduces-enhanced-cuda-tile-support-and-new-python-features/)
## Installation Steps
### 1. Download the compatibility package
```bash
mkdir -p ~/cuda-compat-orin && cd ~/cuda-compat-orin
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/cuda-compat-orin-13-2_13.2.44290101-1_arm64.deb \
-O cuda-compat-orin-13-2.deb
```
### 2. Extract without root
No `sudo` required — just extract the `.deb` to a local directory:
```bash
dpkg-deb -x cuda-compat-orin-13-2.deb extracted/
```
The compat libraries will be at:
```
~/cuda-compat-orin/extracted/usr/local/cuda-13.2/compat_orin/
```
Key files:
```
libcuda.so -> libcuda.so.1 -> libcuda.so.1.1 (CUDA 13.2 user-mode driver)
libnvidia-ptxjitcompiler.so (PTX JIT compiler)
libnvidia-gpucomp.so (GPU compute library)
libnvidia-nvvm.so (NVVM compiler)
libcudadebugger.so.1 (debugger support)
```
### 3. Set LD_LIBRARY_PATH
Prepend the compat library path so it takes priority over the system's CUDA 12.6 `libcuda.so`:
```bash
export LD_LIBRARY_PATH=/home/nvidia/cuda-compat-orin/extracted/usr/local/cuda-13.2/compat_orin${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}
```
### 4. Make it persistent (optional)
Add to `~/.bashrc`:
```bash
echo 'export LD_LIBRARY_PATH=/home/nvidia/cuda-compat-orin/extracted/usr/local/cuda-13.2/compat_orin${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}' >> ~/.bashrc
```
Or add to the venv activate script:
```bash
echo 'export LD_LIBRARY_PATH=/home/nvidia/cuda-compat-orin/extracted/usr/local/cuda-13.2/compat_orin${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}' >> ~/Projects/pytorch/.torch/bin/activate
```
## Verification
```bash
source ~/Projects/pytorch/.torch/bin/activate
python3
```
```python
import torch
print(torch.cuda.is_available()) # True
print(torch.cuda.get_device_name(0)) # Orin
x = torch.randn(3, 3, device='cuda')
print(x) # tensor([...], device='cuda:0')
```
## Known Warning: Compute Capability 8.7
```
UserWarning: Found GPU0 Orin which is of compute capability (CC) 8.7.
...
- 8.0 which supports hardware CC >=8.0,<9.0 except {8.7}
```
This PyTorch nightly was built with `sm_80` PTX but explicitly excludes CC 8.7 (Orin).
Kernels still run via **PTX JIT compilation** — functionally correct but with:
- One-time JIT compilation latency on first kernel launch
- Potentially suboptimal codegen (no Orin-specific tuning)
To fully resolve this, build PyTorch from source with:
```bash
export TORCH_CUDA_ARCH_LIST="8.7"
```
To suppress the warning at runtime:
```python
import warnings
warnings.filterwarnings("ignore", message=".*Found GPU.*compute capability.*")
```
## Alternative: Install system-wide with sudo
If you have root access, you can install the package properly:
```bash
wget https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/cuda-archive-keyring.gpg
sudo cp cuda-archive-keyring.gpg /usr/share/keyrings/
echo "deb [signed-by=/usr/share/keyrings/cuda-archive-keyring.gpg arch=arm64] https://developer.download.nvidia.com/compute/cuda/repos/ubuntu2204/sbsa/ /" \
| sudo tee /etc/apt/sources.list.d/cuda-sbsa.list
sudo apt update
sudo apt install cuda-compat-orin-13-2
```
This installs to `/usr/local/cuda-13.2/compat_orin/` and may configure the library
path automatically.