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

Add Arm option to building packages on Jenkins #38990

Open
wants to merge 11 commits into
base: main
Choose a base branch
from

Conversation

jclarkeSTFC
Copy link
Contributor

@jclarkeSTFC jclarkeSTFC commented Feb 27, 2025

This adds the option to build a native package for Arm Macs. It will be listed as a new option called osx-arm64, with the existing option remaining as osx-64.

The osx-arm64 platform can only run on Arm macOS machines, and it will compile native Arm code instead of cross-compiling for x86_64. The platform is used for specifying the cmake preset, which is why I added the osx-arm64-ci preset.

Needed for #38973
Fixes #38995

In various places the desired platform is passed as an argument. We cannot simply use the native platform, because any Arm build machine could be either targeting osx-64 or osx-arm64, so we need to know what was selected.

I've simplified some code in mamba-utils, and deleted the bit that was forcing osx-64 on Macs.

When archiving the environment logs we get the platform from the configuration of the current conda environment. This is because that script is called from the build script in the conda recipe, which doesn't know about options specified in Jenkins, so it seemed like the best way of getting that information.

The jemalloc library is pinned to version 5.2.0 for Linux, but 5.2.1 is the first version with an Arm build. Luckily we don't need jemalloc on macOS anyway.

Version 1.0.0b15 of quickbayes does not have an ARM build, so the pip install when creating the standalone will fail in that case. Version 1.0.1b0 is a noarch package, so works on ARM, but it has a pin on numpy<2, so if we pip install that
then numpy in the standalone will be downgraded from 2.* to 1.*. Hence we do not install quickbayes into the macOS ARM standalone package.

To test:

  • On an Arm machine, check that the package runs okay, and is running natively, not under Rosetta.
  • On an Arm machine, check that the old (Intel) package runs okay, and is running under Rosetta.
  • Try running the Core_Team_test_pipeline with the osx-arm64 option and the osx-64 option.
  • Build and test standalone packages on all platforms.

Reviewer

Please comment on the points listed below (full description).
Your comments will be used as part of the gatekeeper process, so please comment clearly on what you have checked during your review. If changes are made to the PR during the review process then your final comment will be the most important for gatekeepers. In this comment you should make it clear why any earlier review is still valid, or confirm that all requested changes have been addressed.

Code Review

  • Is the code of an acceptable quality?
  • Does the code conform to the coding standards?
  • Are the unit tests small and test the class in isolation?
  • If there is GUI work does it follow the GUI standards?
  • If there are changes in the release notes then do they describe the changes appropriately?
  • Do the release notes conform to the release notes guide?

Functional Tests

  • Do changes function as described? Add comments below that describe the tests performed?
  • Do the changes handle unexpected situations, e.g. bad input?
  • Has the relevant (user and developer) documentation been added/updated?

Does everything look good? Mark the review as Approve. A member of @mantidproject/gatekeepers will take care of it.

Gatekeeper

If you need to request changes to a PR then please add a comment and set the review status to "Request changes". This will stop the PR from showing up in the list for other gatekeepers.

@jclarkeSTFC jclarkeSTFC added macOS Only The issues related to macOS only. ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS DevOps Issues and pull requests related to DevOps labels Feb 27, 2025
@jclarkeSTFC jclarkeSTFC added this to the Release 6.13 milestone Feb 27, 2025
@jclarkeSTFC jclarkeSTFC force-pushed the arm_build_package_from_branch branch 8 times, most recently from bfa1ea0 to f5e7c26 Compare March 3, 2025 16:03
@jclarkeSTFC
Copy link
Contributor Author

jclarkeSTFC commented Mar 3, 2025

pre-commit.ci run

@jclarkeSTFC jclarkeSTFC force-pushed the arm_build_package_from_branch branch 2 times, most recently from 25ac9c7 to 755f7a3 Compare March 4, 2025 14:52
@jclarkeSTFC
Copy link
Contributor Author

This is blocked because the version of quickbayes we pip install at the end of the packaging step does not have an Arm build. #39014 will update quickbayes to a version that is noarch so should be no problem. GOFit is an (optional, in latest version) dependency of quickbayes, and now there is now an Arm version of that available after I added it to the migration list on conda-forge.

I've also made a PR conda-forge/staged-recipes#29358 to add quickbayes to conda-forge, so once that is done we can remove the pip install from the script. That way any dependencies will be much easier to spot in the future.

@jclarkeSTFC jclarkeSTFC force-pushed the arm_build_package_from_branch branch from 1893306 to d4b27e7 Compare March 10, 2025 08:56
@jclarkeSTFC jclarkeSTFC marked this pull request as ready for review March 10, 2025 13:35
@jclarkeSTFC jclarkeSTFC marked this pull request as draft March 10, 2025 17:06
@jclarkeSTFC jclarkeSTFC force-pushed the arm_build_package_from_branch branch from b8d2332 to 332c204 Compare March 11, 2025 16:28
The osx-arm64 platform can only run on Arm macOS machines, and it will
compile native Arm code instead of cross-compiling for x86_64. The
platform is used for specifying the cmake preset, which is why I added
the osx-arm64-ci preset.
We need the option to be able to specify the platform so Arm Macs can
either build for osx-64 or osx-arm64. In conda-buildscript we take
the platform from the cmake preset, which should then work with
existing CI. To activate Arm we then just use the osx-arm64-ci preset.
Allow for passing in the target platform, e.g. linux-64 to the
setup_mamba method. The `clean` parameter is now no longer optional
to simplify matters. Where setup_mamba was called without the clean
parameter it now specifies `false` (the old default).
Using the old SDK results in a linker error:

ld: warning: ignoring file /opt/MacOSX10.10.sdk/usr/lib/libSystem.tbd,
missing required architecture arm64 in file /opt/MacOSX10.10.sdk/usr/
lib/libSystem.tbd (2 slices)

macOS 10.10 was released in 2014. The first version of macOS with Arm
support was 11 (Big Sur), released in 2020.
The archive_env_logs script needs to know the platform in order to
extract the log files.
We need the target platform in the script that creates the dmg for
macOS, since it could be either osx-64 or osx-arm64. Previously it was
always osx-64 so could be hard-coded.

I also added the platform name to the dmg file name to avoid a clash
when making both the osx-64 and osx-arm64 standalones.
When archiving the environments, we get the platform from the conda
environment, so we need it to be the correct platform. This only
currently applies when building for osx-64 an a osx-arm64 machine.
Version 1.0.0b15 of quickbayes does not have an ARM build, so the pip
install will fail in that case. Version 1.0.1b0 is a noarch package, so
works on ARM, but it has a pin on numpy<2, so if we pip install that
then numpy in the standalone will be downgraded from 2.* to 1.*. Hence
we do not install quickbayes into the macOS ARM standalone package.
@jclarkeSTFC jclarkeSTFC force-pushed the arm_build_package_from_branch branch from 332c204 to 9e2f83f Compare March 12, 2025 11:59
@jclarkeSTFC
Copy link
Contributor Author

Package build all platforms: Build Status

@jclarkeSTFC jclarkeSTFC marked this pull request as ready for review March 12, 2025 16:14
@jclarkeSTFC
Copy link
Contributor Author

Build and test, then package build, all platforms: Build Status

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DevOps Issues and pull requests related to DevOps ISIS Team: Core Issue and pull requests managed by the Core subteam at ISIS macOS Only The issues related to macOS only.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Add ARM MacOS to build_package_from_branch options
1 participant