Skip to content

Commit 8905c6b

Browse files
authored
Provide pre-built wheels for torch 2.3.0 (#1283)
1 parent 50cdb51 commit 8905c6b

8 files changed

+80
-38
lines changed

.github/workflows/macos-cpu-wheels.yml

+22-8
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ jobs:
2525
id: set-matrix
2626
run: |
2727
# outputting for debugging purposes
28-
python ./scripts/github_actions/generate_build_matrix.py --for-macos
29-
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos)
28+
# python ./scripts/github_actions/generate_build_matrix.py --for-macos
29+
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos)
3030
31-
# python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch
32-
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch)
31+
python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch
32+
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-macos --test-only-latest-torch)
3333
echo "::set-output name=matrix::${MATRIX}"
3434
3535
build_wheels_macos_cpu:
3636
needs: generate_build_matrix
3737
name: ${{ matrix.torch }} ${{ matrix.python-version }}
38-
runs-on: macos-latest
38+
runs-on: macos-14
3939
strategy:
4040
fail-fast: false
4141
matrix:
@@ -47,14 +47,14 @@ jobs:
4747
fetch-depth: 0
4848

4949
- name: Setup Python
50-
uses: actions/setup-python@v2
50+
uses: actions/setup-python@v5
5151
with:
5252
python-version: ${{ matrix.python-version }}
5353

5454
- name: Install dependencies
5555
shell: bash
5656
run: |
57-
pip install -q torch==${{ matrix.torch}} cmake numpy wheel twine setuptools
57+
pip install -q torch==${{ matrix.torch}} cmake numpy wheel>=0.40.0 twine setuptools
5858
5959
- name: Build wheel
6060
shell: bash
@@ -63,7 +63,21 @@ jobs:
6363
mkdir wheelhouse
6464
cp -v dist/* wheelhouse
6565
66-
- name: Display wheels
66+
- name: Display wheels (before fix)
67+
shell: bash
68+
run: |
69+
ls -lh ./wheelhouse/
70+
71+
- name: Fix wheel platform tag
72+
run: |
73+
# See https://github.com/glencoesoftware/zeroc-ice-py-macos-x86_64/pull/3/files
74+
# See:
75+
# * https://github.com/pypa/wheel/issues/406
76+
python -m wheel tags \
77+
--platform-tag=macosx_11_0_arm64 \
78+
--remove wheelhouse/*.whl
79+
80+
- name: Display wheels (after fix)
6781
shell: bash
6882
run: |
6983
ls -lh ./wheelhouse/

.github/workflows/ubuntu-cpu-wheels.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
id: set-matrix
2626
run: |
2727
# outputting for debugging purposes
28-
python ./scripts/github_actions/generate_build_matrix.py
29-
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py)
28+
# python ./scripts/github_actions/generate_build_matrix.py
29+
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py)
3030
31-
# python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch
32-
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch)
31+
python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch
32+
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --test-only-latest-torch)
3333
echo "::set-output name=matrix::${MATRIX}"
3434
3535
build-manylinux-wheels:

.github/workflows/ubuntu-cuda-wheels.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
id: set-matrix
2626
run: |
2727
# outputting for debugging purposes
28-
# python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch
29-
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch)
28+
python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch
29+
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda --test-only-latest-torch)
3030
31-
python ./scripts/github_actions/generate_build_matrix.py --enable-cuda
32-
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda)
31+
# python ./scripts/github_actions/generate_build_matrix.py --enable-cuda
32+
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --enable-cuda)
3333
3434
echo "::set-output name=matrix::${MATRIX}"
3535

.github/workflows/windows-x64-cpu-wheels.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -25,11 +25,11 @@ jobs:
2525
id: set-matrix
2626
run: |
2727
# outputting for debugging purposes
28-
python ./scripts/github_actions/generate_build_matrix.py --for-windows
29-
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-windows)
28+
# python ./scripts/github_actions/generate_build_matrix.py --for-windows
29+
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-windows)
3030
31-
# python ./scripts/github_actions/generate_build_matrix.py --for-windows --test-only-latest-torch
32-
# MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-windows --test-only-latest-torch)
31+
python ./scripts/github_actions/generate_build_matrix.py --for-windows --test-only-latest-torch
32+
MATRIX=$(python ./scripts/github_actions/generate_build_matrix.py --for-windows --test-only-latest-torch)
3333
echo "::set-output name=matrix::${MATRIX}"
3434
3535
build_wheels_win64_cpu:

cmake/torch.cmake

+2
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,8 @@ execute_process(
88
)
99

1010
list(APPEND CMAKE_PREFIX_PATH "${TORCH_DIR}")
11+
include_directories(${TORCH_DIR}/include/torch/csrc/api/include)
12+
include_directories(${TORCH_DIR}/include)
1113

1214
if(NOT DEFINED TORCH_LIBRARY)
1315
find_package(Torch REQUIRED)

scripts/github_actions/build-ubuntu-cuda.sh

+19-17
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,8 @@ python3 -m pip install bs4 requests tqdm auditwheel
6767
echo "Installing torch"
6868
./install_torch.sh
6969

70+
sed -i.bak /9.0a/d /Python-*/py-3.*/lib/python3.*/site-packages/torch/share/cmake/Caffe2/Modules_CUDA_fix/upstream/FindCUDA/select_compute_arch.cmake
71+
7072
rm -rf ~/.cache/pip >/dev/null 2>&1
7173
yum clean all >/dev/null 2>&1
7274

