Skip to content

Run test workers through a dist_worker decorator - #32

Open
kapilsh wants to merge 1 commit into
symmem/stream-guard-benchfrom
symmem/dist-worker
Open

kapilsh wants to merge 1 commit into
symmem/stream-guard-benchfrom
symmem/dist-worker

Conversation

@kapilsh

@kapilsh kapilsh commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

  • Add @dist_worker (tests/distributed/symmetric_memory/_dist_worker.py). It sets up the process group and destroys it after the worker. Test workers now contain only the test logic.
  • The two-thread stream-order test uses a ThreadPoolExecutor. result() raises the exception of the thread again, so the threads do not catch Exception.
  • bench.py: remove try/finally. Catch only RuntimeError when torch has no backend.
  • Ruff: flag blind except Exception (BLE001) and except-pass/continue (S110, S112) outside torchpyimpl/ and tools/.
  • CLAUDE.md: add the test and style rules.

Test plan

  • tests/distributed/symmetric_memory on 2x GB200: 110 passed, 1 skipped.
  • Skip: test_multimem.py:208, no multicast signal pad on this hardware.

@kapilsh
kapilsh added this pull request to stack #31 November 16, 2026 16:28
@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Nov 16, 2026
@kapilsh
kapilsh force-pushed the symmem/dist-worker branch 3 times, most recently from 790092c to d4f1f8d Compare November 19, 2026 19:26
@kapilsh
kapilsh removed this pull request from stack #31 November 20, 2026 02:41
@kapilsh
kapilsh added this pull request to stack #34 November 20, 2026 02:41
@kapilsh
kapilsh force-pushed the symmem/dist-worker branch 2 times, most recently from 5de0870 to eeb48e9 Compare November 22, 2026 14:05
@kapilsh
kapilsh removed this pull request from stack #34 November 22, 2026 14:30
@kapilsh
kapilsh added this pull request to stack #41 November 22, 2026 14:30
Multi-rank test workers each set up the process group and wrapped their
body in try/finally to destroy it. @dist_worker (tests/.../_dist_worker.py)
does both, so workers hold only the test logic. The two-thread stream-order
check uses a ThreadPoolExecutor, whose result() re-raises a thread's
exception, instead of catching Exception in each thread. bench.py drops its
try/finally and catches only RuntimeError when torch lacks a backend.

Ruff now flags blind `except Exception` (BLE001) and except-pass/continue
(S110, S112) outside torchpyimpl/ and tools/. CLAUDE.md gains the test
and style conventions.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant