Skip to content

Commit 23fa90b

Browse files
authored
Include arm64 libtorch in download instructions with auto-generated page (#1507)
MacOS x86 and Macos Arm64 instructions used to be exactly the same, hence we generated all the instructions from MacOS x86. Now since we added arm64 builds for libtorch in nightly these instructions need to get into the getting started page.
1 parent 4add937 commit 23fa90b

File tree

3 files changed

+39
-12
lines changed

3 files changed

+39
-12
lines changed

.github/workflows/update-quick-start-module.yml

+19-1
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,12 @@ jobs:
3838
package-type: all
3939
os: macos
4040
channel: "nightly"
41+
macos-arm64-nightly-matrix:
42+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
43+
with:
44+
package-type: all
45+
os: macos-arm64
46+
channel: "nightly"
4147
linux-release-matrix:
4248
needs: [linux-nightly-matrix]
4349
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
@@ -59,10 +65,18 @@ jobs:
5965
package-type: all
6066
os: macos
6167
channel: "release"
68+
macos-arm64-release-matrix:
69+
needs: [macos-arm64-nightly-matrix]
70+
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main
71+
with:
72+
package-type: all
73+
os: macos-arm64
74+
channel: "release"
6275

6376
update-quick-start:
6477
needs: [linux-nightly-matrix, windows-nightly-matrix, macos-nightly-matrix,
65-
linux-release-matrix, windows-release-matrix, macos-release-matrix]
78+
macos-arm64-nightly-matrix, linux-release-matrix, windows-release-matrix,
79+
macos-release-matrix, macos-arm64-release-matrix]
6680
runs-on: "ubuntu-20.04"
6781
environment: pytorchbot-env
6882
steps:
@@ -79,17 +93,21 @@ jobs:
7993
LINUX_NIGHTLY_MATRIX: ${{ needs.linux-nightly-matrix.outputs.matrix }}
8094
WINDOWS_NIGHTLY_MATRIX: ${{ needs.windows-nightly-matrix.outputs.matrix }}
8195
MACOS_NIGHTLY_MATRIX: ${{ needs.macos-nightly-matrix.outputs.matrix }}
96+
MACOS_ARM64_NIGHTLY_MATRIX: ${{ needs.macos-arm64-nightly-matrix.outputs.matrix }}
8297
LINUX_RELEASE_MATRIX: ${{ needs.linux-release-matrix.outputs.matrix }}
8398
WINDOWS_RELEASE_MATRIX: ${{ needs.windows-release-matrix.outputs.matrix }}
8499
MACOS_RELEASE_MATRIX: ${{ needs.macos-release-matrix.outputs.matrix }}
100+
MACOS_ARM64_RELEASE_MATRIX: ${{ needs.macos-arm64-release-matrix.outputs.matrix }}
85101
run: |
86102
set -ex
87103
printf '%s\n' "$LINUX_NIGHTLY_MATRIX" > linux_nightly_matrix.json
88104
printf '%s\n' "$WINDOWS_NIGHTLY_MATRIX" > windows_nightly_matrix.json
89105
printf '%s\n' "$MACOS_NIGHTLY_MATRIX" > macos_nightly_matrix.json
106+
printf '%s\n' "$MACOS_ARM64_NIGHTLY_MATRIX" > macos_arm64_nightly_matrix.json
90107
printf '%s\n' "$LINUX_RELEASE_MATRIX" > linux_release_matrix.json
91108
printf '%s\n' "$WINDOWS_RELEASE_MATRIX" > windows_release_matrix.json
92109
printf '%s\n' "$MACOS_RELEASE_MATRIX" > macos_release_matrix.json
110+
printf '%s\n' "$MACOS_ARM64_RELEASE_MATRIX" > macos_arm64_release_matrix.json
93111
python3 ./scripts/gen_quick_start_module.py --autogenerate > assets/quick-start-module.js
94112
rm *_matrix.json
95113
- name: Create Issue if failed

