mirror of
https://github.com/zebrajr/pytorch.git
synced 2025-12-07 12:21:27 +01:00
1. Reworked `MultiProcContinousTest` to spawn processes during `setUpClass` instead of `main` (so that we can support multiple TestClass'es in one file). 2. The child processes are now an infinite loop, monitoring test IDs passed from main process via a task queue. Reciprocally, the child processes inform the main process completion of a test via a completion queue. 3. Added a test template. Pull Request resolved: https://github.com/pytorch/pytorch/pull/153653 Approved by: https://github.com/d4l3k, https://github.com/fegin, https://github.com/fduwjj
17 lines
448 B
Python
17 lines
448 B
Python
# Owner(s): ["oncall: distributed"]
|
|
|
|
from torch.testing._internal.common_distributed import MultiProcContinousTest
|
|
from torch.testing._internal.common_utils import run_tests
|
|
|
|
|
|
class TestTemplate(MultiProcContinousTest):
|
|
def testABC(self):
|
|
print(f"rank {self.rank} of {self.world_size} testing ABC")
|
|
|
|
def testDEF(self):
|
|
print(f"rank {self.rank} of {self.world_size} testing DEF")
|
|
|
|
|
|
if __name__ == "__main__":
|
|
run_tests()
|