Hybridize NVIDIA vGPU Host and Guest drivers to retain the Host's CUDA capability.
Because NVIDIA's official vGPU KVM Host driver do not include CUDA and its required binary libraries, the Host cannot use CUDA — CUDA is only available inside VMs with the Guest driver installed.
In special cases, to retain CUDA capability on both the Host and the Guest, the two drivers can be "hybridized". Starting from the Guest driver, add, replace, or patch the necessary source code, scripts, and binary library files from the original Host driver to turn it into a Host driver that provides CUDA capability.
Note 1: In newer drivers the final (patch) version numbers may differ between Host and Guest, which can cause conflicts in some modules and driver versions. We need to patch the version strings embedded in the binaries of those modules so they match the driver version.
Note 2: Only perform hybridization on Host and Guest drivers of the same release; hybridizing mismatched versions may lead to unknown consequences. For example:
| vGPU Version | Host Driver Version | Guest Driver Version | Is Verified |
|---|---|---|---|
| 19.0 | 580.65.05 | 580.65.06 | ✅️ |
| 19.1 | 580.82.02 | 580.82.07 | ❓ |
| 19.2 | 580.95.02 | 580.95.05 | ❓ |
-
Download the NVIDIA vGPU Host and Guest drivers.
-
Unpack both drivers with command-line argument
-x. -
Run this scripts to hybridize the drivers:
uv sync uv run main.py --host /path/to/host-driver --guest /path/to/guest-driver -o /path/to/output
-
cd to
/path/to/output, run./nvidia-installer -m kernelto install the hybridized host driver. -
Run
nvidia-smito verify the hybridization.Driver Versionshould be the same as the Guest driver version, andCUDA Versionshould NOT beN/A.$ nvidia-smi Thu Oct 30 09:53:32 2025 +-----------------------------------------------------------------------------------------+ | NVIDIA-SMI 580.65.06 Driver Version: 580.65.06 CUDA Version: 13.0 | +-----------------------------------------+------------------------+----------------------+ | GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC | | Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. | | | | MIG M. | |=========================================+========================+======================| | 0 NVIDIA ... Off | 00000000:00:08.0 Off | 0 | | 0% ..C P0 ... / .... | .....MiB / .....MiB | 0% Default | | | | N/A | +-----------------------------------------+------------------------+----------------------+
-
Configure vGPU license according to NVIDIA official document.
-
Reboot.
-
Run
nvidia-smi -qto verify the status ofGPU Virtualization ModeandvGPU Software Licensed Product. e.g.:$ nvidia-smi -q ... GPU Virtualization Mode Virtualization Mode : Host VGPU Host VGPU Mode : SR-IOV vGPU Heterogeneous Mode : Disabled vGPU Software Licensed Product Product Name : NVIDIA RTX Virtual Workstation License Status : Licensed ...
- Make sure the host GPU is running in proper display mode. Some GPUs may not support vGPU in graphic mode.
./displaymodeselector --listgpumodes
./displaymodeselector --gpumode compute-
When using hybridized driver, some processes (like
nvidia-persistenced) may occupies the GPU and cause the vGPU creation failed to acquireunbindLock. Try to following the steps:- Use
lsof /dev/nvidia*to find processes that are occupying the GPU. - Terminate those processes.
- Run
cd /proc/driver/nvidia/gpus/0000\:xx\:00.0— note thatxxshould be replaced with the actual PCI address. - Run
echo 1 > unbindLockto write tounbindLock. - Run
cat unbindLockto confirm the value is1. - Repeat the above steps for GPUs at other PCI addresses to unlock
unbindLock.
References: Preparing a GPU Configured for vGPU for Use in Pass-Through Mode
- Use
-
We only tested vGPU creation via Vendor-Specific VFIO Framework by using hybridized driver on Ubuntu 24.04. See: Creating an NVIDIA vGPU on a Linux with KVM Hypervisor that Uses a Vendor-Specific VFIO Framework.
This project is licensed under the MIT License - see the LICENSE file for details.