From ad1a70a71a9b92e01412993c938515bd19597690 Mon Sep 17 00:00:00 2001 From: Bhimraj Yadav Date: Tue, 19 Aug 2025 19:42:27 +0000 Subject: [PATCH 1/7] Fix: Simplify MPS availability check by removing platform dependency --- src/lightning/fabric/accelerators/mps.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/lightning/fabric/accelerators/mps.py b/src/lightning/fabric/accelerators/mps.py index b535ba57ed4cb..b693e5e11b45c 100644 --- a/src/lightning/fabric/accelerators/mps.py +++ b/src/lightning/fabric/accelerators/mps.py @@ -72,7 +72,7 @@ def auto_device_count() -> int: def is_available() -> bool: """MPS is only available on a machine with the ARM-based Apple Silicon processors.""" mps_disabled = os.getenv("DISABLE_MPS", "0") == "1" - return not mps_disabled and torch.backends.mps.is_available() and platform.processor() in ("arm", "arm64") + return not mps_disabled and torch.backends.mps.is_available() @classmethod @override From b29bc5b55f0a62dcb472f0a3b43404af2660d603 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Tue, 19 Aug 2025 19:43:07 +0000 Subject: [PATCH 2/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- src/lightning/fabric/accelerators/mps.py | 1 - 1 file changed, 1 deletion(-) diff --git a/src/lightning/fabric/accelerators/mps.py b/src/lightning/fabric/accelerators/mps.py index b693e5e11b45c..473cb14b8b8fb 100644 --- a/src/lightning/fabric/accelerators/mps.py +++ b/src/lightning/fabric/accelerators/mps.py @@ -12,7 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. import os -import platform from functools import lru_cache from typing import Optional, Union From ba72d395db1b061cdd58fe90f40bf1d900cc761f Mon Sep 17 00:00:00 2001 From: Bhimraj Yadav Date: Tue, 19 Aug 2025 20:07:35 +0000 Subject: [PATCH 3/7] Add macOS-13 to CI matrix for PyTorch testing --- .github/workflows/ci-tests-pytorch.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index e527961590c3a..2f0ca6a284bc2 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -44,6 +44,7 @@ jobs: matrix: include: # only run PyTorch latest + - { os: "macOS-13", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "windows-2022", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } From a9454a90a981f97ce90f47f273e32aad40f1360e Mon Sep 17 00:00:00 2001 From: Bhimraj Yadav Date: Wed, 20 Aug 2025 06:13:36 +0000 Subject: [PATCH 4/7] Add macOS-13 to CI matrix --- .github/workflows/ci-tests-fabric.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index 888de9bdb4a09..5498ba342a5aa 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -40,6 +40,7 @@ jobs: matrix: include: # only run PyTorch latest + - { os: "macOS-13", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "windows-2022", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } From 94d84a26a58dacdc0d953f7ef0194421bd7ef846 Mon Sep 17 00:00:00 2001 From: Bhimraj Yadav Date: Wed, 20 Aug 2025 06:15:13 +0000 Subject: [PATCH 5/7] # trigger pytorch test --- tests/tests_pytorch/accelerators/test_mps.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tests_pytorch/accelerators/test_mps.py b/tests/tests_pytorch/accelerators/test_mps.py index c0a28840f0ef6..2089779248b64 100644 --- a/tests/tests_pytorch/accelerators/test_mps.py +++ b/tests/tests_pytorch/accelerators/test_mps.py @@ -23,6 +23,7 @@ from lightning.pytorch.demos.boring_classes import BoringModel from tests_pytorch.helpers.runif import RunIf +# trigger pytorch test @RunIf(mps=True) def test_get_mps_stats(): From 9c8345a339b98c7c641384d4f1ad23e8df025672 Mon Sep 17 00:00:00 2001 From: "pre-commit-ci[bot]" <66853113+pre-commit-ci[bot]@users.noreply.github.com> Date: Wed, 20 Aug 2025 06:15:37 +0000 Subject: [PATCH 6/7] [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci --- tests/tests_pytorch/accelerators/test_mps.py | 1 + 1 file changed, 1 insertion(+) diff --git a/tests/tests_pytorch/accelerators/test_mps.py b/tests/tests_pytorch/accelerators/test_mps.py index 2089779248b64..2c0f13ba32219 100644 --- a/tests/tests_pytorch/accelerators/test_mps.py +++ b/tests/tests_pytorch/accelerators/test_mps.py @@ -25,6 +25,7 @@ # trigger pytorch test + @RunIf(mps=True) def test_get_mps_stats(): current_device = torch.device("mps") From f6310f707866cd0b47a3e2a56a2faeddb6dbff3a Mon Sep 17 00:00:00 2001 From: Jirka Borovec <6035284+Borda@users.noreply.github.com> Date: Thu, 21 Aug 2025 10:10:56 +0200 Subject: [PATCH 7/7] Apply suggestions from code review --- .github/workflows/ci-tests-fabric.yml | 1 + .github/workflows/ci-tests-pytorch.yml | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci-tests-fabric.yml b/.github/workflows/ci-tests-fabric.yml index 5498ba342a5aa..d6d5dfb7ab6ca 100644 --- a/.github/workflows/ci-tests-fabric.yml +++ b/.github/workflows/ci-tests-fabric.yml @@ -40,6 +40,7 @@ jobs: matrix: include: # only run PyTorch latest + # macOS-13 is the latest version without Apple silicon - { os: "macOS-13", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } diff --git a/.github/workflows/ci-tests-pytorch.yml b/.github/workflows/ci-tests-pytorch.yml index 2f0ca6a284bc2..ba51c12863dfd 100644 --- a/.github/workflows/ci-tests-pytorch.yml +++ b/.github/workflows/ci-tests-pytorch.yml @@ -43,7 +43,7 @@ jobs: fail-fast: false matrix: include: - # only run PyTorch latest + # macOS-13 is the latest version without Apple silicon - { os: "macOS-13", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "macOS-14", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" } - { os: "ubuntu-22.04", pkg-name: "lightning", python-version: "3.10", pytorch-version: "2.1" }