Hacker News new | ask | show | jobs
by mindcrash 33 days ago
incus config is your friend

There's a entire section about allocating GPUs to containers or VMs here: https://linuxcontainers.org/incus/docs/main/reference/device...

You can do the same with USB devices, NICs, infiniband adapters and whatever (as can be seen below and above the gpu part in the documentation)

For SR-IOV with VFs on a virtual machine the CLI command should look something like:

incus config device add <instance name> <device name> gpu gputype=sriov pci=<pci address>

https://linuxcontainers.org/incus/docs/main/reference/device...

But the possibility to just reroute a entire GPU to a virtual machine or container might be even more interesting:

incus config device add <instance name> <device name> gpu gputype=physical pci=<pci address>

https://linuxcontainers.org/incus/docs/main/reference/device...

Note that there's a possibility you'll need to play with the parameters a bit. All are mentioned in the docs.