Visualize CUDAMemory History(VisualizeCUDAMemoryHistory)
This node technically relies on PyTorch's _memory_viz。
Visualize CUDA Memory History
The Visualize CUDAMemory History node, which technically relies on PyTorch's `_memory_viz
The Visualize CUDAMemory History node is used to convert CUDA memory allocation history snapshot files into visual, interactive charts. Its core function is to read a pickle file containing memory usage records and generate an HTML report that can be opened in a browser, helping users intuitively analyze GPU memory usage.
Node Function
This node technically relies on PyTorch's _memory_viz.trace_plot function to process snapshot data. It accepts a file path to a CUDA memory history snapshot file saved via pickle serialization as input. Internally, it parses this file and generates HTML content containing timeline charts. The generated HTML file is automatically saved to the memory_history subfolder within ComfyUI's output directory.
Node Parameter Description - Visualize CUDAMemory History
Control Parameters (Parameters)
| Parameter Name | Data Type | Required | Default Value | Value Range/Options | Description |
|---|---|---|---|---|---|
snapshot_path | STRING | Yes | - | - | Specifies the full path to the pickle file containing CUDA memory history data. This file is typically generated by PyTorch's memory profiling tools. |
Output
| Parameter Name | Data Type | Description |
|---|---|---|
| output_path | STRING | Returns the URL address for accessing the generated HTML visualization report in a browser. |
Usage Scenario
When debugging or optimizing complex workflows, if encountering GPU out-of-memory or memory leak issues, users can first use other tools (such as PyTorch Profiler) to capture memory snapshots and save them as files. Then, provide the path of this snapshot file to this node. The node will generate a visualization report. Users can open the report link in a browser to view memory allocation and deallocation details at different time points, thereby identifying the root cause of the problem.
Notes
Please note that this node requires a valid file path to a CUDA memory snapshot pickle file generated by compatible tools. If the file format is incorrect or the path is invalid, the node may not function properly or may report an error. The generated HTML report link is only valid while the local ComfyUI server is running.
Visualize CUDAMemory History Node Source Code Link
The Visualize CUDAMemory History node is from the ComfyUI-KJNodes node package.
Comments
Sign in with GitHub to join the discussion.