Repository navigation
[ZeRO] Default disable elastic ckpt in stage 1+2 and reduce CPU memory overhead during ckpt load - #1525
Merged
Conversation
jeffra
requested review from
RezaYazdaniAminabadi,
ShadenSmith,
awan-10,
cli99,
conglongli,
eltonzheng,
minjiaz,
niumanar,
samyam and
tjruwase
as code owners
November 5, 2021 05:53
tjruwase
reviewed
Nov 5, 2021
tjruwase
approved these changes
Nov 5, 2021
jeffra
force-pushed
the
zero-ckpt-cpu-issue
branch
from
November 18, 2021 19:54
67aa46d to
45a416e
Compare
jeffra
force-pushed
the
zero-ckpt-cpu-issue
branch
from
January 5, 2022 22:41
09260b6 to
dbd0823
Compare
…into zero-ckpt-cpu-issue
tjruwase
reviewed
Jan 6, 2022
jeffra
commented
Jan 7, 2022
jeffra
enabled auto-merge (squash)
January 14, 2022 18:44
jeffra
disabled auto-merge
January 14, 2022 19:04
Collaborator
|
This is interesting, as this PR seems to have fixed a bug where Not sure if an explicit test is needed since I think the fix was accidental and not intentional. To diagnose the bug I was just dumping |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Example scenario that this PR addresses:
10B parameter model using 256 GPUs, each machine has 8 GPUs. We observe that each ZeRO rank checkpoint is 525MB. If elastic checkpointing is enabled we currently require each rank to load all ZeRO checkpoints in order to potentially re-partition the model to a new world size. If elastic checkpointing is disabled we are still loading all ZeRO checkpoints and then we end up throwing most of the state away.
If elastic checkpointing is disabled we currently attempt to load 525MB * 256 files * 8 gpus for a requirement of 1TB of CPU memory per machine just for optimizer state. On certain machines this results in OOM errors as you can imagine.
This PR loads only the required states for each rank. We still require all ZeRO partitions for fp32 master weights so this is loaded but is now enough to reduce the CPU memory requirements per node. For our 10B example this should be more along the lines of 40GB * 8 gpus = 320 GB.
Turns off elastic checkpointing support for ZeRO-2 as default, we've seen issues with this mode and advise users to turn it off.