Overview
ZStack Cloud supports the GPU (Graphics Processing Unit) virtualization feature, which divides physical GPUs (pGPUs) into multiple virtual GPUs (vGPUs) and forms a vGPU pool. You can quickly create lightweight vGPU VM instances based on vGPU specifications, achieving more flexible and scalable resource deployment, optimizing resource utilization, and saving costs. This feature is suitable for lightweight GPU computing scenarios such as cloud gaming, VDI, VR or AR, AI inference, and teaching machine learning.
| Vendor | Model |
|---|---|
| NVIDIA |
|
| AMD | FirePro S7150, FirePro S7150X2 |
| Vastai | SV100、SG100 |
Application Scenarios
Cloud Gaming
With the expansion of broadband networks and the widespread usage of mobile devices, a new trend in gaming has emerged where the computational load is shifted to the cloud, while the client merely handles display and control. In this model, cloud servers undertake the task of 3D game rendering. Combined with GPUs, these cloud servers can encode each frame instantly and stream it to any devices connected to the network.
Leveraging the GPU and server CPU capabilities, this cloud gaming model uses ZStack Cloud’s GPU virtualization feature to divide the pGPU into multiple vGPUs you need and pass them through to VM instances. It creates a virtual gaming environment with enhanced isolation and smooth computation and rendering, providing you with an improved gaming experience.

Virtual Desktop Infrastructure (VDI)
GPU has always been an integral part of Virtual Desktop Infrastructure (VDI), for it not only enhances visual experience, but also takes on a primary computational role in special applications, making it a good substitute for traditional PC graphics workstation. Also, GPU enables you to perform 3D designs in a safer environment.
Through the GPU virtualization feature provided by ZStack Cloud, you can divide pGPUs into multiple customized vGPU devices and pass them through to VM instances. Coupled with protocols such as RDP or PCoIP, you can leverage GPU capabilities while optimizing resource utilization. It enables smooth operation of 3D designs or games, providing you with the VDI experience as great as that in a physical environment.

