Skip to content

Commit 066a20d

Browse files
atalmanliuyunqi20
authored andcommitted
[release-only] Add manylinux2014_x86_64 for PyTorch release 2.6 (#5414)
Add manylinux2014_x86_64 for PyTorch release 2.6 Add ability to upload build wheels to github
1 parent f780c8e commit 066a20d

File tree

3 files changed

+192
-1
lines changed

3 files changed

+192
-1
lines changed

.github/workflows/wheels.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Wheels
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "0 8 * * *"
6+
pull_request:
7+
paths:
8+
- .github/workflows/wheels_v2.yml
9+
10+
permissions: read-all
11+
12+
jobs:
13+
14+
Build-Wheels:
15+
timeout-minutes: 60
16+
17+
runs-on: [self-hosted, CPU]
18+
permissions:
19+
id-token: write
20+
contents: read
21+
22+
steps:
23+
24+
- name: Prune stale docker containers
25+
run: |
26+
# If cibuildwheel crashes (or, say, is OOM-killed), it leaves behind a
27+
# docker container. Eventually these consume all the disk space on
28+
# this machine.
29+
docker container prune -f
30+
31+
- name: Checkout
32+
uses: actions/checkout@v4
33+
34+
# The LATEST_DATE here should be kept in sync with the one in Patch setup.py
35+
- id: check-version
36+
name: Check latest version
37+
run: |
38+
export PACKAGE_DATE=$(python3 -m pip install --user --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/Triton-Nightly/pypi/simple/ --dry-run triton-nightly== |& grep -oP '(?<=, )[0-9\.]+dev[0-9]+(?=\))' | grep -oP '(?<=dev)[0-9]+')
39+
export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
40+
if cmp -s <(echo $PACKAGE_DATE) <(echo $LATEST_DATE); then
41+
echo "new_commit=false" >> "$GITHUB_OUTPUT"
42+
else
43+
echo "new_commit=true" >> "$GITHUB_OUTPUT"
44+
fi
45+
46+
- name: Patch setup.py
47+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
48+
run: |
49+
echo "" >> python/setup.cfg
50+
echo "[build_ext]" >> python/setup.cfg
51+
echo "base-dir=/project" >> python/setup.cfg
52+
53+
- name: Build wheels
54+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
55+
run: |
56+
python3 -m pip install cibuildwheel --upgrade --user
57+
export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
58+
# Pass MAX_JOBS=4 because, at time of writing, the VM "only" has 32GB
59+
# of RAM and OOMs while building if we give it the default number of
60+
# workers (2 * NUM_CPUs).
61+
export CIBW_ENVIRONMENT="MAX_JOBS=4 \
62+
TRITON_BUILD_WITH_CLANG_LLD=1"
63+
export CIBW_MANYLINUX_X86_64_IMAGE="quay.io/pypa/manylinux_2_28_x86_64:latest"
64+
#export CIBW_MANYLINUX_PYPY_X86_64_IMAGE="quay.io/pypa/manylinux_2_28_x86_64:latest"
65+
# many_linux_2_28 image comes with GCC 12.2.1, but not clang.
66+
# With this install, it gets clang 16.0.6.
67+
export CIBW_BEFORE_ALL="dnf install clang lld -y";
68+
export CIBW_SKIP="cp{35,36,37}-*"
69+
export CIBW_BUILD="cp3{9,10,11,12,13}-manylinux_x86_64"
70+
python3 -m cibuildwheel python --output-dir wheelhouse
71+
72+
- uses: actions/upload-artifact@v4
73+
with:
74+
name: cibw-wheels-manylinux_2_28_x86_64-wheels-upload
75+
path: ./wheelhouse/*.whl
76+
77+
- name: Install Azure CLI
78+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
79+
run: |
80+
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
81+
82+
- name: Azure login
83+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
84+
uses: azure/login@v2
85+
with:
86+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
87+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
88+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
89+
90+
- id: generate-token
91+
name: Generate token
92+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
93+
run: |
94+
AZ_TOKEN=$(az account get-access-token --query accessToken)
95+
echo "::add-mask::$AZ_TOKEN"
96+
echo "access_token=$AZ_TOKEN" >> "$GITHUB_OUTPUT"
97+
98+
- name: Publish wheels to Azure DevOps
99+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
100+
run: |
101+
python3 -m pip install twine
102+
python3 -m twine upload -r Triton-Nightly -u TritonArtifactsSP -p ${{ steps.generate-token.outputs.access_token }} --config-file utils/nightly.pypirc --non-interactive --verbose wheelhouse/*
103+
104+
- name: Azure Logout
105+
if: ${{ steps.check-version.outputs.new_commit == 'true' && (success() || failure()) }}
106+
run: |
107+
az logout
108+
az cache purge
109+
az account clear

.github/workflows/wheels_v2.yml

Lines changed: 82 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,82 @@
1+
name: Wheels Build manylinux2014_x86_64
2+
on:
3+
workflow_dispatch:
4+
schedule:
5+
- cron: "20 2 * * *"
6+
pull_request:
7+
paths:
8+
- .github/workflows/wheels_v2.yml
9+
10+
jobs:
11+
12+
Build-Wheels:
13+
timeout-minutes: 60
14+
15+
runs-on: [self-hosted, CPU]
16+
permissions:
17+
id-token: write
18+
contents: read
19+
20+
steps:
21+
22+
- name: Prune stale docker containers
23+
run: |
24+
# If cibuildwheel crashes (or, say, is OOM-killed), it leaves behind a
25+
# docker container. Eventually these consume all the disk space on
26+
# this machine.
27+
docker container prune -f
28+
29+
- name: Checkout
30+
uses: actions/checkout@v3
31+
32+
# The LATEST_DATE here should be kept in sync with the one in Patch setup.py
33+
- id: check-version
34+
name: Check latest version
35+
run: |
36+
export PACKAGE_DATE=$(python3 -m pip install --user --index-url https://aiinfra.pkgs.visualstudio.com/PublicPackages/_packaging/Triton-Nightly/pypi/simple/ --dry-run triton-nightly== |& grep -oP '(?<=, )[0-9\.]+dev[0-9]+(?=\))' | grep -oP '(?<=dev)[0-9]+')
37+
export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
38+
if cmp -s <(echo $PACKAGE_DATE) <(echo $LATEST_DATE); then
39+
echo "new_commit=false" >> "$GITHUB_OUTPUT"
40+
else
41+
echo "new_commit=true" >> "$GITHUB_OUTPUT"
42+
fi
43+
44+
- name: Patch setup.py
45+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
46+
run: |
47+
echo "" >> python/setup.cfg
48+
echo "[build_ext]" >> python/setup.cfg
49+
echo "base-dir=/project" >> python/setup.cfg
50+
51+
- name: Build wheels
52+
if: ${{ steps.check-version.outputs.new_commit == 'true' }}
53+
run: |
54+
python3 -m pip install cibuildwheel --upgrade --user
55+
export LATEST_DATE=$(TZ=UTC0 git show --quiet --date='format-local:%Y%m%d%H%M%S' --format="%cd")
56+
# Pass MAX_JOBS=4 because, at time of writing, the VM "only" has 32GB
57+
# of RAM and OOMs while building if we give it the default number of
58+
# workers (2 * NUM_CPUs).
59+
#
60+
# Sadly, I couldn't make TRITON_BUILD_WITH_CLANG_LLD=1 work. The
61+
# manylinux image has a relatively recent gcc (v10, released 2020),
62+
# but its clang is ancient, v3.4, released in 2014 (!). I tried
63+
# installing the prebuilt clang 10 binary distributed by LLVM, and I
64+
# quickly ran into Linux DLL hell. I give up, for now. Perhaps
65+
# manylinux_x_y will save us; I didn't try.
66+
export CIBW_ENVIRONMENT="MAX_JOBS=4 TRITON_WHEEL_NAME=triton"
67+
export CIBW_MANYLINUX_X86_64_IMAGE="quay.io/pypa/manylinux2014_x86_64:latest"
68+
#export CIBW_MANYLINUX_PYPY_X86_64_IMAGE="quay.io/pypa/manylinux2014_x86_64:latest"
69+
export CIBW_BEFORE_BUILD="pip install cmake;"
70+
export CIBW_SKIP="cp{35,36,37,38}-*"
71+
export CIBW_BUILD="cp3{9,10,11,12,13}-manylinux_x86_64"
72+
python3 -m cibuildwheel python --output-dir wheelhouse
73+
74+
- uses: actions/upload-artifact@v4
75+
with:
76+
name: cibw-wheels-manylinux2014-wheels-upload
77+
path: ./wheelhouse/*.whl
78+
79+
- name: Upload wheels to PyPI
80+
if: false # Disable Upload to PyPI until ready for release
81+
run: |
82+
python3 -m twine upload wheelhouse/* -u __token__ -p ${{ secrets.PYPY_API_TOKEN }}

python/setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -758,11 +758,11 @@ def get_install_requires():
758758
"Intended Audience :: Developers",
759759
"Topic :: Software Development :: Build Tools",
760760
"License :: OSI Approved :: MIT License",
761-
"Programming Language :: Python :: 3.8",
762761
"Programming Language :: Python :: 3.9",
763762
"Programming Language :: Python :: 3.10",
764763
"Programming Language :: Python :: 3.11",
765764
"Programming Language :: Python :: 3.12",
765+
"Programming Language :: Python :: 3.13",
766766
],
767767
test_suite="tests",
768768
extras_require={

0 commit comments

Comments
 (0)