Skip to content

[distributed] Reuse workers for tensor-parallel checkpoint tests - #197665

Closed
d4l3k wants to merge 3 commits into
gh/d4l3k/158/basefrom
gh/d4l3k/158/head
Closed

d4l3k wants to merge 3 commits into
gh/d4l3k/158/basefrom
gh/d4l3k/158/head

Conversation

@d4l3k

@d4l3k d4l3k commented Sep 19, 2026 •

Copy link
Copy Markdown
Member

Stack from ghstack (oldest at bottom):

Amortize process-group startup across checkpoint save/load and meta-device loading tests. Preserve rank counts and per-test temporary-directory cleanup.

Test plan: CUDA build and lint; both tests in normal and reverse order, with two visible GPUs, and after rebuilding. Runtime fell from 13.5s to 6.3s.

@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/197665

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

✅ You can merge normally! (2 Unrelated Failures)

As of commit 187e6dc with merge base b7954b2 (image):

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

  • Scope
    • Test-only change confined to test/distributed/checkpoint/test_tp_checkpoint.py; no production or CI code is touched.
    • Only the base class of TestTpCheckpoint and its imports change; both test bodies are byte-identical.
  • Rank count preserved
    • world_size = NUM_DEVICES reproduces the old DTensorTestBase.world_size property at common_dtensor.py:791-792, and is required because MultiProcContinuousTest.world_size defaults to the unset -2 (common_distributed.py:1848).
    • _get_world_size reads the plain class attribute via inspect.getattr_static (common_distributed.py:2051-2058), so NUM_DEVICES is honored rather than replaced by full device count.
  • Harness compatibility
    • with_comms passes through when the class has no init_pg (common_dtensor.py:894-896); common_distributed.py defines only the classmethod _init_pg, which _worker_loop calls once per worker, so the process group is still initialized.
    • with_temp_dir keys off dist.is_initialized() and rank-0 broadcast plus dist.barrier() cleanup (checkpoint_utils.py:135-164), so per-test temp-dir cleanup is retained under the reused workers.
    • skip_if_lt_x_gpu(2)'s sys.exit skip path is converted to unittest.SkipTest by _worker_loop (common_distributed.py:1943-1952), so the GPU guard still works.
  • Established pattern
    • test/distributed/checkpoint/test_state_dict_utils.py:32-33 and test/distributed/fsdp/test_hsdp_dtensor_state_dict.py:51 already combine DTensorContinuousTestBase with a class-level world_size and @with_comms.

reason: clean
Reviewed commit: 187e6dc

Inference job

🐛 Report a wrong verdict

CRCR (non-blocking) - The following CRCR downstream CI jobs failed but are non-blocking:

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

d4l3k added a commit that referenced this pull request Sep 19, 2026
Amortize process-group startup across checkpoint save/load and meta-device loading tests. Preserve rank counts and per-test temporary-directory cleanup.

Test plan: CUDA build and lint; both tests in normal and reverse order, with two visible GPUs, and after rebuilding. Runtime fell from 13.5s to 6.3s.


ghstack-source-id: 53b9941
Pull-Request: #197665
d4l3k added a commit that referenced this pull request Sep 19, 2026
Amortize process-group startup across checkpoint save/load and meta-device loading tests. Preserve rank counts and per-test temporary-directory cleanup.

Test plan: CUDA build and lint; both tests in normal and reverse order, with two visible GPUs, and after rebuilding. Runtime fell from 13.5s to 6.3s.


ghstack-source-id: 53b9941
Pull-Request: #197665
d4l3k added a commit that referenced this pull request Sep 19, 2026
Amortize process-group startup across checkpoint save/load and meta-device loading tests. Preserve rank counts and per-test temporary-directory cleanup.

Test plan: CUDA build and lint; both tests in normal and reverse order, with two visible GPUs, and after rebuilding. Runtime fell from 13.5s to 6.3s.


ghstack-source-id: e838b84
Pull-Request: #197665
@d4l3k

d4l3k commented Sep 19, 2026

Copy link
Copy Markdown
Member Author

@pytorchbot merge

@pytorch-bot pytorch-bot Bot added the ciflow/trunk Trigger trunk jobs on your pull request label Sep 19, 2026
@pytorchmergebot

Copy link
Copy Markdown
Collaborator

Merge started

Your change will be merged once all checks pass (ETA 0-4 Hours).

Learn more about merging in the wiki.

Questions? Feedback? Please reach out to the PyTorch DevX Team

Advanced Debugging
Check the merge workflow status
here

@github-actions
github-actions Bot deleted the gh/d4l3k/158/head branch November 23, 2026 01:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants