Skip to content

Commit be43748

Browse files
njzjzwanghan-iapcm
authored andcommitted
build macos-arm64 wheel on M1 runners (#3206)
Today [GitHub introduced the new M1 runners](https://github.blog/changelog/2024-01-30-github-actions-introducing-the-new-m1-macos-runner-available-to-open-source/), making it possible to build macos-arm64 wheels without cross-building. Remove old hacked codes for cross-building. (cherry picked from commit 664c70b)
1 parent a576609 commit be43748

File tree

3 files changed

+4
-12
lines changed

3 files changed

+4
-12
lines changed

.github/workflows/build_wheel.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,12 +41,12 @@ jobs:
4141
cuda_version: 11.8
4242
dp_pkg_name: deepmd-kit-cu11
4343
# macos-x86-64
44-
- os: macos-latest
44+
- os: macos-13
4545
python: 311
4646
platform_id: macosx_x86_64
4747
dp_variant: cpu
4848
# macos-arm64
49-
- os: macos-latest
49+
- os: macos-14
5050
python: 311
5151
platform_id: macosx_arm64
5252
dp_variant: cpu

backend/find_tensorflow.py

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -50,12 +50,6 @@ def find_tensorflow() -> Tuple[Optional[str], List[str]]:
5050
requires = []
5151

5252
tf_spec = None
53-
if os.environ.get("CIBUILDWHEEL", "0") == "1" and os.environ.get(
54-
"CIBW_BUILD", ""
55-
).endswith("macosx_arm64"):
56-
# cibuildwheel cross build
57-
site_packages = Path(os.environ.get("RUNNER_TEMP")) / "tensorflow"
58-
tf_spec = FileFinder(str(site_packages)).find_spec("tensorflow")
5953

6054
if (tf_spec is None or not tf_spec) and os.environ.get(
6155
"TENSORFLOW_ROOT"

pyproject.toml

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -141,12 +141,10 @@ manylinux-aarch64-image = "manylinux_2_28"
141141
[tool.cibuildwheel.macos]
142142
environment = { PIP_PREFER_BINARY="1", DP_LAMMPS_VERSION="stable_2Aug2023_update2", DP_ENABLE_IPI="1" }
143143
before-all = [
144+
# enable MPI for macos-arm64 in the next lammps release for compatibility
144145
"""if [[ "$CIBW_BUILD" != *macosx_arm64* ]]; then brew install mpich; fi""",
145146
]
146-
before-build = [
147-
"""if [[ "$CIBW_BUILD" == *macosx_arm64* ]]; then python -m pip install "tensorflow-macos>=2.13.0rc0" --platform macosx_12_0_arm64 --no-deps --target=$RUNNER_TEMP/tensorflow; fi""",
148-
]
149-
repair-wheel-command = """if [[ "$CIBW_BUILD" == *macosx_arm64* ]]; then rm -rf $RUNNER_TEMP/tensorflow; fi && delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} --ignore-missing-dependencies"""
147+
repair-wheel-command = """delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} --ignore-missing-dependencies"""
150148

151149
[tool.cibuildwheel.linux]
152150
repair-wheel-command = "auditwheel repair --exclude libtensorflow_framework.so.2 --exclude libtensorflow_framework.so.1 --exclude libtensorflow_framework.so --exclude _pywrap_tensorflow_internal.so --exclude libtensorflow_cc.so.2 -w {dest_dir} {wheel}"

0 commit comments

Comments
 (0)