Skip to content

[distributed] Reuse workers for checkpoint resharding tests - #197666

Closed
d4l3k wants to merge 2 commits into
gh/d4l3k/159/basefrom
gh/d4l3k/159/head
Closed

d4l3k wants to merge 2 commits into
gh/d4l3k/159/basefrom
gh/d4l3k/159/head

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Reuse workers within the three resharding test classes. Preserve rank counts, placements, checkpoint formats and per-test temporary-directory cleanup.

Test plan: CUDA build and lint; all ten cases in normal and reverse order, two-GPU coverage, and all ten after rebuilding. Runtime fell from 105.7s to 62.0s.

@pytorch-bot

pytorch-bot Bot commented Sep 19, 2026 •

Copy link
Copy Markdown

🔗 Helpful Links

🧪 See artifacts and rendered test results at hud.pytorch.org/pr/197666

Note: Links to docs will display an error until the docs builds have been completed.

✅ No Failures

As of commit 6fe3247 with merge base b7954b2 (image):
💚 Looks good so far! There are no failures yet. 💚

🟢 GREEN LIGHT - PR approved to be merged without human review:

  • Scope
    • Test-only diff confined to test/distributed/checkpoint/test_dtensor_resharding.py; no source, workflow, or public API file is touched
    • Change is limited to reparenting three classes onto DTensorContinuousTestBase and adding world_size = NUM_DEVICES
  • Rank counts preserved
    • DTensorTestBase.world_size was a property returning NUM_DEVICES (common_dtensor.py:790-792), so the explicit world_size = NUM_DEVICES keeps the same value
    • MultiProcContinuousTest._get_world_size reads the class attr and only falls back to device count when it is -2 (common_distributed.py:2051-2066)
  • Harness compatibility
    • with_comms passes through because DTensorContinuousTestBase (common_dtensor.py:700) defines no init_pg — that exists only on DTensorTestBase (common_dtensor.py:799), matching the guard at common_dtensor.py:894
    • skip_if_lt_x_gpu's sys.exit is converted to unittest.SkipTest by _worker_loop (common_distributed.py:1978-1992), so the 2-GPU and 4-GPU skips still report as skips
    • _run_test_given_id builds a fresh instance per test (common_distributed.py:1911), so with_temp_dir's per-test self.temp_dir and its rmtree in finally (checkpoint_utils.py:134-164) are unchanged
  • Established pattern
    • Same base is already used with with_comms and parametrize in test/distributed/checkpoint/test_state_dict_utils.py:32 and test/distributed/tensor/test_redistribute.py:72
    • world_size = NUM_DEVICES on this base already appears in test/distributed/tensor/test_embedding_ops.py:36

reason: clean
Reviewed commit: 6fe3247

Inference job

🐛 Report a wrong verdict

This comment was automatically generated by Dr. CI and updates every 15 minutes.

@d4l3k
d4l3k marked this pull request as ready for review September 19, 2026 04:24
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Starting merge as part of PR stack under #197667

pytorchmergebot pushed a commit that referenced this pull request Sep 19, 2026
Reuse workers across the four checkpoint cases while preserving rank counts, per-test directories, and the combined CPU/accelerator backend. Use Gloo for CPU fallback when GPU-gated cases skip.

Test plan: CUDA build and lint; four cases in normal and reverse order, expected skips with two and zero visible GPUs, and four cases after rebuilding. Runtime fell from 28.4s to 12.2s.
Pull Request resolved: #197667
Approved by: https://github.com/pytorchgreenlight
ghstack dependencies: #197647, #197648, #197666
@github-actions
github-actions Bot deleted the gh/d4l3k/159/head branch November 23, 2026 01:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants