Skip to content

Respect profile_ranks on log interval memory snapshots - #6354

Merged
maanug-nv merged 4 commits into
NVIDIA:mainfrom
maanug-nv:interval-prof-rank
Aug 13, 2026
Merged

maanug-nv merged 4 commits into
NVIDIA:mainfrom
maanug-nv:interval-prof-rank

Conversation

@maanug-nv

@maanug-nv maanug-nv commented Aug 7, 2026 •

Copy link
Copy Markdown
Contributor
  • I, the PR author, have personally reviewed every line of this PR.

What does this PR do?

Quick fix to match logic here.

Note: I think this does change the default behavior. When memory profiling is enabled, default is now to dump on all ranks (old behavior was last rank only). However, this respects what is documented in the config/arguments.

⚠️ For major changes (either in lines of code or in its impact), please make sure to first share a design doc with the team. If you're unsure what's the best way to do so, contact @NVIDIA/mcore-oncall.

Issue tracking

For PRs from open-source community contributors:

  • New features: a linked issue is required. Please open a feature request and reference it here before submitting the PR.
  • Small updates (bug fixes, minor improvements): a linked issue is recommended and will accelerate the PR review process.

Linked issue:

Contribution process

Pre-checks

  • I have added relevant unit tests
  • I have added relevant functional tests
  • I have added proper typing to my code Typing guidelines
  • I have added relevant documentation
  • I have run the autoformatter.sh on my PR

Code review

Feel free to message or comment @NVIDIA/mcore-oncall to help accelerate your merge into main. The less complex your PR is, the faster it will be approved and merged!

All PRs start as draft. If you open a non-draft PR, it will be automatically converted to draft.

Step 1: Mark PR as "Ready for Review"

  1. When your PR is ready, click Ready for Review.
  2. An oncall reviewer is auto-assigned and expert reviewers are notified based on your changes.
    • Some PRs may jump straight to step 2. This is determined by .github/CODEOWNERS.

⚠️ Only mark as ready once merge-conflicts are resolved and the CI is passing.
Final Review might get declined if these requirements are not fulfilled.

Step 2: Final Review

For PRs that change megatron/core, once all expert reviewers have approved, the Final Review label is applied automatically and final reviewers are assigned.

For PRs outside megatron/core, this step is skipped.

Step 3: Approved

Once all required reviewers have approved, the Approved label is applied automatically.

Merge

Any member of mcore-engineers will be able to merge your PR.

Signed-off-by: Maanu Grover <maanug@nvidia.com>
Signed-off-by: Maanu Grover <maanug@nvidia.com>
@copy-pr-bot

copy-pr-bot Bot commented Aug 7, 2026

Copy link
Copy Markdown

Auto-sync is disabled for draft pull requests in this repository. Workflows must be run manually.

Contributors can view more details about this message here.

Signed-off-by: Maanu Grover <maanug@nvidia.com>
Comment thread megatron/training/training.py Outdated
if args.record_memory_history and (should_prof_rank or torch.distributed.get_backend() == 'fake'):
rank = safe_get_rank()
base, ext = os.path.splitext(args.memory_snapshot_path)
snapshot_filename = f"{base}-{rank}{ext}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

- in filename, or _?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair, '_' is generally safer. will change it in both places

@svcnvidia-nemo-ci svcnvidia-nemo-ci added the Approved All necessary approvals have been made label Aug 12, 2026
Signed-off-by: Maanu Grover <maanug@nvidia.com>
@svcnvidia-nemo-ci

Copy link
Copy Markdown
Contributor

🔄 Merge queue validation started!

You can track the progress here: https://github.com/NVIDIA/Megatron-LM/actions/runs/31676281100

Merged via the queue into NVIDIA:main with commit 5714a20 Aug 13, 2026
89 checks passed
@maanug-nv
maanug-nv deleted the interval-prof-rank branch August 13, 2026 08:15
ksivaman pushed a commit to ksivaman/Megatron-LM that referenced this pull request Sep 1, 2026
Signed-off-by: Maanu Grover <maanug@nvidia.com>

This branch was previously deployed

2 inactive deployments
public — d6773a76 Deployed Aug 13, 2026 by copy-pr-bot[bot] via finalize / publish-docs #5943
test — d6773a76 Deployed Aug 13, 2026 by copy-pr-bot[bot] via cicd-wait-in-queue #18857
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Approved All necessary approvals have been made complexity: low

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants