GPU pass through in Proxmox using Pulumi

A practical guide to automating GPU passthrough with Proxmox and Pulumi

Madhan published on
2 min, 299 words

Banner

Setting up GPU passthrough in Proxmox using Infrastructure as Code (IaC) with Pulumi enables automated and reproducible VM deployments with direct GPU access.

Prerequisites

Before implementing GPU passthrough, ensure your system meets these requirements,

  • IOMMU/VT-d support, and

  • UEFI BIOS settings enabled.

Pulumi Implementation

Here’s the simplified version of how to implement GPU passthrough using Pulumi with Go language.

vm.VirtualMachineArgs{
    NodeName: pulumi.String("pve"),
    Bios:    pulumi.String("ovmf"),
    Machine: pulumi.String("q35"),
    Hostpcis: vm.VirtualMachineHostpciArray{
        vm.VirtualMachineHostpciArgs{
            Device: pulumi.String("hostpci0"),
            Pcie:   pulumi.Bool(true),
            Id:     pulumi.String("0000:17:00.0"), // Your GPU PCI ID
        },
    },
}

The code above demonstrates the essential configuration for GPU passthrough,

  • Use OVMF BIOS for UEFI support,

  • Q35 machine type for modern PCI Express support, and

  • Correct PCI ID for your GPU.

VM β€” Hardware config

To verify the GPU configurations run the following command sudo lshw -C display to show detailed information about the graphics card.

Graphics card details

Key Limitations of GPU Passthrough in Proxmox

  • Consumer grade GPU limited to one per virtual machine when using PCIe passthrough.

  • VMs must be shut down before switching GPU assignment

* * * *

Originally published on Medium

🌟 🌟 🌟 The source code for this blog post can be found here 🌟🌟🌟

GitHub - madhank93/pulumi-proxmox at main

Reference:

[1] https://www.pulumi.com/registry/packages/proxmoxve/

[2] https://registry.terraform.io/providers/bpg/proxmox/latest/docs/resources/virtual_environment_vm

[3] https://www.youtube.com/watch?v=_hOBAGKLQkI