Proxmox GPU Passthrough Guide (NVIDIA Tesla P4)#
1. Proxmox Host Configuration#
Pre-requisites#
- Ensure PCIe Bifurcation is set to OFF in the server BIOS.
Enable IOMMU#
- Open the GRUB configuration:
nano /etc/default/grub- Modify the line
GRUB_CMDLINE_LINUX_DEFAULT="quiet"to:
GRUB_CMDLINE_LINUX_DEFAULT="quiet intel_iommu=on"- Update GRUB:
update-grub- Reboot the host.
Verify IOMMU Status#
dmesg | grep -e DMAR -e IOMMUNote: Look for the line:
DMAR: IOMMU enabled.
2. VM Configuration (Ubuntu 24.04)#
VM Hardware Settings#
- Machine:
q35 - BIOS:
SeaBIOS - Note: Do NOT run
apt updateorupgradeyet.
Add PCIe Device#
- Shut down the VM.
- Go to Hardware > Add > PCI Device.
- Select Raw Device > Select your GPU.
- Ensure All Functions and PCI-Express are checked.
3. Driver Installation in VM#
Verify Hardware Detection#
lspci -vlspci -nnk | grep -iA2 nvidiaPrepare Build Environment#
Required for version 550+ drivers:
apt install build-essential -y# Verify version
gcc --version# Create GCC 13 symlink (Required fix)
ln -s -f /usr/bin/gcc-13 /usr/bin/gccrebootInstall NVIDIA Driver 550#
Note: Installation may pause at 81% for several minutes. This is normal.
apt install nvidia-driver-550 -yreboot4. Maintenance & Upgrades#
Upgrade Driver from 470 to 550#
apt-get purge nvidia-driver-470 -yln -s -f /usr/bin/gcc-13 /usr/bin/gccrebootapt install nvidia-driver-550 -yMonitoring Tools#
# Check version
cat /proc/driver/nvidia/version# Standard status
nvidia-smi# Visual monitor
apt install nvtop
nvtop# High-frequency watch (0.5s)
watch -n 0.5 nvidia-smi5. Performance & Reliability#
Enable Persistence Mode#
Eliminates “Cold Start” lag by keeping the driver loaded.
- Create the override directory:
mkdir -p /etc/systemd/system/nvidia-persistenced.service.d- Create the override file:
cat <<EOF > /etc/systemd/system/nvidia-persistenced.service.d/override.conf
[Service]
ExecStart=
ExecStart=/usr/bin/nvidia-persistenced --user nvidia-persistenced --persistence-mode
EOF- Apply settings:
systemctl daemon-reloadsystemctl restart nvidia-persistenced- Verify mode is enabled:
nvidia-smi -q | grep "Persistence Mode"6. Docker GPU Integration#
Install NVIDIA Container Toolkit#
curl -fsSL [https://nvidia.github.io/libnvidia-container/gpgkey](https://nvidia.github.io/libnvidia-container/gpgkey) | sudo gpg --dearmor -o /usr/share/keyrings/nvidia-container-toolkit-keyring.gpgcurl -s -L [https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list](https://nvidia.github.io/libnvidia-container/stable/deb/nvidia-container-toolkit.list) | \
sed 's#deb https://#deb [signed-by=/usr/share/keyrings/nvidia-container-toolkit-keyring.gpg] https://#g' | \
sudo tee /etc/apt/sources.list.d/nvidia-container-toolkit.listapt-get update && apt-get install -y nvidia-container-toolkitConfigure Docker Runtime#
nvidia-ctk runtime configure --runtime=dockersudo systemctl restart docker