Decorator marking a test that requires a multi-GPU setup (in PyTorch). These tests are skipped on a machine without multiple GPUs. To run *only* the multi_gpu tests, assuming all test names contain multi_gpu: $ pytest -sv ./tests -k "multi_gpu"
(test_case)
| 553 | |
| 554 | |
| 555 | def require_torch_multi_gpu(test_case): |
| 556 | """ |
| 557 | Decorator marking a test that requires a multi-GPU setup (in PyTorch). These tests are skipped on a machine without |
| 558 | multiple GPUs. To run *only* the multi_gpu tests, assuming all test names contain multi_gpu: $ pytest -sv ./tests |
| 559 | -k "multi_gpu" |
| 560 | """ |
| 561 | if not is_torch_available(): |
| 562 | return pytest.mark.skip(reason="test requires PyTorch")(test_case) |
| 563 | |
| 564 | import torch |
| 565 | |
| 566 | return pytest.mark.skipif(torch.cuda.device_count() <= 1, reason="test requires multiple GPUs")(test_case) |
| 567 | |
| 568 | |
| 569 | def require_torch_multi_accelerator(test_case): |
nothing calls this directly
no test coverage detected
searching dependent graphs…