Welcome toVigges Developer Community-Open, Learning,Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
3.8k views
in Technique[技术] by (71.8m points)

virtual machine - Is it possible to have different dev VM environments and access graphics card?

What I want to do on my laptop:

  1. Develop and Run on windows with Visual Studio (CUDA, TensorRT,...)
  2. Develop and Run on Linux (CUDA, TensorRT,...)
  3. Environment to edit videos, photoshop,...
  4. Play games
  5. Environment for general use (web browser, outlook, word,...)
  6. Environment to test applications
  7. Possibly connecting some external GPU to offload the work (cuda,...) from my laptop's graphics card. Since I'm new to this, I haven't researched enough to understand how it can be done. But, this is in my plans.

What I did and reaserched:

  • As a start, I created VM environements in my host Windows OS using VirtualBox for #1 and #2, but I cannot run inside VM, since it doesn't provide access to graphics card. Even if it did, I still need somehow to switch to a different environment when I want to play games for example.
  • I probably need hypervisor type 1 if I want to have environment to play games? But, in this case I'll need a second laptop to access it, right?

Is this even possible to do on one laptop (I have strong laptop with enough RAM and SSD)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

Graphics cards (GPU) are PCI devices, so they can be passed to VMs with PCI Passthrough. A device is not accessible to the host during passthrough. Hot plug can be used to reattach a graphics card to a different VM or the host without rebooting.

I don't know if a Windows host supports GPU passthrough (maybe you need Windows Server), but Linux host and Windows guest seems to work.

Setting this up is easier if you have a second GPU that remains attached to the host or another computer to control the host during GPU passthrough, for example via SSH.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to Vigges Developer Community for programmer and developer-Open, Learning and Share
...