Jump to content
Search In
  • More options...
Find results that contain...
Find results in...
WereCatf

Sharing host-GPU with VM (qemu+kvm)

Recommended Posts

Posted · Original PosterOP

Can a host (Ubuntu, in this case) and a VM simultaneously utilize a consumer-grade GPU? If so, what is required? Intel iGPU? AMD iGPU? AMD discrete GPU? NVIDIA? Models with a specific feature?


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites

In my understanding you would need at least two GPUs, one for each system. If you want to give the VM access to all of the graphics cards features, you'd need to disconnect it from the host and connect it to the vm - no problem for a headless server, definitely a problem if you are using the local shell/gui of your host

Link to post
Share on other sites
33 minutes ago, WereCatf said:

Can a host (Ubuntu, in this case) and a VM simultaneously utilize a consumer-grade GPU? If so, what is required? Intel iGPU? AMD iGPU? AMD discrete GPU? NVIDIA? Models with a specific feature?

A few things, your hardware needs to support IOMMU (GPU passthrough/hardware acceleration) most systems built in the past few years support this.

You will take about a 10-20% perf, hit in the VM, but it is easily doable.

You only need 1 GFX card, just don't expect to use it on the host and VM at the same time.

 

This will help

https://blog.zerosector.io/2018/07/28/kvm-qemu-windows-10-gpu-passthrough/

as will this

 

https://davidyat.es/2016/09/08/gpu-passthrough/

 


So rise up, all ye lost ones, as one, we'll claw the clouds

Link to post
Share on other sites
Posted · Original PosterOP
5 minutes ago, Radium_Angel said:

just don't expect to use it on the host and VM at the same time

Then that's not an answer to my question. I did specifically use the word "simultaneously" there.


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites
Posted · Original PosterOP
15 minutes ago, ThaNino said:

In my understanding you would need at least two GPUs, one for each system. If you want to give the VM access to all of the graphics cards features, you'd need to disconnect it from the host and connect it to the vm - no problem for a headless server, definitely a problem if you are using the local shell/gui of your host

Yeah, I know how to do that, but I seem to recall having read something about being able to share a GPU between both of them simultaneously, but it's been over a year, so I don't remember the details and I figured I'd just ask here.


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites
16 minutes ago, WereCatf said:

Then that's not an answer to my question. I did specifically use the word "simultaneously" there.

Sorry, what I meant was if you're gaming on the VM, your performance on the host will be degraded. In other words, you can't game on both host and VM without significant performance loss.


So rise up, all ye lost ones, as one, we'll claw the clouds

Link to post
Share on other sites
Posted · Original PosterOP
3 minutes ago, Radium_Angel said:

Sorry, what I meant was if you're gaming on the VM, your performance on the host will be degraded. In other words, you can't game on both host and VM without significant performance loss.

I think you're still misunderstanding my question. Both of those links you gave have two GPUs -- an iGPU for the host and a separate GPU for the VM -- and they just passthrough the separate GPU, but that just is not what I asked for.


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites

You cannot share a single GPU to multiple VM's without driver support from Nvidia Grid or AMD mxGPU.  You would need a card which has support for these drivers which are enterprise/DC grade equipment.  They are very expensive and it is doubtful you can get one for cheap.

If you are using consumer grade equipment, they won't function with Grid or mxGPU drivers.


Please quote or tag me if you need a reply

Link to post
Share on other sites
34 minutes ago, WereCatf said:

I think you're still misunderstanding my question. Both of those links you gave have two GPUs -- an iGPU for the host and a separate GPU for the VM -- and they just passthrough the separate GPU, but that just is not what I asked for.

Yes, you can use a single GPU. I do it all the time. I have a GTX 660. Only video card in my system. My main OS is Windows, and my VM (single VM) is Ubuntu. I pass the GFX through to play a game, or use GPU-acceleration applications. While I am doing that, my main OS will suffer a performance loss if I try to use the GFX card for anything.

 

If that is not what you are asking, then explain further because I do not understand what you are trying to accomplish.


So rise up, all ye lost ones, as one, we'll claw the clouds

Link to post
Share on other sites
Posted · Original PosterOP
4 minutes ago, Falconevo said:

You cannot share a single GPU to multiple VM's without driver support from Nvidia Grid or AMD mxGPU.  You would need a card which has support for these drivers which are enterprise/DC grade equipment.  They are very expensive and it is doubtful you can get one for cheap.

If you are using consumer grade equipment, they won't function with Grid of mxGPU drivers.

Yeah, that's what I was afraid would be the answer. Would've been nice if there was a way of doing it on consumer-grade stuff.


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites
Posted · Original PosterOP
3 minutes ago, Radium_Angel said:

Yes, you can use a single GPU. I do it all the time. I have a GTX 660. Only video card in my system. My main OS is Windows, and my VM (single VM) is Ubuntu. I pass the GFX through to play a game, or use GPU-acceleration applications. While I am doing that, my main OS will suffer a performance loss if I try to use the GFX card for anything.

All the guides for GPU-passthrough tell you to disable both Nouveau and the proprietary NVIDIA-drivers on the host, so how do you use the GPU on the host with no drivers?


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites
Just now, WereCatf said:

Yeah, that's what I was afraid would be the answer. Would've been nice if there was a way of doing it on consumer-grade stuff.

Yea, it isn't available (yet) it may come in time but both manufacturers have spent a bucket load of cash on driver support and functionality.

Also don't be tempted to buy any Nvidia Grid cards second hand, they have an additional licensing requirement which makes them completely useless.

Also the cards that have this type of support generally have no display output on the card so it makes them next to useless for anything other than vGPU functionality.  I use a lot of Nvidia Grid in my day to day work and currently in testing of mxGPU to see if the commercials fit.  It would be nice if this technology filtered down to consumer grade but I wouldn't expect it for 5+ years.


Please quote or tag me if you need a reply

Link to post
Share on other sites
21 minutes ago, WereCatf said:

All the guides for GPU-passthrough tell you to disable both Nouveau and the proprietary NVIDIA-drivers on the host, so how do you use the GPU on the host with no drivers?

Software acceleration. Not ideal, but it does work.

 

What are you trying to accomplish? Perhaps telling us that might be able to point you in a better direction.

 


So rise up, all ye lost ones, as one, we'll claw the clouds

Link to post
Share on other sites
Posted · Original PosterOP
16 minutes ago, Radium_Angel said:

Software acceleration.

So you're NOT doing what I asked.


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites
2 hours ago, WereCatf said:

Can a host (Ubuntu, in this case) and a VM simultaneously utilize a consumer-grade GPU?

Sigh.

All you asked for was that. You never said hardware acceleration for both.


So rise up, all ye lost ones, as one, we'll claw the clouds

Link to post
Share on other sites
Posted · Original PosterOP
3 minutes ago, Radium_Angel said:

Sigh.

All you asked for was that. You never said hardware acceleration for both.

Look at the first post, you'll find a word "simultaneously" there. That word means exactly that, both of them being able to use the GPU at the same time.


Hand, n. A singular instrument worn at the end of the human arm and commonly thrust into somebody’s pocket.

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now


×