published_versions.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -118,8 +118,8 @@
118118
"accnone": {
119119
"note": null,
120120
"versions": {
121-
"Download x86 libtorch here": "https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-x86_64-latest.zip",
122-
"Download arm64 libtorch here": "https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-arm64-latest.zip"
121+
"Download x86 libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-x86_64-latest.zip",
122+
"Download arm64 libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/nightly/cpu/libtorch-macos-arm64-latest.zip"
123123
}
124124
},
125125
"cuda.x": {
@@ -2986,28 +2986,28 @@
29862986
"accnone": {
29872987
"note": null,
29882988
"versions": {
2989-
"Download default libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
2989+
"Download x86 libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
29902990
}
29912991
},
29922992
"cuda.x": {
29932993
"note": null,
29942994
"default": true,
29952995
"versions": {
2996-
"Download default libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
2996+
"Download x86 libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
29972997
}
29982998
},
29992999
"cuda.y": {
30003000
"note": null,
30013001
"default": true,
30023002
"versions": {
3003-
"Download default libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
3003+
"Download x86 libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
30043004
}
30053005
},
30063006
"rocm5.x": {
30073007
"note": null,
30083008
"default": true,
30093009
"versions": {
3010-
"Download default libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
3010+
"Download x86 libtorch here (ROCm and CUDA are not supported):": "https://download.pytorch.org/libtorch/cpu/libtorch-macos-2.1.0.zip"
30113011
}
30123012
}
30133013
}

scripts/gen_quick_start_module.py

+14-5
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ class OperatingSystem(Enum):
2121
LINUX: str = "linux"
2222
WINDOWS: str = "windows"
2323
MACOS: str = "macos"
24+
MACOS_ARM64: str = "macos_arm64"
2425

2526
PRE_CXX11_ABI = "pre-cxx11"
2627
CXX11_ABI = "cxx11-abi"
@@ -123,6 +124,16 @@ def update_versions(versions, release_matrix, release_version):
123124
if (x["package_type"], x["gpu_arch_type"], x["gpu_arch_version"]) ==
124125
(package_type, gpu_arch_type, gpu_arch_version)
125126
]
127+
# MACOS and MACOS_ARM64 release matrices are reduced to
128+
# one single matrix in get started page. This is the only
129+
# OS that this logic applies to. Hence this logic is needed.
130+
pkg_arch_matrix_arm64 = []
131+
if os_key == OperatingSystem.MACOS.value and package_type == "libtorch":
132+
pkg_arch_matrix_arm64 = [
133+
x for x in release_matrix[OperatingSystem.MACOS_ARM64.value]
134+
if (x["package_type"], x["gpu_arch_type"], x["gpu_arch_version"]) ==
135+
(package_type, gpu_arch_type, gpu_arch_version)
136+
]
126137

127138
if pkg_arch_matrix:
128139
if package_type != "libtorch":
@@ -142,12 +153,10 @@ def update_versions(versions, release_matrix, release_version):
142153
for ver in [RELEASE, DEBUG]:
143154
instr["versions"][LIBTORCH_DWNL_INSTR[ver]] = rel_entry_dict[ver]
144155
elif os_key == OperatingSystem.MACOS.value:
145-
rel_entry_dict = {
146-
x["devtoolset"]: x["installation"] for x in pkg_arch_matrix
147-
if x["libtorch_variant"] == "shared-with-deps"
148-
}
149156
if instr["versions"] is not None:
150-
instr["versions"][LIBTORCH_DWNL_INSTR[MACOS]] = list(rel_entry_dict.values())[0]
157+
instr["versions"][LIBTORCH_DWNL_INSTR[MACOS]] = pkg_arch_matrix[0]["installation"]
158+
if len(pkg_arch_matrix_arm64) > 0:
159+
instr["versions"][LIBTORCH_DWNL_INSTR[MACOS_ARM64]] = pkg_arch_matrix_arm64[0]["installation"]
151160

152161
# This method is used for generating new quick-start-module.js
153162
# from the versions json object

0 commit comments

Comments
 (0)