Skip to content

Commit 8e68292

Browse files
authored
build wheels for Linux ARM64 (deepmodeling#2179)
With deepmodeling#2180, now it only has 4 tasks to build wheels. But this task is still so slow.. Signed-off-by: Jinzhe Zeng <jinzhe.zeng@rutgers.edu>
1 parent eab018e commit 8e68292

4 files changed

Lines changed: 27 additions & 11 deletions

File tree

.github/workflows/build_wheel.yml

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,30 +16,42 @@ jobs:
1616
- os: ubuntu-latest
1717
python: 310
1818
platform_id: manylinux_x86_64
19+
dp_variant: cuda
1920
# macos-x86-64
2021
- os: macos-latest
2122
python: 310
2223
platform_id: macosx_x86_64
24+
dp_variant: cpu
2325
# win-64
2426
- os: windows-2019
2527
python: 310
2628
platform_id: win_amd64
29+
dp_variant: cpu
30+
# linux-aarch64
31+
- os: ubuntu-latest
32+
python: 310
33+
platform_id: manylinux_aarch64
34+
dp_variant: cpu
2735
steps:
2836
- uses: actions/checkout@v2
2937
with:
3038
submodules: true
39+
- uses: docker/setup-qemu-action@v2
40+
name: Setup QEMU
41+
if: matrix.platform_id == 'manylinux_aarch64'
3142
- uses: actions/setup-python@v2
3243
name: Install Python
3344
with:
3445
python-version: '3.8'
3546

36-
- run: python -m pip install cibuildwheel==2.11.2
47+
- run: python -m pip install cibuildwheel==2.11.3
3748
- name: Build wheels
3849
run: python -m cibuildwheel --output-dir wheelhouse
3950
env:
4051
CIBW_BUILD_VERBOSITY: 1
4152
CIBW_ARCHS: all
4253
CIBW_BUILD: cp${{ matrix.python }}-${{ matrix.platform_id }}
54+
DP_VARIANT: ${{ matrix.dp_variant }}
4355
- uses: actions/upload-artifact@v2
4456
with:
4557
path: ./wheelhouse/*.whl

backend/find_tensorflow.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -88,18 +88,18 @@ def get_tf_requirement(tf_version: str = "") -> dict:
8888

8989
if tf_version == "":
9090
return {
91-
"cpu": ["tensorflow-cpu"],
92-
"gpu": ["tensorflow"],
91+
"cpu": ["tensorflow-cpu; platform_machine!='aarch64'", "tensorflow; platform_machine=='aarch64'"],
92+
"gpu": ["tensorflow; platform_machine!='aarch64'", "tensorflow; platform_machine=='aarch64'"],
9393
}
9494
elif tf_version in SpecifierSet("<1.15") or tf_version in SpecifierSet(">=2.0,<2.1"):
9595
return {
96-
"cpu": [f"tensorflow=={tf_version}"],
97-
"gpu": [f"tensorflow-gpu=={tf_version}"],
96+
"cpu": [f"tensorflow=={tf_version}; platform_machine!='aarch64'", f"tensorflow=={tf_version}; platform_machine=='aarch64'"],
97+
"gpu": [f"tensorflow-gpu=={tf_version}; platform_machine!='aarch64'", f"tensorflow=={tf_version}; platform_machine=='aarch64'"],
9898
}
9999
else:
100100
return {
101-
"cpu": [f"tensorflow-cpu=={tf_version}"],
102-
"gpu": [f"tensorflow=={tf_version}"],
101+
"cpu": [f"tensorflow-cpu=={tf_version}; platform_machine!='aarch64'", f"tensorflow=={tf_version}; platform_machine=='aarch64'"],
102+
"gpu": [f"tensorflow=={tf_version}; platform_machine!='aarch64'", f"tensorflow=={tf_version}; platform_machine=='aarch64'"],
103103
}
104104

105105

doc/install/easy-install.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,7 +95,7 @@ Or install the CPU version without CUDA supported:
9595
pip install deepmd-kit[cpu]
9696
```
9797

98-
The supported platform includes Linux x86-64 with GNU C Library 2.28 or above, macOS x86-64, and Windows x86-64.
98+
The supported platform includes Linux x86-64 and aarch64 with GNU C Library 2.28 or above, macOS x86-64, and Windows x86-64.
9999
A specific version of TensorFlow which is compatible with DeePMD-kit will be also installed.
100100

101101
:::{Warning}

pyproject.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -55,15 +55,19 @@ build = ["cp310-*"]
5555
skip = ["*-win32", "*-manylinux_i686", "*-musllinux*"]
5656
# TODO: bump to "latest" tag when CUDA supports GCC 12
5757
manylinux-x86_64-image = "quay.io/pypa/manylinux_2_28_x86_64:2022-11-19-1b19e81"
58+
manylinux-aarch64-image = "quay.io/pypa/manylinux_2_28_aarch64:2022-11-19-1b19e81"
5859

5960
[tool.cibuildwheel.macos]
6061
repair-wheel-command = "delocate-wheel --require-archs {delocate_archs} -w {dest_dir} -v {wheel} --ignore-missing-dependencies"
6162

6263
[tool.cibuildwheel.linux]
6364
repair-wheel-command = "auditwheel repair --exclude libtensorflow_framework.so.2 --exclude libtensorflow_framework.so.1 --exclude libtensorflow_framework.so -w {dest_dir} {wheel}"
64-
environment-pass = ["CIBW_BUILD"]
65-
environment = { DP_VARIANT="cuda" }
66-
before-all = "yum config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && yum install -y cuda-11-8"
65+
environment-pass = ["CIBW_BUILD", "DP_VARIANT"]
66+
before-all = """
67+
if [ "$(uname -m)" = "x86_64" ]; then
68+
yum config-manager --add-repo http://developer.download.nvidia.com/compute/cuda/repos/rhel8/x86_64/cuda-rhel8.repo && yum install -y cuda-11-8
69+
fi
70+
"""
6771

6872
# selectively turn of lintner warnings, always include reasoning why any warning should
6973
# be silenced

0 commit comments

Comments
 (0)