Skip to main content

ClikaRT::device::MemoryStats

struct

Header: ClikaRT/compute/memory_stats.h

Per-device memory telemetry: the device's physical free/total plus the runtime memory pool's counters for that device. memory_stats(device) answers "where did the memory go" for exactly the device a load or a serve targets, the load-time companion of Device::cuda_available().

A point-in-time snapshot. Physical numbers come from the driver (GPU devices) or the OS's memory accounting (the CPU device: reclaimable+free as "free", MemAvailable on Linux); pool numbers from the runtime's caching allocator for that device. Where a platform has no physical source the device_* fields are 0 ("unknown"); the pool counters still report.

Data members

device_free_bytes

std::uint64_t device_free_bytes = 0

physical bytes currently free

Declared in ClikaRT/compute/memory_stats.h, line 25

device_total_bytes

std::uint64_t device_total_bytes = 0

physical capacity

Declared in ClikaRT/compute/memory_stats.h, line 26

active_bytes

std::uint64_t active_bytes = 0

pool bytes currently handed out

Declared in ClikaRT/compute/memory_stats.h, line 28

requested_bytes

std::uint64_t requested_bytes = 0

Bytes the live allocations asked for: active_bytes less the pool's carve slack (a free block at or above the pool's split ceiling serves a smaller request whole). The residency gauge: a second live copy of a weight doubles it, a bigger chunk does not move it.

Declared in ClikaRT/compute/memory_stats.h, line 33

reserved_bytes

std::uint64_t reserved_bytes = 0

pool bytes held from the driver (active + cached)

Declared in ClikaRT/compute/memory_stats.h, line 34

cached_bytes

std::uint64_t cached_bytes = 0

idle pool bytes retained for reuse

Declared in ClikaRT/compute/memory_stats.h, line 35

peak_active_bytes

std::uint64_t peak_active_bytes = 0

high-water mark of active_bytes

Declared in ClikaRT/compute/memory_stats.h, line 37

peak_reserved_bytes

std::uint64_t peak_reserved_bytes = 0

high-water mark of reserved_bytes

Declared in ClikaRT/compute/memory_stats.h, line 38

num_allocs

std::uint64_t num_allocs = 0

successful pool allocations

Declared in ClikaRT/compute/memory_stats.h, line 40

num_frees

std::uint64_t num_frees = 0

pool frees

Declared in ClikaRT/compute/memory_stats.h, line 41

num_oom

std::uint64_t num_oom = 0

pool out-of-memory events

Declared in ClikaRT/compute/memory_stats.h, line 42

wrapped_bytes

std::uint64_t wrapped_bytes = 0

adopted subset of active_bytes

The ADOPTED subset of active_bytes: memory the runtime did not allocate but took over in place, a model file mapped straight into device-visible memory, loaded without copying. Those bytes count against the device exactly like allocated ones (on a unified-memory part they are wired 1:1), so they belong in active_bytes; reported apart because the two are released differently; adopted memory goes away when the mapping is dropped, the rest when the data is freed. wrapped_allocs is how many such mappings are held RIGHT NOW (a live count, unlike num_allocs above, which only ever rises). Both are 0 where the device does not adopt memory in place.

Declared in ClikaRT/compute/memory_stats.h, line 54

wrapped_allocs

std::uint64_t wrapped_allocs = 0

mappings currently adopted

Declared in ClikaRT/compute/memory_stats.h, line 55