canonical / multipass

Multipass orchestrates virtual Ubuntu instances
https://multipass.run
GNU General Public License v3.0
7.85k stars 650 forks source link

Support GPU passthrough #2503

Open maximehyh opened 2 years ago

maximehyh commented 2 years ago

Hello,

I am trying to deploy a container in microk8s in multipass on windows that will be using a Machine Learning model and hence will need access to the host GPU (Windows).

I know microk8s allows to have access to the host's GPU (https://microk8s.io/docs/addon-gpu) but as I am on windows microk8s's "host" is multipass and I wonder if multipass (Hyper V in my case) can have access to the actual host GPU (windows). A bit like what WSL is doing with CUDA https://docs.microsoft.com/en-us/windows/ai/directml/gpu-cuda-in-wsl.

I tried to find some documentation but nothing really relevant.

Have you had some previous use cases in the past and an easy way to make such a setup?

Thanks

Saviq commented 2 years ago

Hi @maximehyh basically what would have to happen is that Multipass would enable the exact same approach as WSL does.

On Hyper-V the only way to "give" (not share) a GPU to the VM is for it to be a DDA device.

Because DirectML is a Windows-only feature, we'd have to think hard how to put it into Multipass in a good way. macOS has no equivalent support, only Linux makes it relatively easy to either hand-off a GPU to the VM, or share it where possible.

maximehyh commented 2 years ago

Yes I guessed so. OK thanks I'll try to do it manually with Hyper V.

JYlag commented 2 years ago

Hi @Saviq, I just want to confirm...so there is a way to setup GPU passthrough via multipass?

If so, that is sufficient information and I can attempt to figure it out. Additionally if you do know, is there any specific documentation/resources you can point me to? Would be helpful but nonetheless your response is appreciated

townsend2010 commented 2 years ago

Hi @JYlag,

There is currently no way to pass through a GPU to Multipass created virtual machines.

JYlag commented 2 years ago

@townsend2010 Thanks for the confirmation!

godber commented 2 years ago

@townsend2010 does this include multipass on Ubuntu as well?