78 lines (65 loc) · 2.89 KB
/
validate-repackaged-binary-sizes.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
name: Validate manywheel binaries
# This workflow validates the size of the manywheel binaries after repackaging for PyPi
# Specify the direct URLs to the binaries (from https://download.pytorch.org/whl/test/torch/) in the matrix
# along with the python version.
#
# The workflow will:
# * download the binaries,
# * run release/pypi/prep_binary_for_pypi.sh
# * run smoke tests on the repackaged binaries
# * display the size before and after repackaging
on:
pull_request:
jobs:
validate-binary-size:
strategy:
fail-fast: false
matrix:
whl:
- url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp310-cp310-linux_x86_64.whl
python: "3.10"
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp37-cp37m-linux_x86_64.whl
# python: "3.7"
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp38-cp38-linux_x86_64.whl
# python: "3.8"
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp39-cp39-linux_x86_64.whl
# python: "3.9"
# - url: https://download.pytorch.org/whl/test/cu117_pypi_cudnn/torch-1.13.1%2Bcu117.with.pypi.cudnn-cp311-cp311-linux_x86_64.whl
# python: "3.11"
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
with:
runner: linux.4xlarge.nvidia.gpu
job-name: "Validate binary size"
script: |
set -ex
export ENV_NAME="conda-env-${{ github.run_id }}"
export GPU_ARCH_VER="11.7"
export GPU_ARCH_TYPE="cuda"
export CUDA_VER="11.7"
export DESIRED_PYTHON="${{ matrix.whl.python }}"
export DESIRED_CUDA="cu117"
export PACKAGE_TYPE="wheel"
export TARGET_OS="linux"
export INSTALLATION=""
# install zip
sudo yum install zip -y
# install patchelf
chmod a+x common/install_patchelf.sh
sudo common/install_patchelf.sh
# download torch whl
wget ${{ matrix.whl.url }}
FILENAME=$(ls -1 *.whl | head -n 1)
SIZE_BEFORE=$(du -h $FILENAME | cut -f1)
# repackage into manywheel
release/pypi/prep_binary_for_pypi.sh $FILENAME
NEW_FILENAME=$(ls -1 *.whl | head -n 1)
echo "::notice:: $FILENAME before: $SIZE_BEFORE after: $(du -h $NEW_FILENAME | cut -f1)"
# cp to ${RUNNER_ARTIFACT_DIR}
cp $NEW_FILENAME ${RUNNER_ARTIFACT_DIR}/
# create conda env
conda create -y -n $ENV_NAME python=$DESIRED_PYTHON
conda activate $ENV_NAME
# install torch
pip install numpy pillow $NEW_FILENAME
# run smoke test
python ./test/smoke_test/smoke_test.py --package=torchonly