Decorator marking a test that requires a multi-accelerator setup (in PyTorch). These tests are skipped on a machine without multiple hardware accelerators.
(test_case)
| 567 | |
| 568 | |
| 569 | def require_torch_multi_accelerator(test_case): |
| 570 | """ |
| 571 | Decorator marking a test that requires a multi-accelerator setup (in PyTorch). These tests are skipped on a machine |
| 572 | without multiple hardware accelerators. |
| 573 | """ |
| 574 | if not is_torch_available(): |
| 575 | return pytest.mark.skip(reason="test requires PyTorch")(test_case) |
| 576 | |
| 577 | import torch |
| 578 | |
| 579 | return pytest.mark.skipif( |
| 580 | not (torch.cuda.device_count() > 1 or torch.xpu.device_count() > 1), |
| 581 | reason="test requires multiple hardware accelerators", |
| 582 | )(test_case) |
| 583 | |
| 584 | |
| 585 | def require_torch_accelerator_with_fp16(test_case): |
nothing calls this directly
no test coverage detected
searching dependent graphs…