Skip to content

Commit 2d8c841

Browse files
committed
Validate binary size linux_job
1 parent 2aaac3a commit 2d8c841

File tree

1 file changed

+63
-51
lines changed

1 file changed

+63
-51
lines changed
Lines changed: 63 additions & 51 deletions
Original file line numberDiff line numberDiff line change
@@ -1,65 +1,77 @@
11
name: Validate manywheel binaries
22

3+
# This workflow validates the size of the manywheel binaries after repackaging for PyPi
4+
# Specify the direct URLs to the binaries (from https://download.pytorch.org/whl/test/torch/) in the matrix
5+
# along with the python version.
6+
#
7+
# The workflow will:
8+
# * download the binaries,
9+
# * run release/pypi/prep_binary_for_pypi.sh
10+
# * run smoke tests on the repackaged binaries
11+
# * display the size before and after repackaging
12+
313
on:
414
pull_request:
515

616
jobs:
717
validate-binary-size:
8-
runs-on: linux.4xlarge.nvidia.gpu
918
strategy:
1019
fail-fast: false
1120
matrix:
1221
whl:
1322
- 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
23+
python: "3.10"
1524
# - 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
25+
# python: "3.11"
26+
- url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp37-cp37m-linux_x86_64.whl
27+
python: "3.7"
28+
- url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp38-cp38-linux_x86_64.whl
29+
python: "3.8"
30+
- url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp39-cp39-linux_x86_64.whl
31+
python: "3.9"
6132

62-
- name: Hold runner for 60 minutes or until ssh sessions have drained
63-
timeout-minutes: 60
64-
run: |
65-
sleep infinity
33+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
34+
with:
35+
runner: linux.4xlarge.nvidia.gpu
36+
repository: "pytorch/builder"
37+
ref: ${{ github.ref }}
38+
job-name: "Validate binary size"
39+
script: |
40+
set -ex
41+
export ENV_NAME="conda-env-${{ github.run_id }}"
42+
export GPU_ARCH_VER="11.7"
43+
export GPU_ARCH_TYPE="cuda"
44+
export CUDA_VER="11.7"
45+
export DESIRED_PYTHON="${{ matrix.whl.python }}"
46+
export DESIRED_CUDA="cu117"
47+
export PACKAGE_TYPE="wheel"
48+
export TARGET_OS="linux"
49+
export INSTALLATION=""
50+
51+
# install zip
52+
sudo yum install zip -y
53+
54+
# install patchelf
55+
chmod a+x common/install_patchelf.sh
56+
sudo common/install_patchelf.sh
57+
58+
# download torch whl
59+
wget ${{ matrix.whl.url }}
60+
FILENAME=$(ls -1 *.whl | head -n 1)
61+
SIZE_BEFORE=$(du -h $FILENAME | cut -f1)
62+
63+
# repackage into manywheel
64+
release/pypi/prep_binary_for_pypi.sh $FILENAME
65+
66+
NEW_FILENAME=$(ls -1 *.whl | head -n 1)
67+
echo "::notice:: $FILENAME before: $SIZE_BEFORE after: $(du -h $NEW_FILENAME | cut -f1)"
68+
69+
# create conda env
70+
conda create -y -n $ENV_NAME python=$DESIRED_PYTHON
71+
conda activate $ENV_NAME
72+
73+
# install torch
74+
pip install numpy pillow $NEW_FILENAME
75+
76+
# run smoke test
77+
python ./test/smoke_test/smoke_test.py --package=torchonly

0 commit comments

Comments
 (0)