Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci-tests-fabric.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,24 +40,29 @@ jobs:
matrix:
os: [macOS-14, ubuntu-22.04, windows-2022]
config:
# TODO: follow-up - prune the oldest PyTorch minors (2.1-2.5) now that we test up to 2.13
# Test unified "lightning" package with PyTorch 2.1-2.5
- { pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
- { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
- { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
- { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
- { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }

# Test "fabric" package with PyTorch 2.6-2.11
# Test "fabric" package with PyTorch 2.6-2.13
- { pkg-name: "fabric", python-version: "3.12.7", pytorch-version: "2.6" }
- { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.7" }
- { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.8" }
- { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.9" }
- { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.10" }
- { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.11" }
- { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.12" }
- { pkg-name: "fabric", python-version: "3.12", pytorch-version: "2.13" }
- { pkg-name: "fabric", python-version: "3.13", pytorch-version: "2.8" }
- { pkg-name: "fabric", python-version: "3.13", pytorch-version: "2.9" }
- { pkg-name: "fabric", python-version: "3.13", pytorch-version: "2.10" }
- { pkg-name: "fabric", python-version: "3.13", pytorch-version: "2.11" }
- { pkg-name: "fabric", python-version: "3.13", pytorch-version: "2.12" }
- { pkg-name: "fabric", python-version: "3.13", pytorch-version: "2.13" }

# Test minimum supported versions (oldest)
- { pkg-name: "fabric", pytorch-version: "2.1", requires: "oldest" }
Expand Down
7 changes: 6 additions & 1 deletion .github/workflows/ci-tests-pytorch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,24 +44,29 @@ jobs:
matrix:
os: [macOS-14, ubuntu-22.04, windows-2022]
config:
# TODO: follow-up - prune the oldest PyTorch minors (2.1-2.5) now that we test up to 2.13
# Test unified "lightning" package with PyTorch 2.1-2.5
- { pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }
- { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.2.2" }
- { pkg-name: "lightning", python-version: "3.11", pytorch-version: "2.3" }
- { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.4.1" }
- { pkg-name: "lightning", python-version: "3.12.7", pytorch-version: "2.5.1" }

# Test "pytorch" package with PyTorch 2.6-2.11
# Test "pytorch" package with PyTorch 2.6-2.13
- { pkg-name: "pytorch", python-version: "3.12.7", pytorch-version: "2.6" }
- { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.7" }
- { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.8" }
- { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.9" }
- { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.10" }
- { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.11" }
- { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.12" }
- { pkg-name: "pytorch", python-version: "3.12", pytorch-version: "2.13" }
- { pkg-name: "pytorch", python-version: "3.13", pytorch-version: "2.8" }
- { pkg-name: "pytorch", python-version: "3.13", pytorch-version: "2.9" }
- { pkg-name: "pytorch", python-version: "3.13", pytorch-version: "2.10" }
- { pkg-name: "pytorch", python-version: "3.13", pytorch-version: "2.11" }
- { pkg-name: "pytorch", python-version: "3.13", pytorch-version: "2.12" }
- { pkg-name: "pytorch", python-version: "3.13", pytorch-version: "2.13" }

# Test minimum supported versions (oldest)
- { pkg-name: "pytorch", pytorch-version: "2.1", requires: "oldest" }
Expand Down
18 changes: 5 additions & 13 deletions tests/tests_fabric/utilities/test_distributed.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,22 +245,14 @@ def test_init_dist_connection_registers_destruction_handler(_, atexit_mock):
atexit_mock.register.assert_not_called()


def test_get_default_process_group_backend_for_device():
def test_get_default_process_group_backend_for_device(monkeypatch):
"""Test that each device type maps to its correct default process group backend."""
# register a custom backend for test
torch.utils.rename_privateuse1_backend("pcu")

def mock_backend(store, group_rank, group_size, timeout):
pass

torch.distributed.Backend.register_backend(
"pccl",
lambda store, group_rank, group_size, timeout: mock_backend(store, group_rank, group_size, timeout),
devices=["pcu"],
)
# patch the map instead of registering a real backend: `rename_privateuse1_backend` is irreversible
# and would leak a dangling "pcu" device into subsequent tests
monkeypatch.setitem(torch.distributed.Backend.default_device_backend_map, "pcu", "pccl")

# test that the default backend is correctly set for each device
devices = [torch.device("cpu"), torch.device("cuda:0"), torch.device("pcu:0")]
devices = [torch.device("cpu"), torch.device("cuda:0"), Mock(type="pcu")]
backends = ["gloo", "nccl", "pccl"]
for device, backend in zip(devices, backends):
assert _get_default_process_group_backend_for_device(device) == backend
Expand Down
Loading