-
Notifications
You must be signed in to change notification settings - Fork 364
infra: testing out GHA CI #2073
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
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,9 @@ | ||
#!/usr/bin/env bash | ||
set -eou pipefail | ||
# Source conda so it's available to the script environment | ||
source ${BUILD_ENV_FILE} | ||
${CONDA_RUN} ${PIP_INSTALL_TORCH} torchvision pyyaml | ||
export TRT_VERSION=$(${CONDA_RUN} python -c "import versions; versions.tensorrt_version()") | ||
${CONDA_RUN} python -m pip install /opt/torch-tensorrt-builds/torch_tensorrt*+${CU_VERSION}*.whl tensorrt~=${TRT_VERSION} tensorrt-bindings~=${TRT_VERSION} --extra-index-url=https://pypi.ngc.nvidia.com | ||
|
||
echo -e "Running test script"; |
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,107 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euxo pipefail | ||
|
||
# Prepare conda | ||
set +x && eval "$($(which conda) shell.bash hook)" && set -x | ||
|
||
# Setup the OS_TYPE environment variable that should be used for conditions involving the OS below. | ||
case $(uname) in | ||
Linux) | ||
OS_TYPE=linux | ||
;; | ||
Darwin) | ||
OS_TYPE=macos | ||
;; | ||
MSYS*) | ||
OS_TYPE=windows | ||
;; | ||
*) | ||
echo "Unknown OS type:" $(uname) | ||
exit 1 | ||
;; | ||
esac | ||
|
||
if [[ "${OS_TYPE}" == "macos" && $(uname -m) == x86_64 ]]; then | ||
echo '::group::Uninstall system JPEG libraries on macOS' | ||
# The x86 macOS runners, e.g. the GitHub Actions native "macos-12" runner, has some JPEG and PNG libraries | ||
# installed by default that interfere with our build. We uninstall them here and use the one from conda below. | ||
IMAGE_LIBS=$(brew list | grep -E "jpeg|png") | ||
for lib in $IMAGE_LIBS; do | ||
brew uninstall --ignore-dependencies --force "${lib}" | ||
done | ||
echo '::endgroup::' | ||
fi | ||
|
||
echo '::group::Create build environment' | ||
# See https://github.com/pytorch/vision/issues/7296 for ffmpeg | ||
conda create \ | ||
--name ci \ | ||
--quiet --yes \ | ||
python="${PYTHON_VERSION}" pip \ | ||
ninja cmake \ | ||
libpng jpeg \ | ||
'ffmpeg<4.3' | ||
conda activate ci | ||
pip install --progress-bar=off --upgrade setuptools | ||
|
||
# See https://github.com/pytorch/vision/issues/6790 | ||
if [[ "${PYTHON_VERSION}" != "3.11" ]]; then | ||
pip install --progress-bar=off av!=10.0.0 | ||
fi | ||
|
||
echo '::endgroup::' | ||
|
||
if [[ "${OS_TYPE}" == windows && "${GPU_ARCH_TYPE}" == cuda ]]; then | ||
echo '::group::Install VisualStudio CUDA extensions on Windows' | ||
if [[ "${VC_YEAR:-}" == "2022" ]]; then | ||
TARGET_DIR="/c/Program Files (x86)/Microsoft Visual Studio/2022/BuildTools/MSBuild/Microsoft/VC/v170/BuildCustomizations" | ||
else | ||
TARGET_DIR="/c/Program Files (x86)/Microsoft Visual Studio/2019/BuildTools/MSBuild/Microsoft/VC/v160/BuildCustomizations" | ||
fi | ||
mkdir -p "${TARGET_DIR}" | ||
cp -r "${CUDA_HOME}/MSBuildExtensions/"* "${TARGET_DIR}" | ||
echo '::endgroup::' | ||
fi | ||
|
||
echo '::group::Install PyTorch' | ||
# TODO: Can we maybe have this as environment variable in the job template? For example, `IS_RELEASE`. | ||
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then | ||
CHANNEL=test | ||
else | ||
CHANNEL=nightly | ||
fi | ||
|
||
pip install --progress-bar=off light-the-torch | ||
ltt install --progress-bar=off \ | ||
--pytorch-computation-backend="${GPU_ARCH_TYPE}${GPU_ARCH_VERSION}" \ | ||
--pytorch-channel="${CHANNEL}" \ | ||
torch | ||
|
||
if [[ $GPU_ARCH_TYPE == 'cuda' ]]; then | ||
python -c "import torch; exit(not torch.cuda.is_available())" | ||
fi | ||
echo '::endgroup::' | ||
|
||
echo '::group::Install third party dependencies prior to TorchVision install' | ||
# Installing with `easy_install`, e.g. `python setup.py install` or `python setup.py develop`, has some quirks when | ||
# when pulling in third-party dependencies. For example: | ||
# - On Windows, we often hit an SSL error although `pip` can install just fine. | ||
# - It happily pulls in pre-releases, which can lead to more problems down the line. | ||
# `pip` does not unless explicitly told to do so. | ||
# Thus, we use `easy_install` to extract the third-party dependencies here and install them upfront with `pip`. | ||
python setup.py egg_info | ||
# The requires.txt cannot be used with `pip install -r` directly. The requirements are listed at the top and the | ||
# optional dependencies come in non-standard syntax after a blank line. Thus, we just extract the header. | ||
sed -e '/^$/,$d' *.egg-info/requires.txt | tee requirements.txt | ||
pip install --progress-bar=off -r requirements.txt | ||
echo '::endgroup::' | ||
|
||
echo '::group::Install TorchVision' | ||
python setup.py develop | ||
echo '::endgroup::' | ||
|
||
echo '::group::Collect environment information' | ||
conda list | ||
python -m torch.utils.collect_env | ||
echo '::endgroup::' |
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,14 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euo pipefail | ||
|
||
./.github/scripts/setup-env.sh | ||
|
||
# Activate conda environment | ||
eval "$($(which conda) shell.bash hook)" && conda deactivate && conda activate ci | ||
|
||
echo '::group::Install testing utilities' | ||
pip install --progress-bar=off pytest pytest-mock pytest-cov | ||
echo '::endgroup::' | ||
|
||
pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 |
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,205 @@ | ||
name: Build and test linux wheels | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- nightly | ||
- main | ||
- release/* | ||
tags: | ||
# NOTE: Binary build pipelines should only get triggered on release candidate builds | ||
# Release candidate tags look like: v1.11.0-rc1 | ||
- v[0-9]+.[0-9]+.[0-9]+-rc[0-9]+ | ||
workflow_dispatch: | ||
|
||
jobs: | ||
generate-matrix: | ||
uses: pytorch/test-infra/.github/workflows/generate_binary_build_matrix.yml@main | ||
with: | ||
package-type: wheel | ||
os: linux | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
with-rocm: false | ||
with-cpu: false | ||
|
||
build: | ||
needs: generate-matrix | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
pre-script: packaging/pre_build_script.sh | ||
env-var-script: packaging/env_vars.txt | ||
post-script: "" | ||
narendasan marked this conversation as resolved.
Show resolved
Hide resolved
|
||
smoke-test-script: "" | ||
package-name: torch_tensorrt | ||
name: Build torch-tensorrt whl package | ||
uses: pytorch/test-infra/.github/workflows/build_wheels_linux.yml@main | ||
with: | ||
repository: ${{ matrix.repository }} | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: ${{ matrix.pre-script }} | ||
env-var-script: ${{ matrix.env-var-script }} | ||
post-script: ${{ matrix.post-script }} | ||
package-name: ${{ matrix.package-name }} | ||
smoke-test-script: ${{ matrix.smoke-test-script }} | ||
trigger-event: ${{ github.event_name }} | ||
secrets: | ||
AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID: ${{ secrets.AWS_PYTORCH_UPLOADER_ACCESS_KEY_ID }} | ||
AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY: ${{ secrets.AWS_PYTORCH_UPLOADER_SECRET_ACCESS_KEY }} | ||
|
||
# tests-py-torchscript-fe: | ||
# name: Test torchscript frontend [Python] | ||
# needs: [generate-matrix, build] | ||
# strategy: | ||
# fail-fast: false | ||
# matrix: | ||
# include: | ||
# - repository: pytorch/tensorrt | ||
# package-name: torch_tensorrt | ||
# pre-script: packaging/pre_build_script.sh | ||
# uses: pytorch/tensorrt/.github/workflows/linux-test.yml@gha-ci-infra | ||
# with: | ||
# job-name: tests-py-torchscript-fe | ||
# repository: "pytorch/tensorrt" | ||
# ref: "" | ||
# test-infra-repository: pytorch/test-infra | ||
# test-infra-ref: main | ||
# build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
# pre-script: ${{ matrix.pre-script }} | ||
# script: | | ||
# export USE_HOST_DEPS=1 | ||
# pushd . | ||
# cd tests/modules | ||
# ${CONDA_RUN} python -m pip install -r requirements.txt | ||
# ${CONDA_RUN} python hub.py | ||
# popd | ||
# pushd . | ||
# cd tests/py/ts | ||
# ${CONDA_RUN} python -m pip install --pre pytest timm transformers parameterized expecttest --use-deprecated=legacy-resolver | ||
# ${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/ts_api_test_results.xml api/ | ||
# ${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/ts_models_test_results.xml models/ | ||
# ${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/ts_integrations_test_results.xml integrations/ | ||
# popd | ||
|
||
tests-py-dynamo-converters: | ||
name: Test dynamo converters [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
pre-script: packaging/pre_build_script.sh | ||
uses: pytorch/tensorrt/.github/workflows/linux-test.yml@gha-ci-infra | ||
with: | ||
job-name: tests-py-dynamo-converters | ||
repository: "pytorch/tensorrt" | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: ${{ matrix.pre-script }} | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/modules | ||
${CONDA_RUN} python -m pip install -r requirements.txt | ||
${CONDA_RUN} python hub.py | ||
popd | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest-xdist timm transformers parameterized expecttest --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_converters_test_results.xml -n 10 conversion/ | ||
popd | ||
|
||
tests-py-dynamo-fe: | ||
name: Test dynamo frontend [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
pre-script: packaging/pre_build_script.sh | ||
uses: pytorch/tensorrt/.github/workflows/linux-test.yml@gha-ci-infra | ||
with: | ||
job-name: tests-py-dynamo-fe | ||
repository: "pytorch/tensorrt" | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: ${{ matrix.pre-script }} | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest timm transformers parameterized expecttest --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest --junitxml=${RUNNER_TEST_RESULTS_DIR}/dynamo_fe_test_results.xml --ir dynamo models/test_models_export.py | ||
popd | ||
|
||
tests-py-torch-compile-be: | ||
name: Test torch compile backend [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
pre-script: packaging/pre_build_script.sh | ||
uses: pytorch/tensorrt/.github/workflows/linux-test.yml@gha-ci-infra | ||
with: | ||
job-name: tests-py-torch-compile-be | ||
repository: "pytorch/tensorrt" | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: ${{ matrix.pre-script }} | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest-xdist timm transformers parameterized expecttest --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_compile_be_test_results.xml backend/ | ||
${CONDA_RUN} python -m pytest -n 4 --junitxml=${RUNNER_TEST_RESULTS_DIR}/torch_comple_be_e2e_test_results.xml --ir torch_compile models/test_models.py | ||
popd | ||
|
||
tests-py-dynamo-core: | ||
name: Test dynamo core [Python] | ||
needs: [generate-matrix, build] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
include: | ||
- repository: pytorch/tensorrt | ||
package-name: torch_tensorrt | ||
pre-script: packaging/pre_build_script.sh | ||
uses: pytorch/tensorrt/.github/workflows/linux-test.yml@gha-ci-infra | ||
with: | ||
job-name: tests-py-dynamo-core | ||
repository: "pytorch/tensorrt" | ||
ref: "" | ||
test-infra-repository: pytorch/test-infra | ||
test-infra-ref: main | ||
build-matrix: ${{ needs.generate-matrix.outputs.matrix }} | ||
pre-script: ${{ matrix.pre-script }} | ||
script: | | ||
export USE_HOST_DEPS=1 | ||
pushd . | ||
cd tests/py/dynamo | ||
${CONDA_RUN} python -m pip install --pre pytest-xdist timm transformers parameterized expecttest --use-deprecated=legacy-resolver | ||
${CONDA_RUN} python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_runtime_test_results.xml runtime/ | ||
${CONDA_RUN} python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_partitioning_test_results.xml partitioning/ | ||
${CONDA_RUN} python -m pytest -n 10 --junitxml=${RUNNER_TEST_RESULTS_DIR}/tests_py_dynamo_core_lowering_test_results.xml lowering/ | ||
popd |
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
Oops, something went wrong.
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.