Use host CUDA from VirtualBox?












4















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.










share|improve this question





























    4















    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.










    share|improve this question



























      4












      4








      4


      1






      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.










      share|improve this question
















      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.







      ubuntu virtualbox virtual-machine gpu cuda






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Dec 29 '18 at 20:31







      Gabriel Fair

















      asked Dec 29 '18 at 20:13









      Gabriel FairGabriel Fair

      81841841




      81841841






















          3 Answers
          3






          active

          oldest

          votes


















          3














          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.






          share|improve this answer































            3





            +25









            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.







            share|improve this answer

































              2














              If the graphic card is not the principal in your system you can think about use PCI passtrough to VM, like this the guest OS can access it directly. Unfortunately seems the VBox do not support this feature (read here), and I'm don't know if it is supported on other desktop virtualization software.



              Anyway if your graphic card is also used by the Host OS, you cannot perform the PCI passtrough



              Update



              It seems also other desktop virtualization software does not support PCI passtrough (post I find seems enough recent)




              • Hyper-v in windows 10: read here

              • Vmware workstation: read here






              share|improve this answer

























                Your Answer








                StackExchange.ready(function() {
                var channelOptions = {
                tags: "".split(" "),
                id: "3"
                };
                initTagRenderer("".split(" "), "".split(" "), channelOptions);

                StackExchange.using("externalEditor", function() {
                // Have to fire editor after snippets, if snippets enabled
                if (StackExchange.settings.snippets.snippetsEnabled) {
                StackExchange.using("snippets", function() {
                createEditor();
                });
                }
                else {
                createEditor();
                }
                });

                function createEditor() {
                StackExchange.prepareEditor({
                heartbeatType: 'answer',
                autoActivateHeartbeat: false,
                convertImagesToLinks: true,
                noModals: true,
                showLowRepImageUploadWarning: true,
                reputationToPostImages: 10,
                bindNavPrevention: true,
                postfix: "",
                imageUploader: {
                brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
                contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
                allowUrls: true
                },
                onDemand: true,
                discardSelector: ".discard-answer"
                ,immediatelyShowMarkdownHelp:true
                });


                }
                });














                draft saved

                draft discarded


















                StackExchange.ready(
                function () {
                StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388815%2fuse-host-cuda-from-virtualbox%23new-answer', 'question_page');
                }
                );

                Post as a guest















                Required, but never shown

























                3 Answers
                3






                active

                oldest

                votes








                3 Answers
                3






                active

                oldest

                votes









                active

                oldest

                votes






                active

                oldest

                votes









                3














                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.






                share|improve this answer




























                  3














                  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.






                  share|improve this answer


























                    3












                    3








                    3







                    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.






                    share|improve this 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.







                    share|improve this answer












                    share|improve this answer



                    share|improve this answer










                    answered Jan 8 at 20:53









                    Gabriel FairGabriel Fair

                    81841841




                    81841841

























                        3





                        +25









                        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.







                        share|improve this answer






























                          3





                          +25









                          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.







                          share|improve this answer




























                            3





                            +25







                            3





                            +25



                            3




                            +25





                            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.







                            share|improve this answer















                            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.








                            share|improve this answer














                            share|improve this answer



                            share|improve this answer








                            edited Jan 10 at 10:50

























                            answered Jan 9 at 18:03









                            harrymcharrymc

                            256k14268568




                            256k14268568























                                2














                                If the graphic card is not the principal in your system you can think about use PCI passtrough to VM, like this the guest OS can access it directly. Unfortunately seems the VBox do not support this feature (read here), and I'm don't know if it is supported on other desktop virtualization software.



                                Anyway if your graphic card is also used by the Host OS, you cannot perform the PCI passtrough



                                Update



                                It seems also other desktop virtualization software does not support PCI passtrough (post I find seems enough recent)




                                • Hyper-v in windows 10: read here

                                • Vmware workstation: read here






                                share|improve this answer






























                                  2














                                  If the graphic card is not the principal in your system you can think about use PCI passtrough to VM, like this the guest OS can access it directly. Unfortunately seems the VBox do not support this feature (read here), and I'm don't know if it is supported on other desktop virtualization software.



                                  Anyway if your graphic card is also used by the Host OS, you cannot perform the PCI passtrough



                                  Update



                                  It seems also other desktop virtualization software does not support PCI passtrough (post I find seems enough recent)




                                  • Hyper-v in windows 10: read here

                                  • Vmware workstation: read here






                                  share|improve this answer




























                                    2












                                    2








                                    2







                                    If the graphic card is not the principal in your system you can think about use PCI passtrough to VM, like this the guest OS can access it directly. Unfortunately seems the VBox do not support this feature (read here), and I'm don't know if it is supported on other desktop virtualization software.



                                    Anyway if your graphic card is also used by the Host OS, you cannot perform the PCI passtrough



                                    Update



                                    It seems also other desktop virtualization software does not support PCI passtrough (post I find seems enough recent)




                                    • Hyper-v in windows 10: read here

                                    • Vmware workstation: read here






                                    share|improve this answer















                                    If the graphic card is not the principal in your system you can think about use PCI passtrough to VM, like this the guest OS can access it directly. Unfortunately seems the VBox do not support this feature (read here), and I'm don't know if it is supported on other desktop virtualization software.



                                    Anyway if your graphic card is also used by the Host OS, you cannot perform the PCI passtrough



                                    Update



                                    It seems also other desktop virtualization software does not support PCI passtrough (post I find seems enough recent)




                                    • Hyper-v in windows 10: read here

                                    • Vmware workstation: read here







                                    share|improve this answer














                                    share|improve this answer



                                    share|improve this answer








                                    edited Jan 8 at 10:28

























                                    answered Jan 8 at 10:22









                                    AtomiX84AtomiX84

                                    4679




                                    4679






























                                        draft saved

                                        draft discarded




















































                                        Thanks for contributing an answer to Super User!


                                        • Please be sure to answer the question. Provide details and share your research!

                                        But avoid



                                        • Asking for help, clarification, or responding to other answers.

                                        • Making statements based on opinion; back them up with references or personal experience.


                                        To learn more, see our tips on writing great answers.




                                        draft saved


                                        draft discarded














                                        StackExchange.ready(
                                        function () {
                                        StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fsuperuser.com%2fquestions%2f1388815%2fuse-host-cuda-from-virtualbox%23new-answer', 'question_page');
                                        }
                                        );

                                        Post as a guest















                                        Required, but never shown





















































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown

































                                        Required, but never shown














                                        Required, but never shown












                                        Required, but never shown







                                        Required, but never shown







                                        Popular posts from this blog

                                        Plaza Victoria

                                        Brian Clough

                                        Cáceres