Skip to content

Commit d907d46

Browse files
authored
Add Wheels Build manylinux2014_x86_64 workflow (triton-lang#5619)
In order to execute this workflow with ``workflow_dispatch`` event this needs to be part of main
1 parent 75c2972 commit d907d46

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

.github/workflows/wheels_v2.yml

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

0 commit comments

Comments
 (0)