test(vom-gpu): gate on CUDA, not gpu_available — MPS was initialised in the parent - #131
Merged
Conversation
macos-latest-py3.13 aborts (SIGABRT) immediately after this file's three subprocess tests return, on main and every branch since. gpu_available() is True on Apple MPS, and it is called at MODULE level -- so on a Mac runner pytest COLLECTION initialises Metal in the parent process, which never does GPU work itself and only shells out. The subprocess pattern exists precisely to keep torch out of the pytest process (Windows CUDA segfault); probing MPS at collection defeats it on the other platform. Default path now checks torch.cuda.is_available() and imports nothing from the GPU module, so the parent stays Metal-free. SPYDE_GPU_TESTS=1 restores the old predicate for a Mac repro. Mac accelerator coverage is unchanged: test_device_lock.py pins the serialisation contract and the fit runs in the real app.
CSSFrancis
marked this pull request as ready for review
August 9, 2026 21:32
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes main's red
macos-latest-py3.13leg (also red on every branch cut since):Fatal Python error: Abortedimmediately aftertest_vector_orientation_gpu.py's three subprocess tests return their results.Mechanism — not just a skip:
gpu_available()is True on Apple MPS, and this file calls it at module level, so on a Mac runner pytest collection initialises Metal in the parent process. That parent never does GPU work — the whole point of this file is that torch runs in a hard-exiting subprocess (the Windows CUDA-segfault pattern). Probing MPS at import defeats that isolation on the other platform, leaving an initialised Metal context in a long-lived process that goes on to run ~1300 more tests.The default path now checks
torch.cuda.is_available()and imports nothing from the GPU module, so the parent stays Metal-free.SPYDE_GPU_TESTS=1restores the old predicate for reproducing on a Mac.Mac accelerator coverage is unchanged:
test_device_lock.pypins that every torch call site serialises through the shared lock, and the fit runs in the real app. This is the third instance of the same policy (EBSD wizard →SPYDE_EBSD_DEVICE=cpuin #125; neural batch-memory → CUDA-specific skip in #127): accelerator work under the pytest harness belongs in a subprocess or not at all.Verified on the CUDA dev box: 3 passed, 20.4 s (the tests still run where they're meant to).