-
Notifications
You must be signed in to change notification settings - Fork 7.1k
enable Windows CPU CI on GHA #7475
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
Changes from all commits
756cb5c
4a3a49c
04398de
4133cdc
a5d0821
632fceb
5282b45
270638a
b792e1d
83cea1a
e8b0651
53a1c37
59b5562
4cea941
4bee1f2
bbf58cd
80e3605
751d76a
44b1c0b
c585d29
3788c01
a4cdf02
359559a
d72ee77
3598511
08dfc12
179c214
0ff9f51
7227ae2
05dbfb3
3e5719b
6d06970
c9b3727
c70d95e
a846096
26838ed
a5a400a
4714a7f
8ae0b19
bd94248
d4c551d
1c13a08
866040e
c5c129f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -14,23 +14,26 @@ case $(uname) in | |
Darwin) | ||
OS_TYPE=macos | ||
;; | ||
MSYS*) | ||
OS_TYPE=windows | ||
;; | ||
*) | ||
echo "Unknown OS type:" $(uname) | ||
exit 1 | ||
;; | ||
esac | ||
|
||
echo '::group::Uninstall system JPEG libraries on macOS' | ||
# The x86 macOS runners, e.g. the GitHub Actions native "macos-12" runner, has some JPEG libraries installed by default | ||
# that interfere with our build. We uninstall them here and use the one from conda below. | ||
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 libraries installed by | ||
# default that interfere with our build. We uninstall them here and use the one from conda below. | ||
JPEG_LIBS=$(brew list | grep jpeg) | ||
echo $JPEG_LIBS | ||
for lib in $JPEG_LIBS; do | ||
brew uninstall --ignore-dependencies --force $lib || true | ||
done | ||
echo '::endgroup::' | ||
fi | ||
echo '::endgroup::' | ||
|
||
echo '::group::Create build environment' | ||
# See https://github.com/pytorch/vision/issues/7296 for ffmpeg | ||
|
@@ -66,10 +69,24 @@ ltt install --progress-bar=off \ | |
torch | ||
|
||
if [[ $GPU_ARCH_TYPE == 'cuda' ]]; then | ||
python3 -c "import torch; exit(not torch.cuda.is_available())" | ||
python -c "import torch; exit(not torch.cuda.is_available())" | ||
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.
|
||
fi | ||
echo '::endgroup::' | ||
|
||
if [[ "${OS_TYPE}" == "windows" ]]; then | ||
echo '::group::Install third party dependencies prior to TorchVision install on Windows' | ||
# `easy_install`, i.e. `python setup.py` has problems downloading the dependencies due to SSL. | ||
# Thus, we install them upfront with `pip` to avoid that. | ||
# Instead of fixing the SSL error, we can probably maintain this special case until we switch away from the deprecated | ||
# `easy_install` anyway. | ||
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 > requirements.txt | ||
pip install --progress-bar=off -r requirements.txt | ||
echo '::endgroup::' | ||
fi | ||
|
||
echo '::group::Install TorchVision' | ||
python setup.py develop | ||
echo '::endgroup::' | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,15 +4,11 @@ set -euo pipefail | |
|
||
./.github/scripts/setup-env.sh | ||
|
||
# Prepare conda | ||
CONDA_PATH=$(which conda) | ||
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. Shorten this a little. No functional difference, but can be easier copy-pasted during SSH debug sessions in CI. |
||
eval "$(${CONDA_PATH} shell.bash hook)" | ||
conda activate ci | ||
# 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::' | ||
|
||
echo '::group::Run unittests' | ||
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. After a command is finished, GH automatically collapses groups. Since we want to see the tests, drop the grouping here. |
||
pytest --junit-xml="${RUNNER_TEST_RESULTS_DIR}/test-results.xml" -v --durations=25 | ||
echo '::endgroup::' |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: Tests on Windows | ||
|
||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- nightly | ||
- main | ||
- release/* | ||
workflow_dispatch: | ||
|
||
jobs: | ||
unittests: | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
- "3.9" | ||
- "3.10" | ||
- "3.11" | ||
runner: ["windows.4xlarge"] | ||
gpu-arch-type: ["cpu"] | ||
# FIXME: enable this as soon as nvjpeg is available on the Windows runner | ||
# include: | ||
# - python-version: "3.8" | ||
# runner: windows.8xlarge.nvidia.gpu | ||
# gpu-arch-type: cuda | ||
# gpu-arch-version: "11.7" | ||
fail-fast: false | ||
uses: pytorch/test-infra/.github/workflows/windows_job.yml@main | ||
with: | ||
repository: pytorch/vision | ||
runner: ${{ matrix.runner }} | ||
timeout: 120 | ||
script: | | ||
set -euxo pipefail | ||
|
||
export PYTHON_VERSION=${{ matrix.python-version }} | ||
export GPU_ARCH_TYPE=${{ matrix.gpu-arch-type }} | ||
export GPU_ARCH_VERSION=${{ matrix.gpu-arch-version }} | ||
|
||
# TODO: Port this to pytorch/test-infra/.github/workflows/windows_job.yml | ||
export PATH="/c/Jenkins/Miniconda3/Scripts:${PATH}" | ||
|
||
if [[ $GPU_ARCH_TYPE == 'cuda' ]]; then | ||
# TODO: This should be handled by the generic Windows job the same as its done by the generic Linux job | ||
export CUDA_HOME="/c/Program Files/NVIDIA GPU Computing Toolkit/CUDA/v${{ matrix.gpu-arch-version }}" | ||
export CUDA_PATH="${CUDA_HOME}" | ||
fi | ||
|
||
./.github/scripts/unittest.sh |
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.
This just moves the grouping inside the
if
so this doesn't show up empty on non-macos runners.