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

To reconfigure the compute cluster from GPU passthrough to vGPU support

  1. 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
  2. Disable this service. For example:

    # systemctl disable pcistub-0000:01:00.0.service
  3. Reboot the node to apply your changes:

    # reboot
  4. Modify the configuration file:

    • Change the device_type from generic to pgpu
    • 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
  5. 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

  1. 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
  2. Reconfigure the compute cluster by using the updated configuration file config.yaml. For example:

    # vinfra service compute set --pci-passthrough-config config.yaml
  3. On the node with the physical GPU, run the pci-helper.py script to assign the pci-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
  4. Add the GPU card to the configuration file as a generic device. For example:

    - device_type: generic
      device: 1b36:0100
      alias: gpu
  5. Pass the configuration file to the vinfra service compute set command. For example:

    # vinfra service compute set --pci-passthrough-config config.yaml