stormlog.tensorflow.profiler
Core TensorFlow Stormlog
Main profiling engine for capturing and analyzing GPU memory usage during TensorFlow model training and inference.
Classes
|
Represents a point-in-time memory snapshot. |
|
Comprehensive profiling results. |
|
Main TensorFlow Stormlog class. |
Tracks TensorFlow tensor lifecycle and memory usage. |
- class stormlog.tensorflow.profiler.MemorySnapshot(timestamp, name, gpu_memory_mb, cpu_memory_mb, gpu_memory_reserved_mb, gpu_utilization, num_tensors, tensor_sizes=<factory>, operation_name=None, graph_node=None)[source]
Bases:
objectRepresents a point-in-time memory snapshot.
- Parameters:
timestamp (float)
name (str)
gpu_memory_mb (float)
cpu_memory_mb (float)
gpu_memory_reserved_mb (float)
gpu_utilization (float)
num_tensors (int)
tensor_sizes (Dict[str, int])
operation_name (str | None)
graph_node (str | None)
- timestamp: float
- name: str
- gpu_memory_mb: float
- cpu_memory_mb: float
- gpu_memory_reserved_mb: float
- gpu_utilization: float
- num_tensors: int
- tensor_sizes: Dict[str, int]
- operation_name: str | None = None
- graph_node: str | None = None
- class stormlog.tensorflow.profiler.ProfileResult(start_time, end_time, peak_memory_mb, average_memory_mb, min_memory_mb, total_allocations, total_deallocations, snapshots=<factory>, function_profiles=<factory>, tensor_lifecycle=<factory>, memory_fragmentation=0.0, efficiency_score=0.0)[source]
Bases:
objectComprehensive profiling results.
- Parameters:
start_time (float)
end_time (float)
peak_memory_mb (float)
average_memory_mb (float)
min_memory_mb (float)
total_allocations (int)
total_deallocations (int)
snapshots (List[MemorySnapshot])
function_profiles (Dict[str, Dict[str, Any]])
tensor_lifecycle (Dict[str, Any])
memory_fragmentation (float)
efficiency_score (float)
- start_time: float
- end_time: float
- peak_memory_mb: float
- average_memory_mb: float
- min_memory_mb: float
- total_allocations: int
- total_deallocations: int
- snapshots: List[MemorySnapshot]
- function_profiles: Dict[str, Dict[str, Any]]
- tensor_lifecycle: Dict[str, Any]
- memory_fragmentation: float = 0.0
- efficiency_score: float = 0.0
- property duration: float
Total profiling duration in seconds.
- property memory_growth_rate: float
Memory growth rate in MB/second.
- class stormlog.tensorflow.profiler.TensorTracker[source]
Bases:
objectTracks TensorFlow tensor lifecycle and memory usage.
- track_tensor(tensor, operation_name='unknown')[source]
Track a new tensor.
- Parameters:
tensor (tensorflow.Tensor)
operation_name (str)
- Return type:
None
- class stormlog.tensorflow.profiler.TFMemoryProfiler(device=None, enable_tensor_tracking=True)[source]
Bases:
objectMain TensorFlow Stormlog class.
- Parameters:
device (str | None)
enable_tensor_tracking (bool)
- capture_snapshot(name='snapshot')[source]
Capture current memory state.
- Parameters:
name (str)
- Return type:
- profile_function(func)[source]
Decorator to profile function memory usage.
- Parameters:
func (Callable[[~P], R])
- Return type:
Callable[[~P], R]
- profile_context(name='context')[source]
Context manager for profiling code blocks.
- Parameters:
name (str)
- Return type:
Iterator[None]
- start_continuous_profiling(interval=1.0)[source]
Start continuous memory profiling.
- Parameters:
interval (float)
- Return type:
None