A PyTorch memory snapshot viewer alternative to https://docs.pytorch.org/memory_viz with rich features. Display large snapshots smoothly!
Tested on Windows and macOS.
-
You need Rust toolchain and Python installed.
-
First you need a virtual environment (via
venvorconda). Here we useconda:- Activate your environment
conda activate base
- Install dependencies
pip install -r requirements.txt
- Activate your environment
-
Compile binary
cargo build --release --bin snapviewer-renderer --no-default-features
-
Run
-rris for--resolution-ratio, used to deal with the rendering pattern of Apple's retina display. You probably need-rr 2.0if you are using MacBook.Option A: Pass the
.pickledirectly. Preprocessing artifacts are cached at~/.snapviewer_cache/and reused on subsequent runs.python gui.py --pickle snap/large.pickle --res 1200 500 -rr 2.0
Option B: Pre-process manually and pass the directory.
# 1. Convert snapshot — outputs allocations.json and elements.db under the directory python convert_snap.py -i snap/large.pickle -o ./large # 2. Run python gui.py --dir ./large --res 1200 500 -rr 2.0
Warning: This software is in pre-alpha stage. Everything including snapshot format, data storing/loading logic is under frequent change.
- Pan: WASD / Left Mouse Drag
- Zoom: Mouse Wheel
- (Ctrl + Left click) on an allocation for detailed info about it
- If you see errors with message like
cannot open input file 'sqlite3.lib', enable feature flag--features bundled-sqlite.
- Minimal dependency is not a goal.
- On macos, TKinter is required to run on main thread; while on all platforms the renderer is also required to run on main thread. This means we need multiple processes if we want to do cross platform.
- todo:
- test this zmq-based impl on linux
