Skip to content

[BUGFIX] Save dist_checkpointing metadata on all nodes for multi-node training#1531

Closed
Pranaykarvi wants to merge 2 commits into
NVIDIA:mainfrom
Pranaykarvi:fix/dist-checkpointing-metadata-per-node
Closed

[BUGFIX] Save dist_checkpointing metadata on all nodes for multi-node training#1531
Pranaykarvi wants to merge 2 commits into
NVIDIA:mainfrom
Pranaykarvi:fix/dist-checkpointing-metadata-per-node

Conversation

@Pranaykarvi

Copy link
Copy Markdown
## Description

Fixes a bug where `metadata.json` is saved only on global rank 0 during distributed checkpointing, causing load failures on other nodes in non-shared filesystem setups.

### Fix

Changed the save condition to:

```python
if int(os.environ.get("LOCAL_RANK", 0)) == 0:
    save_config(...)

This ensures metadata.json is saved on each node (local rank 0), allowing successful checkpoint loading across all nodes.

Testing

Run dist_cp_save_load.py with torchrun on 2+ nodes:

  • Confirm each node has its own metadata.json
  • No CheckpointingException occurs
  • Final log should show: Loaded the disk checkpoint.

Fixes #1530

@felixwqp

Copy link
Copy Markdown

Thanks Pranaykarvi for the quick fix and testing!

I also want to learn more from Megatron team what's the design assumption about this metadata,

  1. whether it's assumed the metadata directory is hosted by a distributed file system(e.g. NFS)?
  2. Whether users have the responsibility to manage the metadata synch across node?
  3. Whether application side should have the handling to only load the metadata from master node rather than all nodes.

@github-actions

Copy link
Copy Markdown
Contributor

Marking as stale. No activity in 60 days.

@github-actions github-actions Bot added the stale No activity in 60 days on issue or PR label Jun 13, 2025
@github-actions

Copy link
Copy Markdown
Contributor

This PR was closed because it has been inactive for 7 days since being marked as stale.

@github-actions github-actions Bot closed this Jul 27, 2025
@sbhavani sbhavani added bug Something isn't working and removed stale No activity in 60 days on issue or PR labels Jul 31, 2025
@sbhavani sbhavani reopened this Jul 31, 2025
@vutrung96

Copy link
Copy Markdown

@sbhavani can we merge this fix? we're also running into this

@erictang000

Copy link
Copy Markdown

bump here! would also like this to be merged

@ko3n1g
ko3n1g requested review from a team as code owners February 18, 2026 09:18
@Phlip79 Phlip79 added the Expert Review [deprecated] Apply this label to indicate that your PR is ready for expert review. label Mar 4, 2026
@Phlip79 Phlip79 removed the Expert Review [deprecated] Apply this label to indicate that your PR is ready for expert review. label Apr 20, 2026
@Phlip79

Phlip79 commented Apr 20, 2026

Copy link
Copy Markdown
Member

/ok to test 9a638ba

@copy-pr-bot

copy-pr-bot Bot commented Apr 20, 2026

Copy link
Copy Markdown

This pull request requires additional validation before any workflows can run on NVIDIA's runners.

Pull request vetters can view their responsibilities here.

Contributors can view more details about this message here.

@Phlip79

Phlip79 commented Apr 20, 2026

Copy link
Copy Markdown
Member

/ok to test 1296a81

@svcnvidia-nemo-ci svcnvidia-nemo-ci added this to the Core 0.16 milestone Apr 20, 2026
@chtruong814 chtruong814 removed the needs-follow-up Issue needs follow-up label Apr 20, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-maintainers Waiting on maintainers to respond label Apr 22, 2026
@dimapihtar

Copy link
Copy Markdown
Contributor

Hi, thanks for the contribution.

Not sure if we want to have this change, we have never experienced similar issue.

@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-maintainers Waiting on maintainers to respond label Apr 27, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci added the waiting-on-customer Waiting on the original author to respond label Apr 27, 2026
@asolergi-nv asolergi-nv closed this May 5, 2026
@svcnvidia-nemo-ci svcnvidia-nemo-ci removed the waiting-on-customer Waiting on the original author to respond label May 6, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working community-request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] dist_checkpointing metadata is only saved in master node for multi-node training.