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

macos arm64 build #53

Merged
merged 15 commits into from
Jan 31, 2021
9 changes: 9 additions & 0 deletions .github/workflows/multibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
PLAT: [i686, x86_64]
INTERFACE64: ['', '1']
MB_ML_VER: ['', 2010, 2014]
include:
- os: macos-latest
PLAT: arm64
INTERFACE64: ''
platform: [x64]
Copy link
Collaborator

Choose a reason for hiding this comment

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

I am not sure we need platform at all in this file, it might be some cruft left over from the transition to github actions?

Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add a comment to explain that this entry of the build matrix is using cross-compilation to build an macos/arm64 on a macos/x86_64 host (typically on github actions that does not provide native macos/arm64 runners at this time).

exclude:
- os: macos-latest
PLAT: i686
Expand Down Expand Up @@ -66,6 +71,10 @@ jobs:
pip install virtualenv
- name: Build and Install Wheels
run: |
if [[ "$PLAT" == "arm64" ]]; then
sudo xcode-select -switch /Applications/Xcode_12.2.app
export SDKROOT=/Applications/Xcode_12.2.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX11.0.sdk
isuruf marked this conversation as resolved.
Show resolved Hide resolved
fi
source travis-ci/build_steps.sh
echo "------ BEFORE BUILD ---------"
before_build
Expand Down
2 changes: 1 addition & 1 deletion gfortran-install
25 changes: 17 additions & 8 deletions travis-ci/build_steps.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ ROOT_DIR=$(dirname $(dirname "${BASH_SOURCE[0]}"))
source ${ROOT_DIR}/multibuild/common_utils.sh
source ${ROOT_DIR}/gfortran-install/gfortran_utils.sh

MB_PYTHON_VERSION=3.7
MB_PYTHON_VERSION=3.9

function before_build {
# Manylinux Python version set in build_lib
Expand Down Expand Up @@ -44,7 +44,7 @@ function build_lib {
# Make directory to store built archive
if [ -n "$IS_OSX" ]; then
# Do build, add gfortran hash to end of name
do_build_lib "$plat" "gf_${GFORTRAN_SHA:0:7}" "$interface64"
wrap_wheel_builder do_build_lib "$plat" "gf_${GFORTRAN_SHA:0:7}" "$interface64"
return
fi
# Manylinux wrapper
Expand Down Expand Up @@ -85,24 +85,33 @@ function do_build_lib {
local suffix=$2
local interface64=$3
echo "Building with settings: '$plat' '$suffix' '$interface64'"
case $plat in
x86_64)
case $(get_os)-$plat in
Linux-x86_64)
local bitness=64
local target_flags="TARGET=PRESCOTT"
;;
i686)
Darwin-x86_64)
local bitness=64
local target_flags="TARGET=CORE2"
;;
*-i686)
local bitness=32
local target_flags="TARGET=PRESCOTT"
;;
aarch64)
Linux-aarch64)
local bitness=64
local target_flags="TARGET=ARMV8"
;;
s390x)
Darwin-arm64)
local bitness=64
local target_flags="TARGET=VORTEX"
;;
isuruf marked this conversation as resolved.
Show resolved Hide resolved
*-s390x)
local bitness=64
;;
ppc64le)
*-ppc64le)
local bitness=64
local target_flags="TARGET=POWER8"
Copy link
Contributor

Choose a reason for hiding this comment

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

I wonder if this change will impact the future numpy / scipy wheels built for ppc64le. Those wheels are typically built on a PPC host (without cross-compilation) so maybe this won't change a thing (but I agree it's best to make the target architecture explicit).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Those wheels are typically built on a PPC host (without cross-compilation) so maybe this won't change a thing

It will if the host becomes a power9 or power10 some day.

;;
*) echo "Strange plat value $plat"; exit 1 ;;
esac
Expand Down