Skip to content

Instantly share code, notes, and snippets.

@work-on-code
Forked from tylinux/use_host_gpu_in_pve.md
Created February 4, 2024 16:18
Show Gist options
  • Save work-on-code/e887f60a94eb4c588275911aa25f52da to your computer and use it in GitHub Desktop.
Save work-on-code/e887f60a94eb4c588275911aa25f52da to your computer and use it in GitHub Desktop.
PVE 使用 宿主 GPU
  1. 在 PVE 中安装驱动: ./NVIDIA-Linux-x86_64-535.146.02.run
  2. 在 lxc 配置里允许使用 GPU:
lxc.cgroup2.devices.allow: a
lxc.cap.drop:
lxc.cgroup2.devices.allow: c 195:* rwm
lxc.cgroup2.devices.allow: c 506:* rwm
lxc.cgroup2.devices.allow: c 509:* rwm
lxc.mount.entry: /dev/nvidia0 dev/nvidia0 none bind,optional,create=file
lxc.mount.entry: /dev/nvidiactl dev/nvidiactl none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm dev/nvidia-uvm none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-uvm-tools dev/nvidia-uvm-tools none bind,optional,create=file
lxc.mount.entry: /dev/nvidia-modeset dev/nvidia-modeset none bind,optional,create=file
lxc.mount.entry: /dev/dri dev/dri none bind,optional,create=dir
  1. 在 lxc 的shell 中执行 ./NVIDIA-Linux-x86_64-535.146.02.run --no-kernel-modules -q -a -n -X -s

就可以了

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment