[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-nvidia-nemo-mbridge-perf-megatron-fsdp":3,"mdc--d6fwb0-key":34,"related-repo-nvidia-nemo-mbridge-perf-megatron-fsdp":830,"related-org-nvidia-nemo-mbridge-perf-megatron-fsdp":934},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":11,"stars":23,"repoUrl":24,"updatedAt":25,"license":26,"forks":27,"topics":28,"repo":29,"sourceUrl":32,"mdContent":33},"nemo-mbridge-perf-megatron-fsdp","enable Megatron FSDP in Megatron-Bridge","Operational guide for enabling Megatron FSDP in Megatron-Bridge, including config knobs, code anchors, pitfalls, and verification.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},"nvidia","NVIDIA","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Fnvidia.png",[12,16,19,22],{"name":13,"slug":14,"type":15},"Performance","performance","tag",{"name":17,"slug":18,"type":15},"Configuration","configuration",{"name":20,"slug":21,"type":15},"Deep Learning","deep-learning",{"name":9,"slug":8,"type":15},2473,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills","2026-07-14T05:30:09.55714","Apache-2.0",281,[],{"repoUrl":24,"stars":23,"forks":27,"topics":30,"description":31},[],"AI agent skills published by NVIDIA","https:\u002F\u002Fgithub.com\u002FNVIDIA\u002Fskills\u002Ftree\u002FHEAD\u002Fskills\u002Fnemo-mbridge-perf-megatron-fsdp","---\nname: nemo-mbridge-perf-megatron-fsdp\ndescription: Operational guide for enabling Megatron FSDP in Megatron-Bridge, including config knobs, code anchors, pitfalls, and verification.\nlicense: Apache-2.0\nwhen_to_use: Using FSDP-based data parallelism instead of DDP, or tracing an OOM or regression to a FSDP config change; 'use_megatron_fsdp', 'data_parallel_sharding_strategy', 'sharded data parallel', 'Megatron FSDP'.\n---\n\n# Megatron FSDP Skill\n\nFor stable background and recommendation level, see:\n\n- @docs\u002Ftraining\u002Fmegatron-fsdp.md\n- @skills\u002Fnemo-mbridge-perf-megatron-fsdp\u002Fcard.yaml\n\n## Enablement\n\nMinimal Megatron FSDP override in Bridge:\n\n```python\ncfg.dist.use_megatron_fsdp = True\ncfg.ddp.use_megatron_fsdp = True\ncfg.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\ncfg.ddp.average_in_collective = False\ncfg.checkpoint.ckpt_format = \"fsdp_dtensor\"\n```\n\nExample recipe fixup:\n\n```python\ncfg = llama3_8b_pretrain_config()\ncfg.dist.use_megatron_fsdp = True\ncfg.ddp.use_megatron_fsdp = True\ncfg.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\ncfg.ddp.average_in_collective = False\ncfg.checkpoint.ckpt_format = \"fsdp_dtensor\"\ncfg.checkpoint.save = \"\u002Ftmp\u002Ffsdp_ckpts\"\ncfg.checkpoint.load = None\n```\n\nPerformance harness note:\n\n```bash\npython scripts\u002Fperformance\u002Flaunch.py --use_megatron_fsdp true\n```\n\n## Code Anchors\n\nBridge config definition:\n\n```148:154:src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py\nuse_megatron_fsdp: bool = False\n\"\"\"Use Megatron's Fully Sharded Data Parallel. Cannot be used together with use_torch_fsdp2.\"\"\"\n\nuse_torch_fsdp2: bool = False\n\"\"\"Use the torch FSDP2 implementation. FSDP2 is not currently working with Pipeline Parallel.\nIt is still not in a stable release stage, and may therefore contain bugs or other\npotential issues.\"\"\"\n```\n\nBridge validation:\n\n```1533:1578:src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py\nif self.dist.use_megatron_fsdp and self.dist.use_torch_fsdp2:\n    raise ValueError(...)\n...\nassert not self.dist.use_tp_pp_dp_mapping, \"use_tp_pp_dp_mapping is not supported with Megatron FSDP\"\n...\nassert self.checkpoint.ckpt_format == \"fsdp_dtensor\", (\n    \"Megatron FSDP only supports fsdp_dtensor checkpoint format\"\n)\n```\n\nRuntime wrapper selection:\n\n```217:243:src\u002Fmegatron\u002Fbridge\u002Fmodels\u002Fcommon\u002Funimodal.py\nif use_megatron_fsdp:\n    DP = FullyShardedDataParallel\nelif use_torch_fsdp2:\n    DP = TorchFullyShardedDataParallel\nelse:\n    DP = DistributedDataParallel\n...\nDP(\n    config=get_model_config(model_chunk),\n    ddp_config=ddp_config,\n    module=model_chunk,\n    ...\n    pg_collection=pg_collection,\n)\n```\n\nPerf harness overrides:\n\n```74:98:scripts\u002Fperformance\u002Futils\u002Foverrides.py\nrecipe.ddp.use_megatron_fsdp = True\nrecipe.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\nrecipe.ddp.keep_fp8_transpose_cache = False\nrecipe.ddp.average_in_collective = False\n...\nrecipe.checkpoint.load = None\n```\n\n## Pitfalls\n\n1. Public recipes often expose `use_megatron_fsdp` but still default to `ckpt_format=\"torch_dist\"`. If save\u002Fload is enabled, switch to `fsdp_dtensor`.\n2. `use_torch_fsdp2` exists, but on the validated branch Bridge still fails before training because `_ddp_wrap` passes `pg_collection`.\n3. CPU offloading is only valid when `pipeline_model_parallel_size == 1` and activation recomputation is disabled.\n4. Upstream warns that FSDP and TP\u002FCP can want different `CUDA_DEVICE_MAX_CONNECTIONS` settings on Hopper and earlier.\n5. Megatron FSDP and FSDP2 are mutually exclusive.\n\n## Verification\n\nUse the existing 2-GPU functional smoke test:\n\n```bash\nCUDA_VISIBLE_DEVICES=0,1 uv run python -m torch.distributed.run --nproc_per_node=2 \\\n  -m pytest tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_megatron_fsdp.py::TestMegatronFSDP::test_fsdp_pretrain_basic -v -s\n```\n\nSuccess criteria:\n\n- Pytest reports `1 passed`\n- The log shows finite loss at the last iteration\n- The run finishes without a checkpoint format assertion\n",{"data":35,"body":37},{"name":4,"description":6,"license":26,"when_to_use":36},"Using FSDP-based data parallelism instead of DDP, or tracing an OOM or regression to a FSDP config change; 'use_megatron_fsdp', 'data_parallel_sharding_strategy', 'sharded data parallel', 'Megatron FSDP'.",{"type":38,"children":39},"root",[40,49,55,70,77,82,141,146,215,220,254,260,265,331,336,408,413,538,543,599,605,695,701,706,795,800,824],{"type":41,"tag":42,"props":43,"children":45},"element","h1",{"id":44},"megatron-fsdp-skill",[46],{"type":47,"value":48},"text","Megatron FSDP Skill",{"type":41,"tag":50,"props":51,"children":52},"p",{},[53],{"type":47,"value":54},"For stable background and recommendation level, see:",{"type":41,"tag":56,"props":57,"children":58},"ul",{},[59,65],{"type":41,"tag":60,"props":61,"children":62},"li",{},[63],{"type":47,"value":64},"@docs\u002Ftraining\u002Fmegatron-fsdp.md",{"type":41,"tag":60,"props":66,"children":67},{},[68],{"type":47,"value":69},"@skills\u002Fnemo-mbridge-perf-megatron-fsdp\u002Fcard.yaml",{"type":41,"tag":71,"props":72,"children":74},"h2",{"id":73},"enablement",[75],{"type":47,"value":76},"Enablement",{"type":41,"tag":50,"props":78,"children":79},{},[80],{"type":47,"value":81},"Minimal Megatron FSDP override in Bridge:",{"type":41,"tag":83,"props":84,"children":89},"pre",{"className":85,"code":86,"language":87,"meta":88,"style":88},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","cfg.dist.use_megatron_fsdp = True\ncfg.ddp.use_megatron_fsdp = True\ncfg.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\ncfg.ddp.average_in_collective = False\ncfg.checkpoint.ckpt_format = \"fsdp_dtensor\"\n","python","",[90],{"type":41,"tag":91,"props":92,"children":93},"code",{"__ignoreMap":88},[94,105,114,123,132],{"type":41,"tag":95,"props":96,"children":99},"span",{"class":97,"line":98},"line",1,[100],{"type":41,"tag":95,"props":101,"children":102},{},[103],{"type":47,"value":104},"cfg.dist.use_megatron_fsdp = True\n",{"type":41,"tag":95,"props":106,"children":108},{"class":97,"line":107},2,[109],{"type":41,"tag":95,"props":110,"children":111},{},[112],{"type":47,"value":113},"cfg.ddp.use_megatron_fsdp = True\n",{"type":41,"tag":95,"props":115,"children":117},{"class":97,"line":116},3,[118],{"type":41,"tag":95,"props":119,"children":120},{},[121],{"type":47,"value":122},"cfg.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\n",{"type":41,"tag":95,"props":124,"children":126},{"class":97,"line":125},4,[127],{"type":41,"tag":95,"props":128,"children":129},{},[130],{"type":47,"value":131},"cfg.ddp.average_in_collective = False\n",{"type":41,"tag":95,"props":133,"children":135},{"class":97,"line":134},5,[136],{"type":41,"tag":95,"props":137,"children":138},{},[139],{"type":47,"value":140},"cfg.checkpoint.ckpt_format = \"fsdp_dtensor\"\n",{"type":41,"tag":50,"props":142,"children":143},{},[144],{"type":47,"value":145},"Example recipe fixup:",{"type":41,"tag":83,"props":147,"children":149},{"className":85,"code":148,"language":87,"meta":88,"style":88},"cfg = llama3_8b_pretrain_config()\ncfg.dist.use_megatron_fsdp = True\ncfg.ddp.use_megatron_fsdp = True\ncfg.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\ncfg.ddp.average_in_collective = False\ncfg.checkpoint.ckpt_format = \"fsdp_dtensor\"\ncfg.checkpoint.save = \"\u002Ftmp\u002Ffsdp_ckpts\"\ncfg.checkpoint.load = None\n",[150],{"type":41,"tag":91,"props":151,"children":152},{"__ignoreMap":88},[153,161,168,175,182,189,197,206],{"type":41,"tag":95,"props":154,"children":155},{"class":97,"line":98},[156],{"type":41,"tag":95,"props":157,"children":158},{},[159],{"type":47,"value":160},"cfg = llama3_8b_pretrain_config()\n",{"type":41,"tag":95,"props":162,"children":163},{"class":97,"line":107},[164],{"type":41,"tag":95,"props":165,"children":166},{},[167],{"type":47,"value":104},{"type":41,"tag":95,"props":169,"children":170},{"class":97,"line":116},[171],{"type":41,"tag":95,"props":172,"children":173},{},[174],{"type":47,"value":113},{"type":41,"tag":95,"props":176,"children":177},{"class":97,"line":125},[178],{"type":41,"tag":95,"props":179,"children":180},{},[181],{"type":47,"value":122},{"type":41,"tag":95,"props":183,"children":184},{"class":97,"line":134},[185],{"type":41,"tag":95,"props":186,"children":187},{},[188],{"type":47,"value":131},{"type":41,"tag":95,"props":190,"children":192},{"class":97,"line":191},6,[193],{"type":41,"tag":95,"props":194,"children":195},{},[196],{"type":47,"value":140},{"type":41,"tag":95,"props":198,"children":200},{"class":97,"line":199},7,[201],{"type":41,"tag":95,"props":202,"children":203},{},[204],{"type":47,"value":205},"cfg.checkpoint.save = \"\u002Ftmp\u002Ffsdp_ckpts\"\n",{"type":41,"tag":95,"props":207,"children":209},{"class":97,"line":208},8,[210],{"type":41,"tag":95,"props":211,"children":212},{},[213],{"type":47,"value":214},"cfg.checkpoint.load = None\n",{"type":41,"tag":50,"props":216,"children":217},{},[218],{"type":47,"value":219},"Performance harness note:",{"type":41,"tag":83,"props":221,"children":225},{"className":222,"code":223,"language":224,"meta":88,"style":88},"language-bash shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","python scripts\u002Fperformance\u002Flaunch.py --use_megatron_fsdp true\n","bash",[226],{"type":41,"tag":91,"props":227,"children":228},{"__ignoreMap":88},[229],{"type":41,"tag":95,"props":230,"children":231},{"class":97,"line":98},[232,237,243,248],{"type":41,"tag":95,"props":233,"children":235},{"style":234},"--shiki-light:#E2931D;--shiki-default:#FFCB6B;--shiki-dark:#FFCB6B",[236],{"type":47,"value":87},{"type":41,"tag":95,"props":238,"children":240},{"style":239},"--shiki-light:#91B859;--shiki-default:#C3E88D;--shiki-dark:#C3E88D",[241],{"type":47,"value":242}," scripts\u002Fperformance\u002Flaunch.py",{"type":41,"tag":95,"props":244,"children":245},{"style":239},[246],{"type":47,"value":247}," --use_megatron_fsdp",{"type":41,"tag":95,"props":249,"children":251},{"style":250},"--shiki-light:#39ADB5;--shiki-default:#89DDFF;--shiki-dark:#89DDFF",[252],{"type":47,"value":253}," true\n",{"type":41,"tag":71,"props":255,"children":257},{"id":256},"code-anchors",[258],{"type":47,"value":259},"Code Anchors",{"type":41,"tag":50,"props":261,"children":262},{},[263],{"type":47,"value":264},"Bridge config definition:",{"type":41,"tag":83,"props":266,"children":270},{"className":267,"code":268,"language":269,"meta":88,"style":88},"language-148:154:src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","use_megatron_fsdp: bool = False\n\"\"\"Use Megatron's Fully Sharded Data Parallel. Cannot be used together with use_torch_fsdp2.\"\"\"\n\nuse_torch_fsdp2: bool = False\n\"\"\"Use the torch FSDP2 implementation. FSDP2 is not currently working with Pipeline Parallel.\nIt is still not in a stable release stage, and may therefore contain bugs or other\npotential issues.\"\"\"\n","148:154:src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py",[271],{"type":41,"tag":91,"props":272,"children":273},{"__ignoreMap":88},[274,282,290,299,307,315,323],{"type":41,"tag":95,"props":275,"children":276},{"class":97,"line":98},[277],{"type":41,"tag":95,"props":278,"children":279},{},[280],{"type":47,"value":281},"use_megatron_fsdp: bool = False\n",{"type":41,"tag":95,"props":283,"children":284},{"class":97,"line":107},[285],{"type":41,"tag":95,"props":286,"children":287},{},[288],{"type":47,"value":289},"\"\"\"Use Megatron's Fully Sharded Data Parallel. Cannot be used together with use_torch_fsdp2.\"\"\"\n",{"type":41,"tag":95,"props":291,"children":292},{"class":97,"line":116},[293],{"type":41,"tag":95,"props":294,"children":296},{"emptyLinePlaceholder":295},true,[297],{"type":47,"value":298},"\n",{"type":41,"tag":95,"props":300,"children":301},{"class":97,"line":125},[302],{"type":41,"tag":95,"props":303,"children":304},{},[305],{"type":47,"value":306},"use_torch_fsdp2: bool = False\n",{"type":41,"tag":95,"props":308,"children":309},{"class":97,"line":134},[310],{"type":41,"tag":95,"props":311,"children":312},{},[313],{"type":47,"value":314},"\"\"\"Use the torch FSDP2 implementation. FSDP2 is not currently working with Pipeline Parallel.\n",{"type":41,"tag":95,"props":316,"children":317},{"class":97,"line":191},[318],{"type":41,"tag":95,"props":319,"children":320},{},[321],{"type":47,"value":322},"It is still not in a stable release stage, and may therefore contain bugs or other\n",{"type":41,"tag":95,"props":324,"children":325},{"class":97,"line":199},[326],{"type":41,"tag":95,"props":327,"children":328},{},[329],{"type":47,"value":330},"potential issues.\"\"\"\n",{"type":41,"tag":50,"props":332,"children":333},{},[334],{"type":47,"value":335},"Bridge validation:",{"type":41,"tag":83,"props":337,"children":341},{"className":338,"code":339,"language":340,"meta":88,"style":88},"language-1533:1578:src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","if self.dist.use_megatron_fsdp and self.dist.use_torch_fsdp2:\n    raise ValueError(...)\n...\nassert not self.dist.use_tp_pp_dp_mapping, \"use_tp_pp_dp_mapping is not supported with Megatron FSDP\"\n...\nassert self.checkpoint.ckpt_format == \"fsdp_dtensor\", (\n    \"Megatron FSDP only supports fsdp_dtensor checkpoint format\"\n)\n","1533:1578:src\u002Fmegatron\u002Fbridge\u002Ftraining\u002Fconfig.py",[342],{"type":41,"tag":91,"props":343,"children":344},{"__ignoreMap":88},[345,353,361,369,377,384,392,400],{"type":41,"tag":95,"props":346,"children":347},{"class":97,"line":98},[348],{"type":41,"tag":95,"props":349,"children":350},{},[351],{"type":47,"value":352},"if self.dist.use_megatron_fsdp and self.dist.use_torch_fsdp2:\n",{"type":41,"tag":95,"props":354,"children":355},{"class":97,"line":107},[356],{"type":41,"tag":95,"props":357,"children":358},{},[359],{"type":47,"value":360},"    raise ValueError(...)\n",{"type":41,"tag":95,"props":362,"children":363},{"class":97,"line":116},[364],{"type":41,"tag":95,"props":365,"children":366},{},[367],{"type":47,"value":368},"...\n",{"type":41,"tag":95,"props":370,"children":371},{"class":97,"line":125},[372],{"type":41,"tag":95,"props":373,"children":374},{},[375],{"type":47,"value":376},"assert not self.dist.use_tp_pp_dp_mapping, \"use_tp_pp_dp_mapping is not supported with Megatron FSDP\"\n",{"type":41,"tag":95,"props":378,"children":379},{"class":97,"line":134},[380],{"type":41,"tag":95,"props":381,"children":382},{},[383],{"type":47,"value":368},{"type":41,"tag":95,"props":385,"children":386},{"class":97,"line":191},[387],{"type":41,"tag":95,"props":388,"children":389},{},[390],{"type":47,"value":391},"assert self.checkpoint.ckpt_format == \"fsdp_dtensor\", (\n",{"type":41,"tag":95,"props":393,"children":394},{"class":97,"line":199},[395],{"type":41,"tag":95,"props":396,"children":397},{},[398],{"type":47,"value":399},"    \"Megatron FSDP only supports fsdp_dtensor checkpoint format\"\n",{"type":41,"tag":95,"props":401,"children":402},{"class":97,"line":208},[403],{"type":41,"tag":95,"props":404,"children":405},{},[406],{"type":47,"value":407},")\n",{"type":41,"tag":50,"props":409,"children":410},{},[411],{"type":47,"value":412},"Runtime wrapper selection:",{"type":41,"tag":83,"props":414,"children":418},{"className":415,"code":416,"language":417,"meta":88,"style":88},"language-217:243:src\u002Fmegatron\u002Fbridge\u002Fmodels\u002Fcommon\u002Funimodal.py shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","if use_megatron_fsdp:\n    DP = FullyShardedDataParallel\nelif use_torch_fsdp2:\n    DP = TorchFullyShardedDataParallel\nelse:\n    DP = DistributedDataParallel\n...\nDP(\n    config=get_model_config(model_chunk),\n    ddp_config=ddp_config,\n    module=model_chunk,\n    ...\n    pg_collection=pg_collection,\n)\n","217:243:src\u002Fmegatron\u002Fbridge\u002Fmodels\u002Fcommon\u002Funimodal.py",[419],{"type":41,"tag":91,"props":420,"children":421},{"__ignoreMap":88},[422,430,438,446,454,462,470,477,485,494,503,512,521,530],{"type":41,"tag":95,"props":423,"children":424},{"class":97,"line":98},[425],{"type":41,"tag":95,"props":426,"children":427},{},[428],{"type":47,"value":429},"if use_megatron_fsdp:\n",{"type":41,"tag":95,"props":431,"children":432},{"class":97,"line":107},[433],{"type":41,"tag":95,"props":434,"children":435},{},[436],{"type":47,"value":437},"    DP = FullyShardedDataParallel\n",{"type":41,"tag":95,"props":439,"children":440},{"class":97,"line":116},[441],{"type":41,"tag":95,"props":442,"children":443},{},[444],{"type":47,"value":445},"elif use_torch_fsdp2:\n",{"type":41,"tag":95,"props":447,"children":448},{"class":97,"line":125},[449],{"type":41,"tag":95,"props":450,"children":451},{},[452],{"type":47,"value":453},"    DP = TorchFullyShardedDataParallel\n",{"type":41,"tag":95,"props":455,"children":456},{"class":97,"line":134},[457],{"type":41,"tag":95,"props":458,"children":459},{},[460],{"type":47,"value":461},"else:\n",{"type":41,"tag":95,"props":463,"children":464},{"class":97,"line":191},[465],{"type":41,"tag":95,"props":466,"children":467},{},[468],{"type":47,"value":469},"    DP = DistributedDataParallel\n",{"type":41,"tag":95,"props":471,"children":472},{"class":97,"line":199},[473],{"type":41,"tag":95,"props":474,"children":475},{},[476],{"type":47,"value":368},{"type":41,"tag":95,"props":478,"children":479},{"class":97,"line":208},[480],{"type":41,"tag":95,"props":481,"children":482},{},[483],{"type":47,"value":484},"DP(\n",{"type":41,"tag":95,"props":486,"children":488},{"class":97,"line":487},9,[489],{"type":41,"tag":95,"props":490,"children":491},{},[492],{"type":47,"value":493},"    config=get_model_config(model_chunk),\n",{"type":41,"tag":95,"props":495,"children":497},{"class":97,"line":496},10,[498],{"type":41,"tag":95,"props":499,"children":500},{},[501],{"type":47,"value":502},"    ddp_config=ddp_config,\n",{"type":41,"tag":95,"props":504,"children":506},{"class":97,"line":505},11,[507],{"type":41,"tag":95,"props":508,"children":509},{},[510],{"type":47,"value":511},"    module=model_chunk,\n",{"type":41,"tag":95,"props":513,"children":515},{"class":97,"line":514},12,[516],{"type":41,"tag":95,"props":517,"children":518},{},[519],{"type":47,"value":520},"    ...\n",{"type":41,"tag":95,"props":522,"children":524},{"class":97,"line":523},13,[525],{"type":41,"tag":95,"props":526,"children":527},{},[528],{"type":47,"value":529},"    pg_collection=pg_collection,\n",{"type":41,"tag":95,"props":531,"children":533},{"class":97,"line":532},14,[534],{"type":41,"tag":95,"props":535,"children":536},{},[537],{"type":47,"value":407},{"type":41,"tag":50,"props":539,"children":540},{},[541],{"type":47,"value":542},"Perf harness overrides:",{"type":41,"tag":83,"props":544,"children":548},{"className":545,"code":546,"language":547,"meta":88,"style":88},"language-74:98:scripts\u002Fperformance\u002Futils\u002Foverrides.py shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","recipe.ddp.use_megatron_fsdp = True\nrecipe.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\nrecipe.ddp.keep_fp8_transpose_cache = False\nrecipe.ddp.average_in_collective = False\n...\nrecipe.checkpoint.load = None\n","74:98:scripts\u002Fperformance\u002Futils\u002Foverrides.py",[549],{"type":41,"tag":91,"props":550,"children":551},{"__ignoreMap":88},[552,560,568,576,584,591],{"type":41,"tag":95,"props":553,"children":554},{"class":97,"line":98},[555],{"type":41,"tag":95,"props":556,"children":557},{},[558],{"type":47,"value":559},"recipe.ddp.use_megatron_fsdp = True\n",{"type":41,"tag":95,"props":561,"children":562},{"class":97,"line":107},[563],{"type":41,"tag":95,"props":564,"children":565},{},[566],{"type":47,"value":567},"recipe.ddp.data_parallel_sharding_strategy = \"optim_grads_params\"\n",{"type":41,"tag":95,"props":569,"children":570},{"class":97,"line":116},[571],{"type":41,"tag":95,"props":572,"children":573},{},[574],{"type":47,"value":575},"recipe.ddp.keep_fp8_transpose_cache = False\n",{"type":41,"tag":95,"props":577,"children":578},{"class":97,"line":125},[579],{"type":41,"tag":95,"props":580,"children":581},{},[582],{"type":47,"value":583},"recipe.ddp.average_in_collective = False\n",{"type":41,"tag":95,"props":585,"children":586},{"class":97,"line":134},[587],{"type":41,"tag":95,"props":588,"children":589},{},[590],{"type":47,"value":368},{"type":41,"tag":95,"props":592,"children":593},{"class":97,"line":191},[594],{"type":41,"tag":95,"props":595,"children":596},{},[597],{"type":47,"value":598},"recipe.checkpoint.load = None\n",{"type":41,"tag":71,"props":600,"children":602},{"id":601},"pitfalls",[603],{"type":47,"value":604},"Pitfalls",{"type":41,"tag":606,"props":607,"children":608},"ol",{},[609,638,664,677,690],{"type":41,"tag":60,"props":610,"children":611},{},[612,614,620,622,628,630,636],{"type":47,"value":613},"Public recipes often expose ",{"type":41,"tag":91,"props":615,"children":617},{"className":616},[],[618],{"type":47,"value":619},"use_megatron_fsdp",{"type":47,"value":621}," but still default to ",{"type":41,"tag":91,"props":623,"children":625},{"className":624},[],[626],{"type":47,"value":627},"ckpt_format=\"torch_dist\"",{"type":47,"value":629},". If save\u002Fload is enabled, switch to ",{"type":41,"tag":91,"props":631,"children":633},{"className":632},[],[634],{"type":47,"value":635},"fsdp_dtensor",{"type":47,"value":637},".",{"type":41,"tag":60,"props":639,"children":640},{},[641,647,649,655,657,663],{"type":41,"tag":91,"props":642,"children":644},{"className":643},[],[645],{"type":47,"value":646},"use_torch_fsdp2",{"type":47,"value":648}," exists, but on the validated branch Bridge still fails before training because ",{"type":41,"tag":91,"props":650,"children":652},{"className":651},[],[653],{"type":47,"value":654},"_ddp_wrap",{"type":47,"value":656}," passes ",{"type":41,"tag":91,"props":658,"children":660},{"className":659},[],[661],{"type":47,"value":662},"pg_collection",{"type":47,"value":637},{"type":41,"tag":60,"props":665,"children":666},{},[667,669,675],{"type":47,"value":668},"CPU offloading is only valid when ",{"type":41,"tag":91,"props":670,"children":672},{"className":671},[],[673],{"type":47,"value":674},"pipeline_model_parallel_size == 1",{"type":47,"value":676}," and activation recomputation is disabled.",{"type":41,"tag":60,"props":678,"children":679},{},[680,682,688],{"type":47,"value":681},"Upstream warns that FSDP and TP\u002FCP can want different ",{"type":41,"tag":91,"props":683,"children":685},{"className":684},[],[686],{"type":47,"value":687},"CUDA_DEVICE_MAX_CONNECTIONS",{"type":47,"value":689}," settings on Hopper and earlier.",{"type":41,"tag":60,"props":691,"children":692},{},[693],{"type":47,"value":694},"Megatron FSDP and FSDP2 are mutually exclusive.",{"type":41,"tag":71,"props":696,"children":698},{"id":697},"verification",[699],{"type":47,"value":700},"Verification",{"type":41,"tag":50,"props":702,"children":703},{},[704],{"type":47,"value":705},"Use the existing 2-GPU functional smoke test:",{"type":41,"tag":83,"props":707,"children":709},{"className":222,"code":708,"language":224,"meta":88,"style":88},"CUDA_VISIBLE_DEVICES=0,1 uv run python -m torch.distributed.run --nproc_per_node=2 \\\n  -m pytest tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_megatron_fsdp.py::TestMegatronFSDP::test_fsdp_pretrain_basic -v -s\n",[710],{"type":41,"tag":91,"props":711,"children":712},{"__ignoreMap":88},[713,767],{"type":41,"tag":95,"props":714,"children":715},{"class":97,"line":98},[716,722,727,732,737,742,747,752,757,762],{"type":41,"tag":95,"props":717,"children":719},{"style":718},"--shiki-light:#90A4AE;--shiki-default:#EEFFFF;--shiki-dark:#BABED8",[720],{"type":47,"value":721},"CUDA_VISIBLE_DEVICES",{"type":41,"tag":95,"props":723,"children":724},{"style":250},[725],{"type":47,"value":726},"=",{"type":41,"tag":95,"props":728,"children":729},{"style":239},[730],{"type":47,"value":731},"0,1",{"type":41,"tag":95,"props":733,"children":734},{"style":234},[735],{"type":47,"value":736}," uv",{"type":41,"tag":95,"props":738,"children":739},{"style":239},[740],{"type":47,"value":741}," run",{"type":41,"tag":95,"props":743,"children":744},{"style":239},[745],{"type":47,"value":746}," python",{"type":41,"tag":95,"props":748,"children":749},{"style":239},[750],{"type":47,"value":751}," -m",{"type":41,"tag":95,"props":753,"children":754},{"style":239},[755],{"type":47,"value":756}," torch.distributed.run",{"type":41,"tag":95,"props":758,"children":759},{"style":239},[760],{"type":47,"value":761}," --nproc_per_node=2",{"type":41,"tag":95,"props":763,"children":764},{"style":718},[765],{"type":47,"value":766}," \\\n",{"type":41,"tag":95,"props":768,"children":769},{"class":97,"line":107},[770,775,780,785,790],{"type":41,"tag":95,"props":771,"children":772},{"style":239},[773],{"type":47,"value":774},"  -m",{"type":41,"tag":95,"props":776,"children":777},{"style":239},[778],{"type":47,"value":779}," pytest",{"type":41,"tag":95,"props":781,"children":782},{"style":239},[783],{"type":47,"value":784}," tests\u002Ffunctional_tests\u002Ftraining\u002Ftest_megatron_fsdp.py::TestMegatronFSDP::test_fsdp_pretrain_basic",{"type":41,"tag":95,"props":786,"children":787},{"style":239},[788],{"type":47,"value":789}," -v",{"type":41,"tag":95,"props":791,"children":792},{"style":239},[793],{"type":47,"value":794}," -s\n",{"type":41,"tag":50,"props":796,"children":797},{},[798],{"type":47,"value":799},"Success criteria:",{"type":41,"tag":56,"props":801,"children":802},{},[803,814,819],{"type":41,"tag":60,"props":804,"children":805},{},[806,808],{"type":47,"value":807},"Pytest reports ",{"type":41,"tag":91,"props":809,"children":811},{"className":810},[],[812],{"type":47,"value":813},"1 passed",{"type":41,"tag":60,"props":815,"children":816},{},[817],{"type":47,"value":818},"The log shows finite loss at the last iteration",{"type":41,"tag":60,"props":820,"children":821},{},[822],{"type":47,"value":823},"The run finishes without a checkpoint format assertion",{"type":41,"tag":825,"props":826,"children":827},"style",{},[828],{"type":47,"value":829},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":831,"total":933},[832,847,861,875,887,904,919],{"slug":833,"name":833,"fn":834,"description":835,"org":836,"tags":837,"stars":23,"repoUrl":24,"updatedAt":846},"accelerated-computing-cudf","accelerate data processing with cuDF","Official NVIDIA-authored guidance for NVIDIA cuDF GPU DataFrames, pandas acceleration, dask-cuDF, ETL, joins, groupby, CSV\u002FParquet I\u002FO, nullable semantics, and multi-GPU DataFrame workloads.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[838,841,844,845],{"name":839,"slug":840,"type":15},"Data Analysis","data-analysis",{"name":842,"slug":843,"type":15},"Data Engineering","data-engineering",{"name":9,"slug":8,"type":15},{"name":13,"slug":14,"type":15},"2026-07-14T05:28:43.176466",{"slug":848,"name":848,"fn":849,"description":850,"org":851,"tags":852,"stars":23,"repoUrl":24,"updatedAt":860},"aiq-deploy","deploy and manage NVIDIA AI-Q infrastructure","Use when asked to install, deploy, run, validate, troubleshoot, or stop NVIDIA AI-Q Blueprint infrastructure.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[853,856,859],{"name":854,"slug":855,"type":15},"Deployment","deployment",{"name":857,"slug":858,"type":15},"Infrastructure","infrastructure",{"name":9,"slug":8,"type":15},"2026-07-14T05:29:06.667109",{"slug":862,"name":862,"fn":863,"description":864,"org":865,"tags":866,"stars":23,"repoUrl":24,"updatedAt":874},"aiq-research","conduct deep research with AI-Q","Use when asked to run deep research or AI-Q research through a reachable NVIDIA AI-Q Blueprint backend.\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[867,870,871],{"name":868,"slug":869,"type":15},"Agents","agents",{"name":9,"slug":8,"type":15},{"name":872,"slug":873,"type":15},"Research","research","2026-07-14T05:28:06.816956",{"slug":876,"name":876,"fn":877,"description":878,"org":879,"tags":880,"stars":23,"repoUrl":24,"updatedAt":886},"amc-run-sample-calibration","run AMC sample dataset calibration","Run end-to-end calibration on the shipped sample dataset (sdg_08_2_sample_data_010926.zip) against a running AMC microservice. Use when user says 'test sample dataset', 'run sample calibration', 'verify AMC install', or 'launch and test'.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[881,882,883],{"name":839,"slug":840,"type":15},{"name":9,"slug":8,"type":15},{"name":884,"slug":885,"type":15},"Testing","testing","2026-07-17T05:29:03.913266",{"slug":888,"name":888,"fn":889,"description":890,"org":891,"tags":892,"stars":23,"repoUrl":24,"updatedAt":903},"amc-run-video-calibration","calibrate video datasets with AutoMagicCalib","Calibrate a new dataset from pre-recorded video files via the AutoMagicCalib REST API. Use when user has local MP4s and says 'calibrate my videos', 'run AMC on these videos', or similar. For RTSP\u002Flive streams, use amc-run-rtsp-calibration instead.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[893,896,899,900],{"name":894,"slug":895,"type":15},"Automation","automation",{"name":897,"slug":898,"type":15},"Imaging","imaging",{"name":9,"slug":8,"type":15},{"name":901,"slug":902,"type":15},"Video","video","2026-07-17T05:28:53.905004",{"slug":905,"name":905,"fn":906,"description":907,"org":908,"tags":909,"stars":23,"repoUrl":24,"updatedAt":918},"amc-setup-calibration-stack","deploy AutoMagicCalib microservice with Docker","Launch AutoMagicCalib microservice and web UI from NGC release images via Docker Compose. Use when user says 'deploy auto calibration', 'launch auto calibration', 'launch AMC', 'start MS+UI', or 'set up auto-magic-calib'. Requires NGC API key.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[910,911,914,915],{"name":854,"slug":855,"type":15},{"name":912,"slug":913,"type":15},"Docker","docker",{"name":9,"slug":8,"type":15},{"name":916,"slug":917,"type":15},"Operations","operations","2026-07-17T05:28:56.913999",{"slug":920,"name":920,"fn":921,"description":922,"org":923,"tags":924,"stars":23,"repoUrl":24,"updatedAt":932},"cudaq-guide","develop quantum applications with CUDA-Q","CUDA-Q onboarding guide for installation, test programs, GPU simulation, QPU hardware, and quantum applications.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[925,926,929],{"name":9,"slug":8,"type":15},{"name":927,"slug":928,"type":15},"Quantum Computing","quantum-computing",{"name":930,"slug":931,"type":15},"Simulation","simulation","2026-07-14T05:26:58.898253",305,{"items":935,"total":1085},[936,954,969,980,992,1006,1019,1033,1044,1053,1067,1076],{"slug":937,"name":937,"fn":938,"description":939,"org":940,"tags":941,"stars":951,"repoUrl":952,"updatedAt":953},"nemoclaw-user-guide","retrieve NemoClaw documentation and configuration","Guides human users' AI agents to the NemoClaw docs MCP server and canonical Fern documentation in Markdown form. Use when users ask how to install, configure, operate, troubleshoot, secure, or learn NemoClaw with an AI coding assistant. Trigger keywords - nemoclaw docs, use nemoclaw with ai agent, nemoclaw mcp docs, nemoclaw install help, nemoclaw quickstart, nemoclaw markdown docs, llms.txt, agent skills.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[942,945,948],{"name":943,"slug":944,"type":15},"Documentation","documentation",{"name":946,"slug":947,"type":15},"MCP","mcp",{"name":949,"slug":950,"type":15},"Search","search",21777,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FNemoClaw","2026-07-20T06:00:01.461044",{"slug":955,"name":955,"fn":956,"description":957,"org":958,"tags":959,"stars":966,"repoUrl":967,"updatedAt":968},"mcore-build-and-dependency","manage Megatron-LM development environments","Container-based dev environment setup and dependency management for Megatron-LM. Covers acquiring and launching the CI container, uv package management, and updating uv.lock.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[960,963,964],{"name":961,"slug":962,"type":15},"Containers","containers",{"name":854,"slug":855,"type":15},{"name":965,"slug":87,"type":15},"Python",17049,"https:\u002F\u002Fgithub.com\u002FNVIDIA\u002FMegatron-LM","2026-07-27T06:06:11.249662",{"slug":970,"name":970,"fn":971,"description":972,"org":973,"tags":974,"stars":966,"repoUrl":967,"updatedAt":979},"mcore-bump-base-image","update NVIDIA PyTorch base images","Bump the NVIDIA PyTorch base image (`nvcr.io\u002Fnvidia\u002Fpytorch:YY.MM-py3`) used by Megatron-LM CI. Covers the two pin sites (GitHub CI in `docker\u002F.ngc_version.dev` and GitLab CI in `.gitlab\u002Fstages\u002F01.build.yml`), the post-bump CI loop (re-run functional tests, refresh golden values, mark broken tests), and the gotchas that bit PRs",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[975,978],{"name":976,"slug":977,"type":15},"CI\u002FCD","ci-cd",{"name":854,"slug":855,"type":15},"2026-07-14T05:25:59.97109",{"slug":981,"name":981,"fn":982,"description":983,"org":984,"tags":985,"stars":966,"repoUrl":967,"updatedAt":991},"mcore-cicd","manage CI\u002FCD pipelines for Megatron-LM","CI\u002FCD reference for Megatron-LM. Covers CI pipeline structure, PR scope labels, triggering internal GitLab CI (which force-pushes the current branch to a pull-request\u002FBRANCH ref — always dry-run and verify the destination first; never run against shared or protected branches), and CI failure investigation.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[986,987,988],{"name":976,"slug":977,"type":15},{"name":854,"slug":855,"type":15},{"name":989,"slug":990,"type":15},"GitHub","github","2026-07-27T06:06:12.278222",{"slug":993,"name":993,"fn":994,"description":995,"org":996,"tags":997,"stars":966,"repoUrl":967,"updatedAt":1005},"mcore-create-issue","investigate CI failures and create issues","Investigate a failing GitHub Actions run or job and create a GitHub issue for the failure.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[998,1001,1002],{"name":999,"slug":1000,"type":15},"Debugging","debugging",{"name":989,"slug":990,"type":15},{"name":1003,"slug":1004,"type":15},"Triage","triage","2026-07-14T05:25:57.442089",{"slug":1007,"name":1007,"fn":1008,"description":1009,"org":1010,"tags":1011,"stars":966,"repoUrl":967,"updatedAt":1018},"mcore-linting-and-formatting","lint and format Megatron-LM code","Linting and formatting for Megatron-LM. Covers running autoformat.sh, tools (ruff, black, isort, pylint, mypy), and code style rules.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1012,1015],{"name":1013,"slug":1014,"type":15},"Best Practices","best-practices",{"name":1016,"slug":1017,"type":15},"Code Analysis","code-analysis","2026-07-14T05:25:56.18433",{"slug":1020,"name":1020,"fn":1021,"description":1022,"org":1023,"tags":1024,"stars":966,"repoUrl":967,"updatedAt":1032},"mcore-migrate-gpt-to-hybrid","migrate Megatron-LM models to HybridModel","Migration guide for moving Megatron Core GPTModel checkpoints, model providers, training commands, and layer mappings to HybridModel.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1025,1028,1031],{"name":1026,"slug":1027,"type":15},"Machine Learning","machine-learning",{"name":1029,"slug":1030,"type":15},"Migration","migration",{"name":9,"slug":8,"type":15},"2026-07-17T06:07:11.777011",{"slug":1034,"name":1034,"fn":1035,"description":1036,"org":1037,"tags":1038,"stars":966,"repoUrl":967,"updatedAt":1043},"mcore-onboard-gb200-1node-tests","onboard functional tests for GB200","Onboard 1-node GitHub MR functional tests for GB200 from existing mr-scoped 2-node tests.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1039,1042],{"name":1040,"slug":1041,"type":15},"QA","qa",{"name":884,"slug":885,"type":15},"2026-07-14T05:25:53.673039",{"slug":1045,"name":1045,"fn":1046,"description":1047,"org":1048,"tags":1049,"stars":966,"repoUrl":967,"updatedAt":1052},"mcore-run-on-slurm","launch distributed training jobs on SLURM","How to launch distributed Megatron-LM training jobs on a SLURM cluster. Covers a minimal sbatch skeleton, environment-variable setup for torch.distributed.run, CUDA_DEVICE_MAX_CONNECTIONS rules across hardware and parallelism modes, container conventions, monitoring, and per-rank failure diagnosis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1050,1051],{"name":854,"slug":855,"type":15},{"name":857,"slug":858,"type":15},"2026-07-14T05:25:49.362534",{"slug":1054,"name":1054,"fn":1055,"description":1056,"org":1057,"tags":1058,"stars":966,"repoUrl":967,"updatedAt":1066},"mcore-split-pr","split pull requests to reduce review load","Split a PR into multiple PRs to reduce the number of required CODEOWNERS reviewer groups.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1059,1062,1063],{"name":1060,"slug":1061,"type":15},"Code Review","code-review",{"name":989,"slug":990,"type":15},{"name":1064,"slug":1065,"type":15},"Pull Requests","pull-requests","2026-07-14T05:26:01.226578",{"slug":1068,"name":1068,"fn":1069,"description":1070,"org":1071,"tags":1072,"stars":966,"repoUrl":967,"updatedAt":1075},"mcore-testing","run and manage Megatron-LM tests","Test system for Megatron-LM. Covers test layout, recipe YAML structure, adding and running unit and functional tests, golden values, marker filters, and CI parity.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1073,1074],{"name":1040,"slug":1041,"type":15},{"name":884,"slug":885,"type":15},"2026-07-14T05:25:54.928983",{"slug":1077,"name":1077,"fn":1078,"description":1079,"org":1080,"tags":1081,"stars":966,"repoUrl":967,"updatedAt":1084},"nightly-sync","manage nightly main-to-dev sync workflows","Domain knowledge for the nightly main-to-dev sync workflow. Covers merge strategy, CI architecture, failure investigation, and known issues.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":9},[1082,1083],{"name":894,"slug":895,"type":15},{"name":976,"slug":977,"type":15},"2026-07-30T05:29:03.275638",496]