Table of Contents

Class GpuDeviceInfo

Namespace
LMKit.Hardware.Gpu
Assembly
LM-Kit.NET.dll

Represents information about a GPU device.

public class GpuDeviceInfo
Inheritance
GpuDeviceInfo
Inherited Members

Properties

AverageGpuUtilizationPercent

Mean device-wide GPU compute utilization (0-100) over the interval since this member was last read for this device, or -1 when unavailable (non-CUDA backend or NVML query failure).

GpuUtilizationPercent point-samples NVML's short internal window, so reading it at a slow cadence aliases bursty workloads (such as token-by-token LLM decoding) far below their true load. This member instead averages every utilization sample the driver buffered since the previous read, giving a faithful time-weighted figure regardless of how fast it is polled.

Each read advances an internal per-device cursor, so it is meant to be driven by a single periodic poller (for example a 1 Hz metrics sampler). When the driver has produced no new samples since the last read, or the buffered-sample API is unsupported, it falls back to the instantaneous GpuUtilizationPercent value.

CurrentProcessGpuMemoryUsedBytes

VRAM (in bytes) currently allocated on this device by the current OS process, as reported by NVML (nvmlDeviceGetComputeRunningProcesses_v3). Returns 0 when the value can't be obtained (non-CUDA backend, NVML unavailable, or this process has not allocated GPU memory on this device).

CurrentProcessGpuUtilizationPercent

GPU compute (SM) utilization attributable to the current OS process on this device. 0-100 percentage averaged over the most recent NVML sampling window (~1-5 seconds depending on driver). Returns -1 when the value can't be obtained: non-CUDA backend, NVML unavailable, WSL2 / GRID where nvmlDeviceGetProcessUtilization is unsupported, insufficient permissions, or this process has had no GPU activity in the recent window. This is the per-process counterpart of GpuUtilizationPercent (which is device-wide).

DeviceDescription

Gets the description of the GPU device.

DeviceName

Gets the name of the GPU device.

DeviceNumber

Gets the device number of the GPU.

DeviceType

Gets the type of the GPU device.

Devices

Gets a read-only list of GPU devices available on the system.

FreeMemorySize

Gets the free memory size of the GPU in bytes.

GpuUtilizationPercent

Gets the current GPU compute utilization as a percentage (0-100), or -1 when utilization data is unavailable (non-NVIDIA backend or NVML query failure). On CUDA backends this maps to the NVML "gpu" utilization rate: the percent of time over the last sample period during which one or more kernels were executing.

TotalMemorySize

Gets the total memory size of the GPU in bytes.

Methods

GetDeviceFromNumber(int)

Retrieves a GpuDeviceInfo object by its deviceNumber from the static Devices list.

Share