Considerations
- One VM instance can attach only one vGPU at a time and does not support attaching both pGPUs and vGPUs at the same time.
- A passed-through pGPU cannot be virtualized into multiple vGPUs.
- To attach or detach vGPUs, ensure that the VM instance is in the stopped state.
- To virtualize an AMD pGPU requires the host kernel to be of the 3.10 version.
- To use the GPU virtualization feature and obtain real-time vGPU load monitoring
data, you need to install the GPU drivers on both the host and the VM instance.
The recommended versions for GPU drivers are as follows.
GPU Recommended Version for Host Recommended Version for VM Instance NVIDIA - GPU driver: NVIDIA-Linux-x86_64-510.47.03-grid.run
- vGPU driver: NVIDIA-Linux-x86_64-510.47.03-vgpu-kvm.run
For the latest version recommended by NVIDIA: See NVIDIA Official Documents AMD rocm-smi 6.1.2 and later versions rocm-smi 6.1.2 and above
Note: If the VM
instance uses the OS of RHEL7 series, make sure that the
VM kernel is of 4.18.0 or later versions.
Huawei Ascend-hdk-310p-npu-driver_24.1.rc1_linux-aarch64.run
Ascend-hdk-310p-npu-driver_24.1.rc1_linux-aarch64.run
Preparations
NVIDIA GPU Virtualization
- Ensure that the pGPU model supports virtualization.
- Ensure that the Intel VT-d/AMD IOMMU feature is enabled in the host BIOS, and that the host kernel has IOMMU support enabled.
- Ensure that SR-IOV and Memory Mapped I/O above 4GB are enabled in the host BIOS.
- Ensure that the pGPU driver, vGPU driver, and VM vGPU driver have been obtained. For more information about driver service or installation methods, please contact GPU device supplier. For recommended driver versions, see Considerations.
- For NVIDIA A series users, you have to ensure that your host kernel is upgraded to 4.18 version, and GCC to 8.3.1 version.
- To use NVIDIA vGPU software, see NVIDIA Official Documents. Note that you have to purchase the License, set up a License Server, and import the License in advance.
- Configure the global settings: Click . The following global settings are related to the pGPU
passthrough feature, you can adjust them as needed:
- PCI Hot-Plugging: Specifies whether to enable hot plugging of GPU devices for a VM instance. The default is true. If a hardware incompatibility error occurs during hot plugging or a hardware device does not support hot plugging, you can set this parameter to false.
- vGPU Default Quota: Specifies the number of GPU devices (including pGPUs and vGPUs) that an account or a project can use. The default is 20.
AMD GPU Virtualization
- Ensure that the pGPU model supports virtualization.
- Ensure that the Intel VT-d/AMD IOMMU feature is enabled in the host BIOS, and that the host kernel has IOMMU support enabled.
- Ensure that the host GPU driver and VM vGPU driver have been obtained. For more information about driver service or installation methods, please contact GPU device supplier. For recommended driver versions, see Considerations.
- Ensure that the advanced settings VM Instance Hypervisor is set to
false, otherwise the VM instance will fail to properly attach the AMD vGPU
driver. The advanced setting can be disabled through the following
methods:
- For a VM instance: Enter the details page of the VM instance and choose Advanced settings on the top row. Set VM Instance Hypervisor to false for this VM instance.
- For a cluster: Enter the details page of the cluster and choose Advanced settings on the top row. Set VM Instance Hypervisor to false for this cluster.
- For the platform: Click . Find VM Instance Hypervisor and set it to false for the entire platform.
- Set global settings as needed: Click . The following global settings are related to the pGPU
passthrough feature, you can adjust them as needed:
- PCI Hot-Plugging: Specifies whether to enable hot plugging of GPU devices for a VM instance. The default is true. If a hardware incompatibility error occurs during hot plugging or a hardware device does not support hot plugging, you can set this parameter to false.
- vGPU Default Quota: Specifies the quota of GPU devices (including pGPUs and vGPUs) that an account or a project can use. The default is 20.
Typical Scenarios
About this task
- Install GPU drivers and vGPU drivers on the host.
- Enable IOMMU in the host BIOS.
- Check pGPUs or pGPU specifications.
- Virtualize pGPUs.
- Check vGPUs or vGPU specifications.
- Attach vGPUs to the VM instance.
- Install vGPU drivers on the VM instance.
Before using the GPU virtualization feature, ensure that requirements in Preparations have been met completely and correctly. Below is detailed operational procedures for performing the virtualization:
Procedure
-
Install GPU drivers and vGPU drivers on the host.
After attaching a GPU device to the host, you need to install the corresponding driver to use it properly.
- NVIDIA: Both the GPU driver and the vGPU driver need to be installed. You can refer to the table Recommended GPU Driver and Click Here to download the appropriate official driver.
- AMD: The GPU driver need to be installed, while the vGPU driver is automatically generated by ZStack Cloud. You can refer to the table Recommended GPU Driver and Click Here to download the appropriate official driver.
- Huawei: The GPU driver specified in the table Recommended GPU Driver need to be installed. GPU monitoring and virtualizing both depend on this driver. Contact Huawei's official support to obtain it.
The procedures of installing the GPU driver vary depending on the version of your GPU device. For more information, you can contact GPU suppliers for assistance. This tutorial takes the installation of NVIDIA GPU driver on a host as an example. You can refer to the operational procedures below:- Obtain the required GPU driver installation package.
- Install the kernel-devel package matching the kernel version, along with gcc, make, and other required packages.
- Run the
rpm -i ${GPUDRIVERPACKETNAME}command to install the driver on the host. - Reboot the host and run the
nvidia-smicommand to check the GPU information. If the host successfully detects the GPU device, the GPU driver has been successfully installed on the host.
-
Enable IOMMU in the host BIOS.
Make sure that Intel VT-d or AMD IOMMU is enabled in the host BIOS before you enable the IOMMU option on ZStack Cloud.
- For adding host: Choose , set Scan Host IOMMU Setting to true to enable IOMMU.
Figure 3. Add Host and Enable IOMMU .png)
- For added host: Select one added host and set IOMMU State to
true on its details page. Reboot the host and the IOMMU setting will
take effect.
Figure 4. Enable IOMMU for Added host .png)
Note: After enabling the IOMMU setting on the
host, you also need to ensure that IOMMU Status on the same page
is available. Otherwise, the GPU virtualization feature cannot work as
expected. If IOMMU State is enabled, yet the IOMMU Status
is unavailable, the reason could be as follows: - The IOMMU setting is enabled but the host is not rebooted. Just reboot the host.
- If a host configuration error occurs, please enter the host BIOS and enable Intel VT-d or AMD IOMMU.
- For adding host: Choose , set Scan Host IOMMU Setting to true to enable IOMMU.
-
Check pGPUs or pGPU Specifications.
When the IOMMU state is enabled, and the IOMMU status is available, ZStack Cloud can detect the pGPU and its specifications on the host.
- Check pGPUs: On the host details page, select one added host and choose to check the pGPU devices detected on this host.
- Check pGPU specifications:
On the main menu of ZStack Cloud, choose . On the GPU Specification page, check the scanned pGPU specifications.
-
Virtualize pGPUs.
Virtualizing pGPUs means dividing the pGPUs unallocated for passthrough into multiple specified vGPUs. Methods for pGPU virtualization vary slightly depending on GPU manufacturers. Currently, ZStack Cloud supports the virtualization of NVIDIA pGPUs and AMD pGPUs.
- Virtualize NVIDIA pGPUs: Supports virtualizing NVIDIA pGPUs
according to the selected specifications.
On the host details page, select one added host and choose . You have to select a virtualizable pGPU and click . The same is true of virtualizing AMD pGPUs.
The virtualization specification lists all the specifications this pGPU can be virtualized into. For example: GRID M60-2A(4ins-2048 MiB-1280*1024) implies that a core pGPU is virtualized into 4 vGPUs with a frame rate of 60FPS, graphics memory of 2048MB, and a resolution of 1280*1024.
Note: If you need to restore the vGPU to a pGPU,
click . To restore the NVIDIA vGPU, ensure that all
the vGPUs related to this pGPU have been detached from the
VM instance. - Virtualize AMD pGPUs: Not only supports virtualizing AMD pGPUs
according to the selected number, but also supports virtualizing all
the AMD pGPUs on the host at the same time.
Note: If you need to restore the vGPU to a pGPU, click . Before restoring the AMD vGPU, ensure that all
AMD vGPUs related to the current AMD graphics card have been
detached from the VM instance.
- Virtualize NVIDIA pGPUs: Supports virtualizing NVIDIA pGPUs
according to the selected specifications.
-
Check vGPUs or vGPU specifications.
Once the virtualization is completed, vGPUs and vGPU specifications will present themselves. You can check them on the corresponding page.
- Check vGPUs:
On the host details page, select one added host and choose to check the vGPU devices on the host.
- Check vGPU specifications:
On the main menu of ZStack Cloud, choose to check the vGPU specifications.
- Check vGPUs:
-
Attach vGPUs to the VM instance.
On ZStack Cloud, you can use the following methods to attach vGPUs to the VM instance:
- Method 1: Create a VM instance and attach vGPUs to ItTo create a VM instance, you need to choose . After you complete Basic Configuration, you come to next stage, that is, Resource Configurations. We support two GPU attachment policies including attaching GPU specification and attaching GPU device. Set the following parameters as you need:
- Attach GPU Specification: Select a vGPU
specification and the system allocates vGPU device(s) to
the VM instance according to this specification. You can
choose whether to make these vGPU device(s)
automatically detached when the VM is stopped. If you
set Auto Detach to true, these vGPU device(s)
would be automatically detached when the VM is stopped.
When the VM restarts, the system re-allocates vGPU
device(s) to it according to the GPU specification. If
you set Auto Detach to false, the VM would keep
these vGPU devices attached and continue using them when
it restarts.
Note: if the VM is stopped unexpectedly when
Auto Detach is set to false, it cannot
automatically start even though its HA mode is
NeverStop. - Attach GPU Device: Select a vGPU device and attach it directly to the VM instance.
- Attach GPU Specification: Select a vGPU
specification and the system allocates vGPU device(s) to
the VM instance according to this specification. You can
choose whether to make these vGPU device(s)
automatically detached when the VM is stopped. If you
set Auto Detach to true, these vGPU device(s)
would be automatically detached when the VM is stopped.
When the VM restarts, the system re-allocates vGPU
device(s) to it according to the GPU specification. If
you set Auto Detach to false, the VM would keep
these vGPU devices attached and continue using them when
it restarts.
- Method 2: Attach vGPUs to an Existing VM Instance
On the main menu of ZStack Cloud, choose . On the VM Instance page, click the name of an existing VM instance to enter its details page. Choose Configuration info on the top row. Find vGPU Device on this page and click Attach.
- One VM instance can attach only one vGPU at a time and does not support attaching both pGPUs and vGPUs at the same time.
- If you want to detach a GPU device, select it and click .
- To attach or detach vGPUs, ensure that the VM instance is in the Stopped state.
- Method 3: Attach vGPUs to Existing VM Instances
Select one or more stopped VM instances in the management interface of VM Instance, and click . Then you have two options to choose, that is, attach GPU specification or attach GPU device.
- Method 1: Create a VM instance and attach vGPUs to It
-
Install vGPU drivers on the VM instance
After attaching a GPU device to the VM instance, you need to install corresponding GPU drivers. The procedures of installing the vGPU driver vary depending on the version of your vGPU. For more information, you can contact GPU suppliers for assistance. This chapter takes installing a NVIDA GPU on the Linux VM instance as an example. You can refer to the operational procedures below:
- Obtain the related driver installation files:
Obtain the driver and CUDA toolkit compatible with the GPU device.
- Disable the Nouveau driver:If NVIDIA drivers conflict with the Nouveau kernel driver, you can run the command
lsmod | grep nouveauto check whether the Nouveau driver has been installed. If the output data suggests the Nouveau driver has been installed, you can perform the following operations to disable it. If no output is displayed, just skip this procedure.# touch /etc/modprobe.d/nvidia-installer-disable-nouveau.conf # Create a file and save the two lines below into it blacklist nouveau options nouveau modeset=0 - Install the gcc, kernel-devel, and kernel-headers files:Run the following commands to install the gcc, kernel-devel, and kernel-headers files and ensure that these kernel source files are of the same version. We recommend using the same version of ISO to configure local installations.
# yum install gcc kernel-devel-$(uname -r) kernel-headers-$(uname -r) # Reconstruct initramfs image # cp /boot/initramfs-$(uname -r).img /boot/initramfs-$(uname -r).img.bak # dracut /boot/initramfs-$(uname -r).img $(uname -r) --force # Only reboot the VM in the text mode # systemctl set-default multi-user.target # init 3 # reboot # lsmod | grep nouveau # After the VM instance is rebooted, check whether the nouveau driver is used or not - Install an NVIDIA Driver:Upload the downloaded package to the VM instance and run the following commands to install the driver.
After you run the commands, the driver package will begin to unpack and you can follow the installation instructions. During the installation, some warnings may appear. Confirm these warnings in sequence as they do not have any real impact. If some errors occur, please refer to the table below to check the environment.# chmod +x NVIDIA-Linux-x86_64-346.47.run # Configure executable permissions # ./NVIDIA-Linux-x86_64-346.47.run # Execute the driver scriptError Message Solution ERROR: Unable to find the kernel source tree for the currently running kernel. Please make sure you have installed the kernel source files for your kernel and that they are properly configured; on Red Hat Linux systems, for example, be sure you have the 'kernel-source' or 'kernel-devel' RPM installed. If you know the correct kernel source files are installed, you may specify the kernel source path with the '--kernel-source-path' command line option.
You need to have all of the kernel source files (including kernel, kernel-headers, and kernel-devel) installed and ensure that they are of the same version ERROR: The Nouveau kernel driver is currently in use by your system. This driver is incompatible with the NVIDIA driver, and must be disabled before proceeding. Please consult the ow to correctly disable the Nouveau kernel driver.
You have to disable the Nouveau kernel driver ERROR: Failed to find dkms on the system!
ERROR: Failed to install the kernel module through DKMS. No kernel module was installed; please try installing again without DKMS, or check the DKMS logs for more information.
You need to install DKMS, which helps maintain out-of-tree drivers by automatically regenerating new modules when the kernel version changes ERROR: Unable to load the kernel module 'nvidia.ko'. This happens most frequently when this kernel module was built against the wrong or improperly configured kernel sources, with a version of gcc that differs from the one used to build the target kernel, or if a driver such as rivafb, nvidiafb, or nouveau is present and prevents the NVIDIA kernel module from obtaining ownership of the NVIDIA graphics device(s), or no NVIDIA GPU installed in this system is supported by this NVIDIA Linux graphics driver release.
Run the commands ./NVIDIA-Linux-x86_64-384.98.run --kernel-source-path=/usr/src/kernels/3.10.0-XXX.x86_64/ -k $(uname -r) - Check whether the installation is successful: Respectively run the following two commands to check whether the installation is successful. If GPU information such as model is displayed in the command output, the driver has been installed successfully.
# lspci |grep NVIDIA # nvidia-smi - Install the CUDA toolkit: Download CUDA Toolkit installation package and upload this package to the VM system. Run the following commands to execute the driver script:
# chmod +x cuda_8.0.61_375.26_linux.run #Set executable permission # ./cuda_8.0.61_375.26_linux.run #Run the driver fileDuring the installation, please set the following parameters:
Figure 5. Install CUDA Toolkit 
- Configure environment variables:Run the
vim /root/.bashrccommand and save the content below to the same file:#gpu driver export CUDA_HOME=/usr/local/cuda-8.0 export PATH=/usr/local/cuda-8.0/bin:$PATH export LD_LIBRARY_PATH=/usr/local/cuda-8.0/lib64:$LD_LIBRARY_PATH export LD_LIBRARY_PATH="/usr/local/cuda-8.0/lib:${LD_LIBRARY_PATH}"Environment variables will take effect once added. To verify the effect, you can run the following commands:# source ~/.bashrc # cd /usr/local/cuda-8.0/samples/1_Utilities/deviceQuery # make # ./deviceQuery
- Obtain the related driver installation files:
