Full details for this post at docs.nvidia.com/cuda/wsl-user-guide, this post expands links' instructions and distills just the essential commands without their about text.
Beta Channel (Recommended)
to Dev Channel
Receive updates for other Microsoft products when you update Windows
Get CUDA Driver
> download, install. Do this before below!dism.exe /online /enable-feature /featurename:Microsoft-Windows-Subsystem-Linux /all /norestart
dism.exe /online /enable-feature /featurename:VirtualMachinePlatform /all /norestart
wsl --set-default-version 2
curl https://get.docker.com | sh
distribution=$(. /etc/os-release;echo $ID$VERSION_ID)
curl -s -L https://nvidia.github.io/nvidia-docker/gpgkey | sudo apt-key add -
curl -s -L https://nvidia.github.io/nvidia-docker/$distribution/nvidia-docker.list | sudo tee /etc/apt/sources.list.d/nvidia-docker.list
curl -s -L https://nvidia.github.io/libnvidia-container/experimental/$distribution/libnvidia-container-experimental.list | sudo tee /etc/apt/sources.list.d/libnvidia-container-experimental.list
sudo apt-get update
sudo apt-get install -y nvidia-docker2
sudo usermod -aG docker $USER
/etc/docker/daemon.json
, add "default-runtime"
{ "runtimes": { "nvidia": { "path": "nvidia-container-runtime", "runtimeArgs": [] } }, "default-runtime": "nvidia" }
sudo service docker stop
sudo service docker start
docker run --gpus all nvcr.io/nvidia/k8s/cuda-sample:nbody nbody -gpu -benchmark
If it fails, eg Error: only 0 Devices available, 1 requested. Exiting.
:
"node-generic-resources": ["NVIDIA-GPU=0"]
to /etc/docker/daemon.json
| Details[Details]. Click for additional setup tweaks like making all RAM available, docker-compose with GPU, etc.
Long coding sessions lead to physical fatigue and mental fog. A walking desk keeps you alert and focused, preventing costly bugs and burnout.Stay focused and healthy during long coding sessions.Get the factsGet the facts