brainglobe / brainglobe-workflows

Workflows that utilise BrainGlobe tools to perform data analysis and visualisation.
BSD 3-Clause "New" or "Revised" License
9 stars 2 forks source link

Force cpu usage on macos-latest runners #114

Closed IgorTatarnikov closed 1 month ago

IgorTatarnikov commented 1 month ago

Before submitting a pull request (PR), please read the contributing guide.

Please fill out as much of this template as you can, but if you have any problems or questions, just leave a comment and we will help out :)

Description

What is this PR

Why is this PR needed? Currently, the macos-latest does not have access to a GPU, however, torch.backends.mps.is_available() returns true leading to issues when keras tries to allocate a tensor on the GPU. This leads to errors during testing.

What does this PR do? Forces keras and torch to use CPU when running on the macos-latest runner (identified by GITHUB_ACTIONS env variable and torch.backends.mps.is_available().

How has this PR been tested?

Tested locally and on CI.

Is this a breaking change?

No

Does this PR require an update to the documentation?

No

Checklist:

codecov[bot] commented 1 month ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 85.83%. Comparing base (2cf2020) to head (39c4210).

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #114 +/- ## ========================================== + Coverage 85.64% 85.83% +0.18% ========================================== Files 16 17 +1 Lines 836 847 +11 ========================================== + Hits 716 727 +11 Misses 120 120 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

adamltyson commented 1 month ago

@IgorTatarnikov is this ready for review?

IgorTatarnikov commented 1 month ago

Yes! Forgot to mark is as ready.