Skip to content

ci: Add MPS testing#490

Closed
ValerianRey wants to merge 12 commits intomainfrom
add-mps-testing
Closed

ci: Add MPS testing#490
ValerianRey wants to merge 12 commits intomainfrom
add-mps-testing

Conversation

@ValerianRey
Copy link
Copy Markdown
Contributor

@ValerianRey ValerianRey commented Dec 16, 2025

  • Add possibility to test on MPS using PYTEST_TORCH_DEVICE=mps environment variable
  • Update CONTRIBUTING.md to explain how to test on MPS
  • Change tests.yml to also test on MPS when device is MacO

There are three main goals with this PR:

  • This ensures that the device=... are properly tested throughout torchjd. Forgetting one of them is the most likely cause of error that would not be caught when testing only on CPU when developing new things. Since this is the same for MPS and cuda, it basically fixes half of the problem of not running the CI on GPU. (The other half is that some device-specific function could behave differently or not even exist on some device, which would make the tests fail if we run them on this device. We cannot test that without running on these device types.)
  • This makes sure we have MPS support, which is a step forward in making torchjd work on any device, and which is good for MacOS users.

@codecov
Copy link
Copy Markdown

codecov bot commented Dec 16, 2025

Codecov Report

❌ Patch coverage is 28.57143% with 5 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
src/torchjd/aggregation/_aligned_mtl.py 28.57% 5 Missing ⚠️
Files with missing lines Coverage Δ
src/torchjd/aggregation/_aligned_mtl.py 88.63% <28.57%> (-11.37%) ⬇️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ValerianRey ValerianRey added the cc: ci Conventional commit type for changes to the CI (Github workflows and actions). label Dec 16, 2025
@ValerianRey ValerianRey marked this pull request as draft December 16, 2025 17:07
@ValerianRey
Copy link
Copy Markdown
Contributor Author

Quite a few things fail because some operations are not yet supported on MPS. They either raise a NotImplementedError, which we now catch, or they raise a warning, which is not so convenient to catch (still need to fix those cases). See pytorch/pytorch#141287 for the status of this on PyTorch side.

Also, in some cases, we get small numerical errors that make the test fail.

Lastly, some ConFIG tests seem to fail by a large margin.

@ValerianRey
Copy link
Copy Markdown
Contributor Author

ValerianRey commented Feb 4, 2026

A bit too much work required for this ATM because quite a lot of necessary operations are still not available on MPS. We should work again on that in ~1 or 2 years I think. Archiving the branch and cherry-picking 32aab4f.

@ValerianRey ValerianRey closed this Feb 4, 2026
@ValerianRey ValerianRey deleted the add-mps-testing branch February 4, 2026 03:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cc: ci Conventional commit type for changes to the CI (Github workflows and actions).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant