Sunday, 10 February 2019

ubuntu - Use host CUDA from VirtualBox?


Problem


I would like to use my host dGPU to train some neural networks using its CUDA cores via my Ubuntu 16.04 guest in Oracle VM VirtualBox version 5.2.22. Would it be possible to do this?


Host setup:


Windows 10.0.17763.195 (1809) Pro x64
Intel i7-6700HQ (Intel HD Graphics 530)
NVIDIA GeForce GTX 960M (CUDA Cores 640) via PCI Express x16 Gen3, DirectX v12.0 (FL 11.0)
Virtualization is Supported, Enabled via UFEI and OS

Guest setup:


Ubuntu 16.04
Chipset PIIX3 with Enabled I/O APIC
Processor has enabled PAE/NX
VT-X and AMD-V are Supported, Enabled
Nested Paging, Enabled
3D Acceleration Enabled
Extension Pack is installed

enter image description here


Note: A previous question asked about using the windows 7 host's Nvidia GPU inside VirtualBox for gaming. This question is about a different setup, and purpose and is too old to be useful today. Another question asks about using a graphics card in VirtualBox but this is also an old question.



Answer



Upon much digging this is currently possible but only with limited configurations, specific host OSes, and the use of enterprise software.


Windows Server 2016 and above but with Hyper-V



  • This is only possible with Windows Server as the host and Hypervisor. It is not available with windows 10 pro as the host as stated in the question above.


Ubuntu 18.04 and above with Virtualbox



  • The guest and host have to both have a Linux kernel that has been compiled with IOMMU support, including DMA remapping, according to the virtualbox documentation. This is done by default in the latest version of Ubuntu.

  • The command find /sys | grep dmar and dmesg | grep IOMMU will tell you if the kernal has been compiled with IOMMU support. DMAR: IOMMU enabled is what you are looking for.


Windows 10 Pro but with VMware Workstation Pro 15 or VMware ESXi



  • VMware allows for a couple of ways for GPU passthrough or sharing with the guest VM systems. Again, VT-d or AMD IOMMU has to be enabled on the host.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...