stormlog.device_collectors
Backend-aware device memory collector abstractions.
Functions
|
Build a backend collector for CUDA/ROCm/MPS runtime environments. |
Return the active torch runtime backend in this environment. |
|
|
Validate a sample against its collector's declared capabilities. |
Classes
|
Collector for NVIDIA CUDA runtime memory counters. |
|
Immutable description of memory signals exposed by a collector. |
Backend-specific collector contract for device memory signals. |
|
|
Normalized device-memory sample produced by a backend collector. |
|
Device-memory sample plus diagnostics about partial/core collection failures. |
|
Collector for Apple Metal (MPS) runtime counters. |
|
Collector for ROCm runtimes surfaced through torch.cuda APIs. |
- class stormlog.device_collectors.DeviceMemoryCollector[source]
Bases:
ABCBackend-specific collector contract for device memory signals.
- abstract is_available()[source]
Return whether this collector can sample in the current runtime.
- Return type:
bool
- sample_with_diagnostics()[source]
Collect a sample while preserving core-failure diagnostics.
- Return type:
- class stormlog.device_collectors.DeviceMemoryCapabilities(backend, telemetry_collector, sampling_source, supports_allocator_allocated=False, supports_allocator_reserved=False, supports_allocator_active=False, supports_allocator_inactive=False, supports_device_used=False, supports_device_free=False, supports_device_total=False, supports_native_allocator_history=False, supports_fragmentation_analysis=False, supports_allocator_attribution=False, supports_bounded_profiling=False)[source]
Bases:
objectImmutable description of memory signals exposed by a collector.
- Parameters:
backend (str)
telemetry_collector (str)
sampling_source (str)
supports_allocator_allocated (bool)
supports_allocator_reserved (bool)
supports_allocator_active (bool)
supports_allocator_inactive (bool)
supports_device_used (bool)
supports_device_free (bool)
supports_device_total (bool)
supports_native_allocator_history (bool)
supports_fragmentation_analysis (bool)
supports_allocator_attribution (bool)
supports_bounded_profiling (bool)
- backend: str
- telemetry_collector: str
- sampling_source: str
- supports_allocator_allocated: bool = False
- supports_allocator_reserved: bool = False
- supports_allocator_active: bool = False
- supports_allocator_inactive: bool = False
- supports_device_used: bool = False
- supports_device_free: bool = False
- supports_device_total: bool = False
- supports_native_allocator_history: bool = False
- supports_fragmentation_analysis: bool = False
- supports_allocator_attribution: bool = False
- supports_bounded_profiling: bool = False
- class stormlog.device_collectors.DeviceMemorySample(allocated_bytes, reserved_bytes, used_bytes, free_bytes, total_bytes, active_bytes, inactive_bytes, device_id)[source]
Bases:
objectNormalized device-memory sample produced by a backend collector.
- Parameters:
allocated_bytes (int | None)
reserved_bytes (int | None)
used_bytes (int | None)
free_bytes (int | None)
total_bytes (int | None)
active_bytes (int | None)
inactive_bytes (int | None)
device_id (int)
- allocated_bytes: int | None
- reserved_bytes: int | None
- used_bytes: int | None
- free_bytes: int | None
- total_bytes: int | None
- active_bytes: int | None
- inactive_bytes: int | None
- device_id: int
- class stormlog.device_collectors.DeviceMemorySampleResult(sample, partial_fields=(), errors=<factory>, core_error=None)[source]
Bases:
objectDevice-memory sample plus diagnostics about partial/core collection failures.
- Parameters:
sample (DeviceMemorySample | None)
partial_fields (tuple[str, ...])
errors (dict[str, str])
core_error (str | None)
- sample: DeviceMemorySample | None
- partial_fields: tuple[str, ...] = ()
- errors: dict[str, str]
- core_error: str | None = None
- property is_partial: bool
- property is_core_failure: bool
- class stormlog.device_collectors.CudaDeviceCollector(device=None)[source]
Bases:
DeviceMemoryCollectorCollector for NVIDIA CUDA runtime memory counters.
- Parameters:
device (Union[str, int, torch.device, None])
- telemetry_collector = 'stormlog.cuda_tracker'
- is_available()[source]
Return whether this collector can sample in the current runtime.
- Return type:
bool
- sample_with_diagnostics()[source]
Collect a sample while preserving core-failure diagnostics.
- Return type:
- class stormlog.device_collectors.ROCmDeviceCollector(device=None)[source]
Bases:
CudaDeviceCollectorCollector for ROCm runtimes surfaced through torch.cuda APIs.
- Parameters:
device (Union[str, int, torch.device, None])
- telemetry_collector = 'stormlog.rocm_tracker'
- is_available()[source]
Return whether this collector can sample in the current runtime.
- Return type:
bool
- class stormlog.device_collectors.MPSDeviceCollector(device=None)[source]
Bases:
DeviceMemoryCollectorCollector for Apple Metal (MPS) runtime counters.
- Parameters:
device (Union[str, int, torch.device, None])
- telemetry_collector = 'stormlog.mps_tracker'
- is_available()[source]
Return whether this collector can sample in the current runtime.
- Return type:
bool
- sample_with_diagnostics()[source]
Collect a sample while preserving core-failure diagnostics.
- Return type:
- stormlog.device_collectors.build_device_memory_collector(device=None)[source]
Build a backend collector for CUDA/ROCm/MPS runtime environments.
- Parameters:
device (str | int | torch.device | None)
- Return type:
- stormlog.device_collectors.detect_torch_runtime_backend()[source]
Return the active torch runtime backend in this environment.
- Return type:
str
- stormlog.device_collectors.validate_device_memory_sample(sample, capabilities, *, partial_fields=())[source]
Validate a sample against its collector’s declared capabilities.
- Parameters:
sample (DeviceMemorySample)
capabilities (DeviceMemoryCapabilities)
partial_fields (tuple[str, ...])
- Return type:
None