Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Experimental Apple Silicon (M1) support #1924

Merged
merged 7 commits into from Jul 5, 2022

Conversation

Corwinpro
Copy link
Contributor

@Corwinpro Corwinpro commented Jul 3, 2022

PR type: enhancement

Related issue(s)/PRs: Contributes to #1850

Summary

Proposed changes

This PR introduces basic support for Apple Silicon MacOS. This is achieved by pulling tensorflow-macos dependency instead of regular tensorflow at setup time.

This has been tested on an Macbook Pro 2021 M1 Pro, python3.8.

  • Update setup.py to dynamically decide on the tensorflow source depending on the platform
  • Changes in gpflow/utilities/traversal.py and test_traversal.py come from the common type of errors that 0.999999 != 1.0 and representation of floating point numbers.

What alternatives have you considered?

No alternatives have been considered. Please let me know if there are any.

Minimal working example

python3.8 -m venv gpflow-py38
source gpflow-py38/bin/activate
python -m pip install -e .
python -m pip install -r tests_requirements.txt
make format
make check-all

Known problems

With python3.8 installed via brew, integration tests for notebooks sometimes fail with OSError: too many files open. I think this is a known issue and can be addressed separately.

Fully backwards compatible: yes

PR checklist

  • New features: code is well-documented
    • detailed docstrings (API documentation)
    • notebook examples (usage demonstration)
  • The bug case / new feature is covered by unit tests
  • Code has type annotations
  • Build checks
    • I ran the black+isort formatter (make format)
    • I locally tested that the tests pass (make check-all)
  • Release management
    • RELEASE.md updated with entry for this change
    • New contributors: I've added myself to CONTRIBUTORS.md

@codecov
Copy link

codecov bot commented Jul 3, 2022

Codecov Report

Merging #1924 (f024024) into develop (5110164) will increase coverage by 0.00%.
The diff coverage is 100.00%.

@@           Coverage Diff            @@
##           develop    #1924   +/-   ##
========================================
  Coverage    97.96%   97.96%           
========================================
  Files          109      109           
  Lines         6351     6352    +1     
========================================
+ Hits          6222     6223    +1     
  Misses         129      129           
Impacted Files Coverage Δ
gpflow/utilities/traversal.py 96.52% <100.00%> (+0.02%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 5110164...f024024. Read the comment docs.

Copy link
Member

@jesnie jesnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for doing this. It's been on our TODO list for a while, but I don't have access to a mac , so I've not been able to do it myself.

gpflow/utilities/traversal.py Show resolved Hide resolved
setup.py Outdated Show resolved Hide resolved
@Corwinpro
Copy link
Contributor Author

It's been on our TODO list for a while, but I don't have access to a mac , so I've not been able to do it myself.

IIUC, github actions will be (or maybe already has) introducing support for arm64 runners. I am not sure if GPflow can use Github actions for free as a FOSS. If it is possible, we can consider adding CI for this platform.

@Corwinpro Corwinpro changed the title [WIP] Experimental Apple Silicon (M1) support Experimental Apple Silicon (M1) support Jul 4, 2022
Copy link
Member

@jesnie jesnie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Can you do a pull from develop to get this up-to-date?

@jesnie jesnie merged commit 4373ecc into GPflow:develop Jul 5, 2022
@Corwinpro Corwinpro deleted the corwinpro/dev/macos-m1-support branch July 5, 2022 11:13
@Corwinpro
Copy link
Contributor Author

FWIW, I don't think there will be support for GH hosted arm64 MacOS runners any time soon. I will keep an eye on that, and add one once those are available.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants