Skip to content
This repository was archived by the owner on Aug 15, 2025. It is now read-only.

Commit 836aef2

Browse files
committed
Validate binary size
1 parent 00d0ac6 commit 836aef2

File tree

2 files changed

+66
-1
lines changed

2 files changed

+66
-1
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Validate manywheel binaries
2+
3+
on:
4+
pull_request:
5+
6+
jobs:
7+
validate-binary-size:
8+
runs-on: linux.4xlarge.nvidia.gpu
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
whl:
13+
- url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp310-cp310-linux_x86_64.whl
14+
python: 3.10
15+
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp311-cp311-linux_x86_64.whl
16+
# python: 3.11
17+
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp37-cp37m-linux_x86_64.whl
18+
# python: 3.7
19+
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp38-cp38-linux_x86_64.whl
20+
# python: 3.8
21+
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp39-cp39-linux_x86_64.whl
22+
# python: 3.9
23+
24+
env:
25+
GPU_ARCH_TYPE: cuda
26+
GPU_ARCH_VERSION: "11.7"
27+
28+
steps:
29+
- name: Checkout PyTorch builder
30+
uses: actions/checkout@v3
31+
32+
- name: Install patchelf
33+
run: |
34+
chmod a+x common/install_patchelf.sh
35+
sudo common/install_patchelf.sh
36+
37+
- name: Download torch whl
38+
run: |
39+
wget ${{ matrix.whl.url }}
40+
FILENAME=$(ls -1 *.whl | head -n 1)
41+
echo "::notice::Before repackaging: $(du -h $FILENAME | cut -f1)"
42+
echo "FILENAME=$FILENAME" >> $GITHUB_ENV
43+
44+
- name: Repackage into manywheel
45+
continue-on-error: true
46+
run: |
47+
release/pypi/prep_binary_for_pypi.sh $FILENAME
48+
NEW_FILENAME=$(ls -1 *.whl | head -n 1)
49+
echo "::notice::After repackaging: $(du -h $NEW_FILENAME | cut -f1)"
50+
echo "NEW_FILENAME=$NEW_FILENAME" >> $GITHUB_ENV
51+
52+
- name: Run smoke test
53+
continue-on-error: true
54+
run: |
55+
set -ex
56+
# run smoke test to make sure the binary is not broken
57+
conda create -n smoke-test python=${{ matrix.whl.python }} -y
58+
conda activate smoke-test
59+
pip install $NEW_FILENAME
60+
python ./test/smoke_test/smoke_test.py -- --package=torchonly
61+
62+
- name: Hold runner for 60 minutes or until ssh sessions have drained
63+
timeout-minutes: 60
64+
run: |
65+
sleep infinity

release/pypi/prep_binary_for_pypi.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ for whl_file in "$@"; do
5656
if [[ $whl_file == *"with.pypi.cudnn"* ]]; then
5757
rm -rf "${whl_dir}/caffe2"
5858
rm -rf "${whl_dir}"/torch/lib/libnvrtc*
59-
find "${whl_dir}/torch/include/caffe2" -maxdepth 1 -mindepth 1 -type d|grep -v serialize|xargs rm -rf
59+
(find "${whl_dir}/torch/include/caffe2" -maxdepth 1 -mindepth 1 -type d|grep -v serialize|xargs rm -rf) || echo "caffe2 is empty already"
6060
sed -i -e "s/Requires-Dist: nvidia-cuda-runtime-cu11/Requires-Dist: nvidia-cuda-runtime-cu11 (==11.7.99)/" "${whl_dir}"/*/METADATA
6161
sed -i -e "/^Requires-Dist: nvidia-cublas-cu11 (==11.10.3.66).*/a Requires-Dist: nvidia-cuda-nvrtc-cu11 (==11.7.99)" "${whl_dir}"/*/METADATA
6262

0 commit comments

Comments
 (0)