Commit e84574c
Plumb use_collectives knob from KnobOptions to dcp.async_save (#1064)
Summary:
Pull Request resolved: #1064
### This Diff
Adds a `use_collectives: bool = True` field to `KnobOptions` and threads it through `DistributedCheckpointSaver._checkpoint_impl` to both `dcp.async_save(...)` and `dcp.save(...)`.
When set to `False`, DCP skips the cross-rank gather/scatter rounds it normally uses to coordinate the global save plan. Each rank writes its local shards independently. The `use_collectives` parameter is a real public kwarg on `dcp.{save,async_save}` (see `caffe2/torch/distributed/checkpoint/state_dict_saver.py`), added in upstream PyTorch PR #147758 specifically for cases where the coord-side rounds become "prohibitively expensive as the job scale grows".
### Motivation
At 397B TP=8 EP=16 (qwen35_moe_sp project), the gather/scatter rounds account for ~50 minutes of a ~67 minute save wall. Setting `use_collectives=False` removes that bottleneck entirely.
Trade-off documented in the docstring: the resulting checkpoint is no longer cross-world re-shardable; restart with the same parallelism layout still works. This is the correct default-True behavior — existing users are unaffected; the knob is opt-in.
Default `True` preserves backward compatibility for every existing torchtnt consumer.
Reviewed By: galrotem
Differential Revision: D105451194
fbshipit-source-id: f3eb80236c83793b37021c0fa023365c59cd8db41 parent 6745f20 commit e84574c
2 files changed
Lines changed: 11 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
23 | 30 | | |
24 | 31 | | |
25 | 32 | | |
| |||
28 | 35 | | |
29 | 36 | | |
30 | 37 | | |
| 38 | + | |
| 39 | + | |
31 | 40 | | |
32 | 41 | | |
33 | 42 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
198 | 198 | | |
199 | 199 | | |
200 | 200 | | |
| 201 | + | |
201 | 202 | | |
202 | 203 | | |
203 | 204 | | |
| |||
210 | 211 | | |
211 | 212 | | |
212 | 213 | | |
| 214 | + | |
213 | 215 | | |
214 | 216 | | |
215 | 217 | | |
| |||
0 commit comments