MCPcopy Index your code
hub / github.com/huggingface/diffusers / require_torch_multi_gpu

Function require_torch_multi_gpu

tests/testing_utils.py:555–566  ·  view source on GitHub ↗

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)

Source from the content-addressed store, hash-verified

553
554
555def 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
569def require_torch_multi_accelerator(test_case):

Callers

nothing calls this directly

Calls 1

is_torch_availableFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…