Skip to content

Conversation

@ValerianRey
Copy link
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

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 ci label Dec 16, 2025
@ValerianRey ValerianRey marked this pull request as draft December 16, 2025 17:07
@ValerianRey
Copy link
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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants