new dist_cp save planner to fix issue that each rank needs to download all checkpoint files #3271
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
what's the issue
PyTorch Issue: pytorch/pytorch#125740
When pytorch 2.3 saves checkpoint files, if there are duplicated tensors, it will do dedup. In the dedup, it tries to balance the storage needed for each rank, so the duplicated tensors are saved on different ranks. The consequest is that, when loading checkpoint, each rank needs to read files saved by different ranks even without resharding. Ideally, each rank_k only needs to download rank_k and rank_0 files.
what's the fix
we save the duplicated tensors to the smallest rank only. This is how torch2.1 and torch2.2 do the dedup.
test
Tested on 512 GPUs. Save and load both work.