How can I dedicate my second GPU to WSL2 containers while keeping the first for Windows gaming?

0
0
Asked By MellowPine47 On

I'm trying to use one Windows PC as an all-purpose machine that stays running 24/7. Windows will handle gaming and everyday tasks, while Docker containers inside WSL2 will run Frigate, Jellyfin, Home Assistant, and Immich. The system has an ASUS ROG Strix Z890-E motherboard, an Intel Core Ultra 5 250K, a 1TB Kingston NVMe boot drive, and a 1TB WD Black SN850X for WSL2 data. For now, it has two older ASUS Strix GTX 1070 Ti graphics cards. I want the GPU in slot 1 reserved for Windows and gaming, and the GPU in slot 2 reserved for the WSL2 containers. However, WSL2 detects both GPUs and appears to combine or expose them together. Even when I specify the UUID of the second card in my Docker Compose configuration, both GPUs are still available. Is there a way to make WSL2 expose only the second GPU without using Proxmox or Unraid?

1 Answer

Answered By CloudyRaccoon8 On

WSL2 doesn’t provide true PCI passthrough or a built-in way to hide one host GPU. It uses GPU paravirtualization through /dev/dxg, so WSL2 generally sees every compatible graphics adapter that Windows exposes. CUDA_VISIBLE_DEVICES can limit what CUDA-based applications use, but it doesn’t remove the other card from WSL2 entirely. Also, a GPU UUID in Compose may not affect applications such as Frigate or Jellyfin if they select hardware acceleration through VA-API, NVENC, or another device picker. You’ll likely need to select the correct device inside each container or application.

PixelHarbor62 -

For NVIDIA containers, you can try reserving the second card by its Docker device index, for example with `device_ids: ["1"]` under the NVIDIA GPU reservation. That limits the GPU resources assigned to that container, although the application itself may still need its own encoder or acceleration setting configured.

MellowPine47 -

Thanks, that clears up why the UUID setting wasn’t controlling every application.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.