Skip to content

GPU configuration

LabPod supports three GPU allocation modes. You configure each mode per physical GPU from the admin Resources page using Allocation mode on each GPU card.

Whole GPU (Container Device Interface, CDI)

Section titled “Whole GPU (Container Device Interface, CDI)”

Each workspace that requests a GPU gets one full physical GPU. No sharing - one workspace per GPU at a time.

Prerequisites:

  1. A working NVIDIA driver installed and nvidia-smi working.
  2. nvidia-container-toolkit installed (the install script does this).
  3. A Container Device Interface (CDI) spec at /etc/cdi/nvidia.yaml (the script generates it via nvidia-ctk cdi generate).

If a Podman 4.x host reports unresolvable CDI devices with NVIDIA Container Toolkit 1.19.1 or newer, rerun the current installer to regenerate a readable device spec. It also keeps automatic CDI refresh compatible until you upgrade Podman. See Install.

Admin policy: Set the GPU policy to whole on the Resources page, or leave it on auto (no admin restriction - the researcher’s own workspace-creation choice decides whole vs. fractional vs. MIG).

When a workspace is started with GPU mode = Whole GPU, LabPod passes --device nvidia.com/gpu=<index> to Podman. The workspace sees the full GPU.

Multiple workspaces share a single physical GPU concurrently. Each workspace declares how much GPU memory and compute it needs; the server tracks allocations and refuses new workspaces that would exceed the physical GPU’s capacity.

Prerequisites:

Fractional GPU is off by default — the core install does not build the sharing library. A GPU sharing runtime library (libvgpu.so) must be present on the host. The supported way to build and install it is the public installer, which compiles HAMi-core inside a Podman container (no host build tools required), defaults to /opt/labpod/lib/libvgpu.so on a new installation, and sets LABPOD_GPU_SHARING_LIB_PATH to that path for you:

Terminal window
curl -fsSL https://labpod.ai/install.sh | sudo bash -s -- --with-hami
Terminal window
# Run these as root
curl -fsSL https://labpod.ai/install.sh | bash -s -- --with-hami

The build pulls a ~3.3 GB CUDA image; it is a one-time, build-time cost you can reclaim with podman image rm afterward. It needs a CUDA 12.x driver (one whose nvidia-smi reports CUDA 12.0 or later). On drivers that report a version older than 12.5, such as the 535 branch, the build uses CUDA 12.5 headers automatically; the library still uses the installed driver at run time. An older driver is rejected before any image is downloaded.

The installer’s GPU-sharing hint appears only when the NVIDIA driver works and no sharing library is configured, so CPU-only hosts do not see it.

To use a library you built or obtained elsewhere, point LabPod at it directly:

Terminal window
# In /etc/labpod/labpod.env:
LABPOD_GPU_SHARING_LIB_PATH=/path/to/libvgpu.so

The server refuses to start with this variable set if the file doesn’t exist. Upgrading LabPod keeps an existing library where it is; an installation that used the earlier default /usr/local/lib/libvgpu.so continues to use it. Reinstalling the library also honors the recorded installation destination unless you explicitly override it.

LabPod GPU hosts require a working NVIDIA driver and nvidia-smi.

Admin policy: Set the GPU policy for the target GPU to Fractional on the Resources page.

User workspace creation: The user selects GPU mode = Fractional GPU, then sets the memory (MB) and compute percentage they need. The server checks that the sum across all running workspaces on that GPU stays within physical limits.

For GPU sharing, a plain doctor run only confirms that the configured library file exists. It does not load the library, so it reports the runtime as unverified:

Terminal window
sudo labpod admin doctor
# Look for: GPU sharing: warn: HAMi library present (path=...; runtime unverified; use doctor --hami-runtime)
Terminal window
# Run these as root
labpod admin doctor
# Look for: GPU sharing: warn: HAMi library present (path=...; runtime unverified; use doctor --hami-runtime)

To check that GPU sharing actually enforces limits, run the explicit runtime test after installing the library and again after a driver or library change. Choose a GPU by UUID and a trusted image that already exists in the selected account’s own image store and contains Python 3 and compatible glibc; the test never downloads images.

