Switching between GPU passthrough and vGPU
If you have already enabled GPU passthrough for the compute cluster but want to use vGPU instead, or vice versa, you will need to reconfigure the node with the physical GPU and the compute cluster.
Prerequisites
- The compute cluster is reconfigured for GPU passthrough or vGPU support, as described in Enabling PCI passthrough and vGPU support.
To reconfigure the compute cluster from GPU passthrough to vGPU support
-
On the node with the physical GPU, find out the service that is associated with the GPU. For example:
# systemctl | grep stub pcistub-0000:01:00.0.service loaded active exited Bind device to pci-stub driver
-
Disable this service. For example:
# systemctl disable pcistub-0000:01:00.0.service
-
Reboot the node to apply your changes:
# reboot
-
Modify the configuration file:
- Change the
device_type
fromgeneric
topgpu
- Specify the GPU's PCI address in
device
- Remove the
alias
field - Add the desired
vgpu_type
As a result, your configuration file
config.yaml
may look as follows:- node_id: c3b2321a-7c12-8456-42ce-8005ff937e12 devices: - device_type: pgpu device: "0000:01:00.0" vgpu_type: nvidia-224
- Change the
-
Pass the configuration file to the
vinfra service compute set
command. For example:# vinfra service compute set --pci-passthrough-config config.yaml
To reconfigure the compute cluster from vGPU support to GPU passthrough
-
Remove the vGPU-related information from the configuration file
config.yaml
. For example, you may need to remove these lines:- device_type: pgpu device: "0000:01:00.0" vgpu_type: nvidia-224
-
Reconfigure the compute cluster by using the updated configuration file
config.yaml
. For example:# vinfra service compute set --pci-passthrough-config config.yaml
-
On the node with the physical GPU, run the
pci-helper.py
script to assign thepci-stub
driver to the GPU at its PCI address. For example:# /usr/libexec/vstorage-ui-agent/bin/pci-helper.py bind-to-stub 0000:01:00.0
-
Add the GPU card to the configuration file as a generic device. For example:
- device_type: generic device: 1b36:0100 alias: gpu
-
Pass the configuration file to the
vinfra service compute set
command. For example:# vinfra service compute set --pci-passthrough-config config.yaml