To passthrough a gpu to an lxc container you don't need a tesla/quadro gpu...
It works with every GPU...
Here is an example with an normal nvidia consumer GPU:
1. Install the drivers on the host...
- best way is to install the drivers directly from nvidia, because the packaged drivers from apt doesn't include the nvidia uvm tools. You probably even don't need them, but they are useful to see if the container actually utilizes the GPU...
- you need for the ncidia drivers the kernel-headers of your kernel, gcc and make
- exanple: apt install pve-headers-5.15 gcc make
- then reboot and install the drivers and reboot again.
2.
Bash:
root@proxmox:~# ls -l /dev/nvidiactl
crw-rw-rw- 1 root root 195, 255 Jun 27 13:44 /dev/nvidiactl
root@proxmox:~# ls -l /dev/nvidia-uvm
crw-rw-rw- 1 root root 505, 0 Jun 27 13:44 /dev/nvidia-uvm
You see i have there 195 and 505...
You may have there sth different.
You have to change that below in the cgroup2 lines....
Shutdown the lxc container...
Add to your LXC config:
Bash:
lxc.cgroup2.devices.allow: c 195:* rwm
lxc.cgroup2.devices.allow: c 505:* rwm
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
Start the container/containers again...
Ssh into the container...
Install the same driver version as on the host, but this time with an argument:
./NVIDIA-Linux-x86_64-515.48.07.run --no-kernel-module
You may need to reboot the container and voila, it's done...
To check if it works, simply start sth on the container, idk, video encoding/Decoding whatever...
Ssh into the proxmox host again and execute: nvidia-smi
You will see there what container does what and how much % it utilizes the GPU....
For AMD cards this is similar, but you have to google an how-to...
Same for intel.
However, in short, passing an GPU to an LXC container is easy af. And you can pass the same GPU to as many containers as you want.
The only limit is, that nvidia for example restricts decoding/encoding etc only to 3-5 simultaneous threads.
Means 3-5 containers can access at the same time the GPU, depending on the card.
However passing a GPU to a VM is a whole different story.
To one VM, if it's a dedicated cards, that's easy af either.
One Card to multiple VM's = vGPU/MxGPU + it's buggy as hell, in short, forget it.
The only hope i see at all, if intel releases the arc graphic cards with proper SR-IOV.
Because SR-IOV is the only reliable perfectly working way to passthrough something to multiple VM's without to rely on broken drivers.
Cheers