First, list GPUs on the host with nvidia-smi -L. Copy the full GPU-... value after UUID: for the GPU you want to check into --hami-gpu below. The output shown here uses placeholders:

Terminal window
nvidia-smi -L
# GPU 0: <GPU model> (UUID: GPU-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx)
Terminal window
sudo labpod admin doctor --hami-runtime \
--hami-image docker.io/library/python:3.11-slim \
--hami-gpu GPU-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
--hami-user alice
Terminal window
# Run these as root
labpod admin doctor --hami-runtime \
--hami-image docker.io/library/python:3.11-slim \
--hami-gpu GPU-xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx \
--hami-user alice

This mode runs only the GPU-sharing diagnostic, without the general doctor checks. Run as root, name the regular Linux account with --hami-user; a regular user can test only their own account. The test starts short-lived rootless containers on the selected GPU without network or workspace mounts, runs a CUDA kernel, and checks that a 512 MiB memory cap is enforced, then removes the containers. It does not change existing workspaces or reserve the GPU, so run it during an idle maintenance window. Success reads HAMi runtime: verified (...); a failed or inconclusive test, or a cleanup failure, returns a nonzero exit status.

Add --hami-compute to also check compute sharing with three competing processes limited to 20%, 30%, and 50%. The image must also expose the NVIDIA driver NVML library through CDI. The check saturates the selected GPU for about 1 minute (90-second diagnostic deadline, plus up to 15 seconds for cleanup). A pass covers the tested workload on that GPU, library, and image, not exact limits for every framework. After a driver upgrade, run the check again rather than rebuilding automatically.

NVIDIA Multi-Instance GPU (MIG) partitions a physical GPU into independent slices at the hardware level. LabPod reads the current slice inventory and assigns one slice per workspace.

Prerequisites:

  • An NVIDIA A100, H100, H200, or similar MIG-capable GPU.
  • MIG mode enabled and slices pre-configured by the operator using nvidia-smi:
Terminal window
(
set -euo pipefail
# Example: enable MIG mode and create slices on GPU 0
sudo nvidia-smi -i 0 -mig 1
sudo nvidia-smi mig -i 0 -cgi 1g.10gb,1g.10gb,2g.20gb -C
)
Terminal window
# Run these as root
(
set -euo pipefail
# Example: enable MIG mode and create slices on GPU 0
nvidia-smi -i 0 -mig 1
nvidia-smi mig -i 0 -cgi 1g.10gb,1g.10gb,2g.20gb -C
)

Admin policy: Set the GPU policy for the target GPU to mig. LabPod reads slices at startup and on demand; no extra variable is needed.

LabPod automatically reads MIG inventory with nvidia-smi -L when NVIDIA tooling is installed. New installations need no separate inventory-source setting.

The admin Resources page shows a warning when nvidia-smi detects GPU compute processes that don’t belong to any LabPod workspace. This usually means someone is running training directly on the host (outside any container), or a process remained after a workspace was deleted.

LabPod automatically enables this inspection when NVIDIA tooling is installed. New installations need no setting to enable it.

Bypass at admission time (not recommended):

Terminal window
LABPOD_ALLOW_GPU_DRIFT=1 # skip the untracked-usage gate for new workspaces

To free a held GPU:

Terminal window
nvidia-smi --query-compute-apps=pid,process_name,gpu_uuid --format=csv
Terminal window
sudo kill -TERM <pid>
Terminal window
# Run these as root
kill -TERM <pid>

If the process is still running after 30 seconds, force it to stop:

Terminal window
sudo kill -KILL <pid>
Terminal window
# Run these as root
kill -KILL <pid>
Terminal window
sudo labpod admin doctor
Terminal window
# Run these as root
labpod admin doctor

doctor checks that:

  • The fractional GPU sharing library file exists (if LABPOD_GPU_SHARING_LIB_PATH is set). Use the runtime test to confirm enforcement.
  • The GPU process inspector (nvidia-smi) is reachable for each enumerated GPU UUID.

For the full workstation preflight, use the install script’s --check mode.

LabPod automatically enumerates GPUs with nvidia-smi when NVIDIA tooling is installed and uses an empty GPU inventory on a CPU-only host. New installations need no configuration in either case.