Use host CUDA from VirtualBox?

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.

This seems possible under Linux and there are detailed instructions for doing that.

Your CPU supports the required VT-d capability, and hopefully your (unspecified) motherboard as well. You also have two graphical adapters, so can afford to give up one to the VM (remembering that your other GPU is rather limited).

There are various articles on the subject which you will need to test, as I don't have the environment for it. The VM's chipset seems to need to be ICH9, although not mentioned in the tutorials. You might need to use the virtual manager that is named in each article.

Here are the references :

  • VirtualBox manual chapter 9 - PCI Passthrough

  • PCI passthrough via OVMF
    A pretty recent article from January 2019. The Open Virtual Machine Firmware (OVMF) is a project to enable UEFI support for virtual machines.

  • How to setup a gaming virtual machine with GPU passthrough (QEMU, KVM, libvirt, and VFIO)
    An older article from August 2015, but might be useful.

  • Use NVidia GPU from VirtualBox?
    An older post on our site from December 2015, but might be useful.


If the graphics card is not the principal one in your system, you can think about using PCI passthrough to the VM, so the guest OS can access it directly. Unfortunately it seems the VBox does not support this feature (read here), and I don't know if it is supported on other desktop virtualization software.

Anyway if your graphics card is also used by the Host OS, you cannot perform the PCI passthrough.

Update

It seems also other desktop virtualization software does not support PCI passthrough (the post I found seems recent enough)

  • Hyper-V in windows 10: read here
  • VMware workstation: read here