gtopt/resource_governor.hpp file

Process-global GPU admission (per-device token bucket).

The work pool sizes CPU concurrency from cores; the governor adds the GPU side. It holds a per-device token bucket (a counting semaphore) sized from the NVML device count x a per-device concurrency (default 1, because in Default compute mode CUDA contexts time-slice — N concurrent GPU solves get no throughput, only VRAM-OOM risk). A task's ResourceClass decides whether it needs a GPU token; CPU tasks are a no-op and keep the full cpu_factor x cores fan-out.

It is a process-global singleton because GPU capacity is a process-wide resource shared across every pool (SDDP sddp/aux/build pools, PlanningLP build pool, ...). A per-pool governor would let two pools each admit "one" GPU solve = two concurrent = the original oversubscription bug.

Admission is non-blocking (like the pool's can_dispatch_task gate): try_admit returns an empty ticket when no GPU token is free, and the caller throttles. A GPU-less host (configure(0, ...) or never configured) admits every task — behaviour identical to today.

Namespaces

namespace gtopt

Classes

class gtopt::ResourceGovernor
class gtopt::ResourceGovernor::Ticket