-
Notifications
You must be signed in to change notification settings - Fork 227
PyPi binary validation and size check #1230
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
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 as the workflow annotation | ||
# * optionally upload the repackaged binaries as artifacts (for debug or promotion) | ||
|
||
on: | ||
pull_request: | ||
paths: | ||
- .github/workflows/validate-repackaged-binary-sizes.yml | ||
- release/pypi/prep_binary_for_pypi.sh | ||
|
||
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" # python version to use for smoke tests | ||
upload_artifact: false # upload the repackaged binary as an artifact | ||
- 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" | ||
artifact: false | ||
- 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" | ||
artifact: false | ||
- 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" | ||
artifact: false | ||
# - 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" | ||
# artifact: false | ||
|
||
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | ||
with: | ||
runner: linux.4xlarge.nvidia.gpu | ||
job-name: "Validate binary size" | ||
upload-artifact: ${{ matrix.whl.upload_artifact == 'true' && 'repackaged-binary' || '' }} | ||
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 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -95,6 +95,7 @@ for whl_file in "$@"; do | |
fi | ||
) | ||
|
||
rm -rf "${new_whl_file}" | ||
zip -qr9 "${new_whl_file}" . | ||
) | ||
done |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Perhaps we should add on request, when running manually.
And add a pytorch version and cuda version as a parameter. Since we do plan on introducing cu118 soon.
Also add nightly/test as a parameter as well .
This way when we intorduce cu11.8 in nightly we should validate it right away