GpuMonitorBase class
#include <gtopt/gpu_monitor.hpp>
Query surface shared by the NVML-backed GpuMonitor and test fakes. Kept virtual (not hot — consulted only at task admission) so a FakeGpuMonitor can drive ResourceGovernor without a real GPU.
Derived classes
- class GpuMonitor
Constructors, destructors, conversion operators
- GpuMonitorBase() defaulted
- GpuMonitorBase(const GpuMonitorBase&) deleted
- GpuMonitorBase(GpuMonitorBase&&) deleted
- ~GpuMonitorBase() defaulted virtual
Public functions
- auto device(int index) const -> std::optional<GpuDeviceState> pure virtual noexcept
- Live state of device
index, or nullopt if out of range / no NVML. - auto device_count() const -> int pure virtual noexcept
- Number of visible CUDA devices (0 when !has_gpu()).
- auto has_gpu() const -> bool pure virtual noexcept
- True only when a GPU backend is usable: NVML loaded AND >=1 device.
- auto least_loaded_device() const -> std::optional<int> pure virtual noexcept
- auto operator=(const GpuMonitorBase&) -> GpuMonitorBase& deleted
- auto operator=(GpuMonitorBase&&) -> GpuMonitorBase& deleted
Function documentation
std::optional<int> gtopt:: GpuMonitorBase:: least_loaded_device() const pure virtual noexcept
Ordinal of the device with the most free VRAM (multi-GPU assignment), or nullopt when no device is visible.