-
-
Notifications
You must be signed in to change notification settings - Fork 636
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
MPS
Backend [without torch.amp.autocast ] (#2993)
* Add support for "mps" device in ignite.distributed.base * Made changes in the supervised_trainer API to have mps devices, Added some tests * autopep8 fix * Added lint fixes * Setup ci for mps tests --------- Co-authored-by: guptaaryan16 <[email protected]> Co-authored-by: vfdev <[email protected]>
- Loading branch information
1 parent
2ae9844
commit b0b0fe4
Showing
5 changed files
with
164 additions
and
7 deletions.
There are no files selected for viewing
This file contains 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,114 @@ | ||
name: Run unit tests on M1 | ||
on: | ||
push: | ||
branches: | ||
- master | ||
- "*.*.*" | ||
paths: | ||
- "ignite/**" | ||
- "tests/ignite/**" | ||
- "tests/run_code_style.sh" | ||
- "examples/**.py" | ||
- "requirements-dev.txt" | ||
- ".github/workflows/mps-tests.yml" | ||
pull_request: | ||
paths: | ||
- "ignite/**" | ||
- "tests/ignite/**" | ||
- "tests/run_code_style.sh" | ||
- "examples/**.py" | ||
- "requirements-dev.txt" | ||
- ".github/workflows/mps-tests.yml" | ||
workflow_dispatch: | ||
|
||
concurrency: | ||
# <workflow_name>-<branch_name>-<true || commit_sha (if branch is protected)> | ||
group: mps-tests-${{ github.ref_name }}-${{ !(github.ref_protected) || github.sha }} | ||
cancel-in-progress: true | ||
|
||
# Cherry-picked from | ||
# - https://github.com/pytorch/vision/main/.github/workflows/tests.yml | ||
# - https://github.com/pytorch/test-infra/blob/main/.github/workflows/macos_job.yml | ||
|
||
jobs: | ||
mps-tests: | ||
strategy: | ||
matrix: | ||
python-version: | ||
- "3.8" | ||
pytorch-channel: ["pytorch"] | ||
skip-distrib-tests: 1 | ||
fail-fast: false | ||
runs-on: ["macos-m1-12"] | ||
timeout-minutes: 60 | ||
|
||
steps: | ||
- name: Clean workspace | ||
run: | | ||
echo "::group::Cleanup debug output" | ||
sudo rm -rfv "${GITHUB_WORKSPACE}" | ||
mkdir -p "${GITHUB_WORKSPACE}" | ||
echo "::endgroup::" | ||
- name: Checkout repository (pytorch/test-infra) | ||
uses: actions/checkout@v3 | ||
with: | ||
# Support the use case where we need to checkout someone's fork | ||
repository: pytorch/test-infra | ||
path: test-infra | ||
|
||
- name: Setup miniconda | ||
uses: ./test-infra/.github/actions/setup-miniconda | ||
with: | ||
python-version: ${{ matrix.python-version }} | ||
|
||
- name: Checkout repository (${{ github.repository }}) | ||
uses: actions/checkout@v3 | ||
with: | ||
# Support the use case where we need to checkout someone's fork | ||
repository: ${{ github.repository }} | ||
ref: ${{ github.ref }} | ||
path: ${{ github.repository }} | ||
fetch-depth: 1 | ||
|
||
- name: Install PyTorch | ||
if: ${{ matrix.pytorch-channel == 'pytorch' }} | ||
shell: bash -l {0} | ||
continue-on-error: false | ||
run: pip install --upgrade torch torchvision --index-url https://download.pytorch.org/whl/cu118 | ||
|
||
- name: Install PyTorch (nightly) | ||
if: ${{ matrix.pytorch-channel == 'pytorch-nightly' }} | ||
run: pip install torch torchvision -f https://download.pytorch.org/whl/nightly/cpu/torch_nightly.html --pre | ||
|
||
- name: Install dependencies | ||
run: | | ||
pip install -r requirements-dev.txt | ||
pip install -e . | ||
pip list | ||
# Download MNIST: https://github.com/pytorch/ignite/issues/1737 | ||
# to "/tmp" for unit tests | ||
- name: Download MNIST | ||
uses: pytorch-ignite/download-mnist-github-action@master | ||
with: | ||
target_dir: /tmp | ||
|
||
# Copy MNIST to "." for the examples | ||
- name: Copy MNIST | ||
run: | | ||
cp -R /tmp/MNIST . | ||
- name: Run Tests | ||
run: | | ||
SKIP_DISTRIB_TESTS=${{ matrix.skip-distrib-tests }} bash tests/run_cpu_tests.sh | ||
- name: Upload coverage to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
file: ${{ github.repository }}/coverage.xml | ||
flags: mps | ||
fail_ci_if_error: false | ||
|
||
- name: Run MNIST Examples | ||
run: python examples/mnist/mnist.py --epochs=1 |
This file contains 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
This file contains 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
This file contains 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
This file contains 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