Install any skill in seconds. Free to start, no credit card required.
Get Started Free →nvidia/nemo-mbridge-perf-memory-tuning
Techniques for reducing peak GPU memory in Megatron Bridge — expandable segments, PEFT + SP input re-gather, parallelism resizing, activation recompute, CPU offloading constraints, and common OOM fixes.
Passed 21 of 22 test cases with the skill, and 12 of 22 without it.
and 13 more in the full report
9 fixed12 passed either way1 still failing0 broke
Tokens, turns and time describe resource use, not a dollar price.
One of 9 test cases the skill fixed. Same model, same prompt, with and without the skill.
We need to run the unit test suite verifying sequence parallel input re-gather functionality for LoRA in Megatron-Bridge, including the two-rank distributed test. What commands should be executed?
| Checked | Without skill | With skill |
|---|---|---|
| Specifies running `tests/unit_tests/peft/test_lora_sp_input_regather_distributed.py` using a two-process distributed launcher. | Missed | Passed |
| Requires running focused unit tests filtering for sequence_parallel_input_regather before the distributed test. | Missed | Passed |
The instructions your model reads when the skill loads.
Stable docs: @docs/parallelisms.md Card: @skills/nemo-mbridge-perf-memory-tuning/card.yaml
GPU OOM failures during training often stem from memory fragmentation rather than raw capacity. PyTorch's default CUDA allocator can leave unusable gaps between allocations. The single most effective fix is:
export PYTORCH_CUDA_ALLOC_CONF=expandable_segments:True
This tells PyTorch to use expandable (non-fixed-size) memory segments, which dramatically reduces fragmentation and often eliminates borderline OOM without any model or parallelism changes.
Beyond fragmentation, actual peak memory is determined by:
For configuration planning, use the Bridge theoretical estimator before launching large jobs:
from megatron.bridge.training.utils.theoretical_memory_utils import estimate_training_memory
estimate = estimate_training_memory(cfg, num_microbatches=num_microbatches)
The estimator reports the most-loaded GPU shard and separates dense/embedding, routed MoE expert, and activation components. It does not include allocator fragmentation, CUDA/NCCL workspace, CUDA graph buffers, token imbalance, or dispatcher workspace, so validate final configs with runtime memory metrics.
test cases passed, vs 12 / 22 without
More skills from the same source and nearby in the registry, with their headline benchmark lift.