How nvidia/go-gpuallocator works
go-gpuallocator is a Go library that selects GPU devices for callers; it does not assign devices to workloads itself. Its main workflow discovers GPUs and their topology, then applies a chosen policy to select devices while tracking allocations and frees. The README also documents simple, best-effort, and static DGX policies. The graph reflects the shown allocator and device-discovery calls; unsampled policy internals are represented only where documented.
Main entry points: allocator.go Allocator state · gpuallocator/device.go Device discovery · links/device.go Link discovery · besteffort_policy.go Best-effort policy
Components 11
Allocation lifecycle
- Allocator state
gpuallocator/allocator.go - Device discovery
gpuallocator/device.go
Selection policies
- Policy interface
gpuallocator/allocator.go - Simple policy
gpuallocator/simple_policy.go - Best-effort policy
gpuallocator/besteffort_policy.go - Static DGX policies
gpuallocator/staticdgx_policies.go
GPU topology
- GPU device model
gpuallocator/device.go - Link discovery
internal/links/device.go - PCI information
internal/links/pciinfo.go
Other components
- Library caller
- NVML and device APIs
Connections 13
- Library caller → Allocator state: creates and requests
README.md - Allocator state → Device discovery: enumerates GPUs
gpuallocator/allocator.go - Device discovery → NVML and device APIs: initializes and queries
gpuallocator/device.go - Device discovery → GPU device model: builds devices
gpuallocator/device.go - Device discovery → Link discovery: queries topology
gpuallocator/device.go - GPU device model → PCI information: formats PCI data
gpuallocator/device.go - Link discovery → PCI information: uses PCI data
internal/links/device.go - Allocator state → Policy interface: dispatches selection
gpuallocator/allocator.go - Simple policy → Policy interface: implements
README.md - Best-effort policy → Policy interface: implements
README.md - Static DGX policies → Policy interface: implements
README.md - Best-effort policy → Link discovery: scores topology
gpuallocator/besteffort_policy.go - Allocator state → Allocator state: tracks allocate and free
gpuallocator/allocator.go