LXD and NVIDIA GPUs

preview_player
Показать описание
GPUs are used for far more than rendering a desktop environment and playing games these days. So let's look at how they can be used within LXD containers and virtual machines for workloads like AI/ML, video encoding/decoding or rendering tasks.

COMMANDS:
- lxc config device add u1 gpu gpu gputype=physical
- lxc config device add v1 gpu0 gpu gputype=physical pci=0000:04:00.0
- lxc config device add v1 gpu1 gpu gputype=physical pci=0000:82:00.0

TIMESTAMPS:
0:00 Introduction
5:14 Passing GPUs to containers
9:00 Passing GPUs to virtual machines
19:15 Conclusion

RESOURCES:
Рекомендации по теме
Комментарии
Автор

thank you for sharing, when you add a host PCI device (a GPU) to a lxd virtual machine is it still able to share its system memory (RAM, not VRAM) with the host? On kvm the moment you passthrough a GPU memballoon stops working.

danielkrajnik
Автор

Looking for a guide for Intel GPU passthrough and can't find one. If you have tried that a video would be greatly appreciated!

HeneryH
Автор

Hi. Is it possible to use LXD with GPU device for use with opengl and fbo for network rendering (visualisation on remote host) ?

lhusse
Автор

Do lxd vm containers utilize hyper v like WSL? I'd like to transition away from windows to linux but maintain a safe sandbox environment to execute developer code. I can even further isolate myself from exploits by using non systemd distros as well. WSL natively mounts all your external drives including your windows root drive automatically to implement tools like explorer.exe for ease of file transfer among other things. I found this quite disturbing for the sake of security considering my purpose for running a VM. Sure, you could unmount the drives via wsl.config however i feel uncomfortable about it. Also Im utilizing my GPU to run stable diffusion tools, so gpu passthrough is important, and so far LXD and WSL seem to be the easiest way accomplish this. So far im using WSL2 to run ubuntu with my gpu natively after installing ubuntu cuda drivers, and linking the cuda library to the correct paths. In docker there is a nvidia/cuda container that runs gpu natively but thats not using hyper V if im not mistaken. The question: would stable diffusion run on an LXD hypervisor VM the same way it would on WSL2? Is networking similar to WSL2 as well? When im running stable diffusion, i can access a webui from my host machine via the network bridge, however i can also disable the guest machines external internet access by ulinking the eth0 adapter. This prevents any public internet access until i enable the adapter, but i can still access the hosted lan webui from outside the machine. Is LXD similar in this way so i dont have to configure any NAT stuffs? :/. WSL2 just seems weird to me and im hoping LXD VM is more secure?

Infamanious
Автор

Can we use Tesla GPU as a consumer GPU for gaming in LXD, sir?

dungnguyentri
Автор

do these instructions remain valid if the OS within the container is Windows? I want to run 1 GPU and give it to my windows LXD container but hear that you have to make it invisible to linux or something...

hwynightkid
Автор

I used lxc before but it ask for remote add

ty_b__saiprasad