RUNLOCALAIv38
->Will it run?Best GPUCompareTroubleshootStartLearnPulseModelsHardwareToolsBench
Run check
RUNLOCALAI

Independently operated catalog for local-AI hardware and software. Hand-written verdicts. Source-cited claims. Reproducible commands when we have them.

OP·Eruo Fredoline
DIR
  • Models
  • Hardware
  • Tools
  • Benchmarks
TOOLS
  • Will it run?
  • Compare hardware
  • Cost vs cloud
  • Choose my GPU
  • Prompting kits
  • Quick answers
REF
  • All buyer guides
  • Learn local AI
  • Methodology
  • Glossary
  • Errors KB
  • Trust
EDITOR
  • About
  • Author
  • How we make money
  • Editorial policy
  • Contact
LEGAL
  • Privacy
  • Terms
  • Sitemap
MAIL · MONTHLY DIGEST
Get monthly local AI changes
Monthly recap. No spam.
DISCLOSURE

Some links on this site are affiliate links (Amazon Associates and other first-class retailers). When you buy through them, we earn a small commission at no extra cost to you. Affiliate links do not influence our verdicts — there are cards we rate highly that we don't have affiliate relationships with, and cards that sell well that we refuse to recommend. Read more →

© 2026 runlocalai.coIndependently operated
RUNLOCALAI · v38
  1. >
  2. Home
  3. /Learn
  4. /Courses
  5. /Local AI on Windows
  6. /Ch. 4
Local AI on Windows

04. NVIDIA CUDA Setup with WSL2

Chapter 4 of 15 · 20 min
KEY INSIGHT

WSL2 CUDA is not emulation—it is direct GPU access through the NVIDIA driver—but the WSL2 driver and Windows driver are separate packages with separate version numbers and separate update cycles.

WSL2 GPU passthrough requires the NVIDIA Driver for WSL, not the regular Windows display driver. These are separate installations with different version numbers. Download from nvidia.com/Download/index.aspx and select the "Data Center / Driver" category, then filter by "Linux, WSL-internal". The driver version must match or slightly precede the CUDA toolkit version you plan to install inside WSL2.

Install the driver on Windows. You do not need to enable WSL2 GPU scheduling in BIOS—the NVIDIA driver handles this. After installation, verify GPU access from WSL2:

nvidia-smi
# +-----------------------------------------------------------------------------+
# | NVIDIA-SMI 535.183.01  Driver Version: 536.67  CUDA Version: 12.2          |
# |-------------------------------+----------------------+----------------------+
# | GPU  Name        TCC/WinMode  Bus-Id     Disp.A |   Volatile Uncorr. ECC |
# |   0  NVIDIA GeForce ...  Normal  0000:01:00.0 Off |                  N/A |
# +-----------------------------------------------------------------------------+

If nvidia-smi returns "No devices were found", the WSL2 GPU driver is not loaded. Common causes: (1) you installed the wrong driver version—WSL2 and standard Windows drivers are different packages; (2) Secure Boot is blocking the NVIDIA kernel module; (3) WSL2 was not shut down after driver installation—run wsl --shutdown and retry.

Install CUDA toolkit inside WSL2:

# Add NVIDIA CUDA repository
wget https://developer.download.nvidia.com/compute/cuda/repos/wsl-ubuntu/x86_64/cuda-wsl-ubuntu.pin
sudo mv cuda-wsl-ubuntu.pin /etc/apt/preferences.d/cuda-repository-pin-600
wget https://developer.download.nvidia.com/compute/cuda/12.5.0/local_installers/cuda-repo-wsl-ubuntu-12-5-local_12.5.0-1_amd64.deb
sudo dpkg -i cuda-repo-wsl-ubuntu-12-5-local_12.5.0-1_amd64.deb
sudo cp /var/cuda-repo-wsl-ubuntu-12-5-local/cuda-*-keyring.gpg /usr/share/keyrings/
sudo apt-get update
sudo apt-get -y install cuda-toolkit-12-5

Add CUDA to your PATH:

echo 'export PATH=/usr/local/cuda-12.5/bin:$PATH' >> ~/.bashrc
echo 'export LD_LIBRARY_PATH=/usr/local/cuda-12.5/lib64:$LD_LIBRARY_PATH' >> ~/.bashrc
source ~/.bashrc

Verify with:

nvcc --version
# nvcc: NVIDIA (R) Cuda compiler driver
# Copyright (c) 2005-2024 NVIDIA Corporation
# Built (Tue May 14 15:54:45 2024)
# Cuda compilation tools, release 12.5, V12.5.82
EXERCISE

Run nvidia-smi and note the driver version and CUDA version. Run nvcc --version inside WSL2. Verify they are compatible on docs.nvidia.com/cuda/cuda-toolkit-release-notes. If they are not, downgrade or upgrade CUDA toolkit inside WSL2 to match the driver.

← Chapter 3
WSL2 Memory and Performance Tuning
Chapter 5 →
Docker Desktop for Windows