@@ -91,33 +93,33 @@ auditwheel --verbose repair \
9193
--exclude libtorch_cuda.so \
9294
--exclude libtorch_python.so \
9395
\
94-
--exclude libcudnn.so.8 \
96+
--exclude libcublas.so \
9597
--exclude libcublas.so.11 \
96-
--exclude libcublasLt.so.11 \
9798
--exclude libcublas.so.12 \
98-
--exclude libcublas.so \
99-
--exclude libcublasLt.so.12 \
10099
--exclude libcublasLt.so \
100+
--exclude libcublasLt.so.11 \
101+
--exclude libcublasLt.so.12 \
101102
--exclude libcudart.so.11.0 \
102103
--exclude libcudart.so.12 \
103-
--exclude libnvrtc.so.11.2 \
104-
--exclude libnvrtc.so.12 \
105-
--exclude libnvrtc.so \
106-
--exclude libcupti.so.12 \
104+
--exclude libcudnn.so.8 \
105+
--exclude libcufft.so \
106+
--exclude libcufft.so.11 \
107107
--exclude libcupti.so \
108-
--exclude libcusparse.so.12 \
109-
--exclude libcusparse.so \
110-
--exclude libnvJitLink.so.12 \
111-
--exclude libnvJitLink.so \
112-
--exclude libcurand.so.10 \
108+
--exclude libcupti.so.12 \
113109
--exclude libcurand.so \
114-
--exclude libcufft.so.11 \
115-
--exclude libcufft.so \
116-
--exclude libnccl.so.2 \
110+
--exclude libcurand.so.10 \
111+
--exclude libcusparse.so \
112+
--exclude libcusparse.so.12 \
117113
--exclude libnccl.so \
114+
--exclude libnccl.so.2 \
115+
--exclude libnvJitLink.so \
116+
--exclude libnvJitLink.so.12 \
117+
--exclude libnvrtc.so \
118+
--exclude libnvrtc.so.11.2 \
119+
--exclude libnvrtc.so.12 \
118120
--exclude libshm.so \
119-
--exclude libtorch_cuda_cu.so \
120121
--exclude libtorch_cuda_cpp.so \
122+
--exclude libtorch_cuda_cu.so \
121123
--plat manylinux_2_17_x86_64 \
122124
-w /var/www/wheelhouse \
123125
dist/*.whl

scripts/github_actions/generate_build_matrix.py

+10-1
Original file line numberDiff line numberDiff line change
@@ -208,10 +208,16 @@ def generate_build_matrix(
208208
if not for_windows
209209
else ["11.8.0", "12.1.0"],
210210
},
211+
"2.3.0": {
212+
"python-version": ["3.8", "3.9", "3.10", "3.11", "3.12"],
213+
"cuda": ["11.8", "12.1"] # default 12.1
214+
if not for_windows
215+
else ["11.8.0", "12.1.0"],
216+
},
211217
# https://github.com/Jimver/cuda-toolkit/blob/master/src/links/windows-links.ts
212218
}
213219
if test_only_latest_torch:
214-
latest = "2.2.2"
220+
latest = "2.3.0"
215221
matrix = {latest: matrix[latest]}
216222

217223
if for_windows or for_macos:
@@ -271,6 +277,9 @@ def generate_build_matrix(
271277
for p in python_versions:
272278
if p in excluded_python_versions:
273279
continue
280+
if for_macos and p in ["3.8", "3.9"]:
281+
# macOS arm64 in github actions does not support python 3.8 or 3.9
282+
continue
274283

275284
if for_windows:
276285
p = "cp" + "".join(p.split("."))

scripts/github_actions/install_torch.sh

+15
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
# See the License for the specific language governing permissions and
1515
# limitations under the License.
1616

17+
set -x
18+
1719
if [ x"$TORCH_VERSION" != x"" ] && [ x"$CUDA_VERSION" != x"" ]; then
1820
torch=$TORCH_VERSION
1921
cuda=$CUDA_VERSION
@@ -198,6 +200,19 @@ case ${torch} in
198200
;;
199201
esac
200202
;;
203+
2.3.*)
204+
case ${cuda} in
205+
11.8)
206+
package="torch==${torch}+cu118"
207+
url=https://download.pytorch.org/whl/torch_stable.html
208+
;;
209+
12.1)
210+
package="torch==${torch}"
211+
# Leave it empty to use PyPI.
212+
url=
213+
;;
214+
esac
215+
;;
201216
*)
202217
echo "Unsupported PyTorch version: ${torch}"
203218
exit 1

0 commit comments

Comments
 (0)