-
Notifications
You must be signed in to change notification settings - Fork 7.2k
consolidate Linux workflows on CPU and GPU #7189
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 19 commits
Commits
Show all changes
33 commits
Select commit
Hold shift + click to select a range
841de2c
consolidate Linux workflows on CPU and GPU
pmeier 7e90838
add sleep for ssh
pmeier 99d6332
disable CPU for now
pmeier d81811d
sleep right away
pmeier 81c45a2
Merge branch 'main' into consolidate-linux-ci
pmeier 179f224
Merge branch 'main' into consolidate-linux-ci
pmeier 52e7cea
Merge branch 'consolidate-linux-ci' of https://github.com/pmeier/visi…
pmeier c87f260
fix GPU workflow inputs
pmeier d7a11cb
Merge branch 'main' into consolidate-linux-ci
pmeier 7f0ac72
Merge branch 'main' into consolidate-linux-ci
pmeier 11231a3
Merge branch 'main' into consolidate-linux-ci
pmeier 126c27a
Merge branch 'main' into consolidate-linux-ci
pmeier ea8d1f6
Merge branch 'main' into consolidate-linux-ci
pmeier 11a2d68
refactor script
pmeier de913f9
cleanup
pmeier 6931577
also install ffmpeg
pmeier 701e71f
try ffmpeg<5
pmeier 1c86593
try ffmpeg<4.3
pmeier 469008e
Merge branch 'main' into consolidate-linux-ci
pmeier 7b22e3d
Update .github/unittest.sh
pmeier 9cc3e4d
Merge branch 'main' into consolidate-linux-ci
pmeier 240cad6
Merge branch 'consolidate-linux-ci' of https://github.com/pmeier/visi…
pmeier 42f37bf
Merge branch 'main' into consolidate-linux-ci
pmeier 62dd31a
try 3.11 on linux
pmeier d244e1f
only try to install av on < 3.11
pmeier d5ea9ee
add comment for ffmpeg pin
pmeier 2cbba69
add missing --pre
pmeier 0849838
fix bash multiline comment
pmeier d0c3ec9
fix conditional
pmeier 2819673
fix PyTorch installation
pmeier f567e51
Merge branch 'main' into consolidate-linux-ci
pmeier ab4dafe
Merge branch 'main' into consolidate-linux-ci
pmeier 8e10b25
use defaults channel over conda-forge
pmeier 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,80 @@ | ||
| #!/usr/bin/env bash | ||
|
|
||
| set -euo pipefail | ||
|
|
||
| # Prepare conda | ||
| CONDA_PATH=$(which conda) | ||
| eval "$(${CONDA_PATH} shell.bash hook)" | ||
|
|
||
| echo '::group::Set PyTorch conda channel and wheel index' | ||
| # TODO: Can we maybe have this as environment variable in the job template? For example, `IS_RELEASE`. | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Will open an issue in test-infra for that |
||
| if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then | ||
| CHANNEL_ID=test | ||
| else | ||
| CHANNEL_ID=nightly | ||
| fi | ||
| PYTORCH_CONDA_CHANNEL=pytorch-"${CHANNEL_ID}" | ||
| echo "PYTORCH_CONDA_CHANNEL=${PYTORCH_CONDA_CHANNEL}" | ||
|
|
||
| case $GPU_ARCH_TYPE in | ||
| cpu) | ||
| GPU_ARCH_ID="cpu" | ||
| ;; | ||
| cuda) | ||
| VERSION_WITHOUT_DOT=$(echo "${GPU_ARCH_VERSION}" | sed 's/\.//') | ||
| GPU_ARCH_ID="cu${VERSION_WITHOUT_DOT}" | ||
| ;; | ||
| *) | ||
| echo "Unknown GPU_ARCH_TYPE=${GPU_ARCH_TYPE}" | ||
| exit 1 | ||
| ;; | ||
| esac | ||
| PYTORCH_WHEEL_INDEX="https://download.pytorch.org/whl/${CHANNEL_ID}/${GPU_ARCH_ID}" | ||
| echo "PYTORCH_WHEEL_INDEX=${PYTORCH_WHEEL_INDEX}" | ||
| echo '::endgroup::' | ||
|
|
||
| echo '::group::Create build environment' | ||
| conda create \ | ||
| --name ci \ | ||
| --quiet --yes \ | ||
| python="${PYTHON_VERSION}" pip \ | ||
| ninja libpng jpeg 'ffmpeg<4.3' \ | ||
| -c "${PYTORCH_CONDA_CHANNEL}" \ | ||
| -c conda-forge | ||
pmeier marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| conda activate ci | ||
| pip install --progress-bar=off --upgrade setuptools | ||
pmeier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| echo '::endgroup::' | ||
|
|
||
| echo '::group::Install PyTorch' | ||
| # Due to the supply chain attack in Dec 2022 (https://pytorch.org/blog/compromised-nightly-dependency/), we host all | ||
| # third-party dependencies on Linux on our own indices and *don't* install them from PyPI. | ||
| case "$(uname -s)" in | ||
| Linux*) | ||
| INDEX_TYPE="index-url" | ||
| ;; | ||
| *) | ||
| INDEX_TYPE="extra-index-url" | ||
| esac | ||
pmeier marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
|
|
||
| pip install --progress-bar=off torch "--${INDEX_TYPE}=${PYTORCH_WHEEL_INDEX}" | ||
|
|
||
| if [[ $GPU_ARCH_TYPE = 'cuda' ]]; then | ||
| python3 -c "import torch; exit(not torch.cuda.is_available())" | ||
| fi | ||
| echo '::endgroup::' | ||
|
|
||
| echo '::group::Install TorchVision' | ||
| python setup.py develop | ||
| echo '::endgroup::' | ||
|
|
||
| echo '::group::Collect PyTorch environment information' | ||
| python -m torch.utils.collect_env | ||
| echo '::endgroup::' | ||
|
|
||
| echo '::group::Install testing utilities' | ||
| pip install --progress-bar=off pytest pytest-mock pytest-cov | ||
| echo '::endgroup::' | ||
|
|
||
| echo '::group::Run tests' | ||
| pytest --durations=25 | ||
| echo '::endgroup::' | ||
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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,40 @@ | ||
| name: Unit-tests on Linux | ||
|
|
||
| on: | ||
| pull_request: | ||
| push: | ||
| branches: | ||
| - nightly | ||
| - main | ||
| - release/* | ||
| workflow_dispatch: | ||
|
|
||
| jobs: | ||
| tests: | ||
| strategy: | ||
| matrix: | ||
| python-version: | ||
| - "3.8" | ||
| - "3.9" | ||
| - "3.10" | ||
pmeier marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| runner: ["linux.12xlarge"] | ||
| gpu-arch-type: ["cpu"] | ||
| include: | ||
| - python-version: 3.8 | ||
| runner: linux.g5.4xlarge.nvidia.gpu | ||
| gpu-arch-type: cuda | ||
| gpu-arch-version: "11.7" | ||
| fail-fast: false | ||
| uses: pytorch/test-infra/.github/workflows/linux_job.yml@main | ||
| with: | ||
| repository: pytorch/vision | ||
| runner: ${{ matrix.runner }} | ||
| gpu-arch-type: ${{ matrix.gpu-arch-type }} | ||
| gpu-arch-version: ${{ matrix.gpu-arch-version }} | ||
| timeout: 120 | ||
| script: | | ||
| export PYTHON_VERSION=${{ matrix.python-version }} | ||
| export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }} | ||
| export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }} | ||
|
|
||
| ./.github/unittest.sh | ||
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.
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.
IIUC, all the generic jobs come with
condapre-installed and usebash, right? If so, could we maybe runconda initbefore we enter the script? Otherwise stuff likeconda activatedoesn't work without running the highlighted commands before.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.
At least the
condapart is not true for Windows. @osalpekar is this intentional?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.
It is not intentional - since this is the first application of the windows job, we'll need to identify and patch these gaps as we go :) This line would need to be added to the windows_job to ensure conda is installed: https://github.com/pytorch/test-infra/blob/main/.github/workflows/macos_job.yml#L84