Mem Profile

Memory-profile a context-parallel (CP) inference (or training) workflow with the PyTorch CUDA caching-allocator history, then attribute the top-N memory peaks to specific modules and lines of code. Wraps the end-to-end forward in torch.cuda.memory._record_memory_history() + _dump_snapshot() (the same mechanism as Boltz2's CUDAMemoryProfile Lightning callback) under a torchrun launcher that writes one snapshot per rank, then runs a stdlib analyzer (mem_profile_analysis.py) that replays the allocation timeline, finds the distinct peaks, and emits a markdown report with clickable file:line links to the call sites holding memory at each peak — sorted by peak, then by contribution. Use once a CP workflow runs end-to-end and you need to find the largest token count that fits and which module is the memory bottleneck.

nvidia-bionemo 95e28b8 3 files · 28.9 KB Updated

File contents

nvidia-bionemo/boltz-cp/tree/main/plugins/fold-cp/skills/mem_profile commit 95e28b8ddc

Frequently asked questions

npx skillmds@latest add nvidia-bionemo/mem-profile