Skip to content

Commit 3e2eb3a

Browse files
committed
[Nova] GHA Linux GPU Job
1 parent 246de07 commit 3e2eb3a

File tree

2 files changed

+62
-2
lines changed

2 files changed

+62
-2
lines changed

.github/workflows/test-linux-cpu.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ jobs:
1616
tests:
1717
strategy:
1818
matrix:
19-
py_vers: ["3.7", "3.8", "3.9", "3.10"]
19+
python_version: ["3.7", "3.8", "3.9", "3.10"]
2020
fail-fast: false
2121
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
2222
with:
@@ -27,7 +27,7 @@ jobs:
2727
git config --global --add safe.directory /__w/vision/vision
2828
2929
# Set up Environment Variables
30-
export PYTHON_VERSION="${{ matrix.py_vers }}"
30+
export PYTHON_VERSION="${{ matrix.python_version }}"
3131
export VERSION="cpu"
3232
export CUDATOOLKIT="cpuonly"
3333

.github/workflows/test-linux-gpu.yml

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
name: Unit-tests on Linux GPU
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- nightly
8+
- main
9+
- release/*
10+
workflow_dispatch:
11+
12+
env:
13+
CHANNEL: "nightly"
14+
15+
jobs:
16+
tests:
17+
strategy:
18+
matrix:
19+
python_version: ["3.7", "3.8", "3.9", "3.10"]
20+
cuda_arch_version: ["11.6", "11.7"]
21+
fail-fast: false
22+
uses: pytorch/test-infra/.github/workflows/linux_job.yml@main
23+
with:
24+
runner: linux.4xlarge.nvidia.gpu
25+
repository: pytorch/vision
26+
gpu-arch-type: cuda
27+
gpu-arch-version: ${{ matrix.cuda_arch_version }}
28+
script: |
29+
# Mark Build Directory Safe
30+
git config --global --add safe.directory /__w/vision/vision
31+
32+
# Set up Environment Variables
33+
export PYTHON_VERSION="${{ matrix.python_version }}"
34+
export VERSION="${{ matrix.cuda_arch_version }}"
35+
export CUDATOOLKIT="pytorch-cuda=${VERSION}"
36+
37+
# Set CHANNEL
38+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
39+
export CHANNEL=test
40+
else
41+
export CHANNEL=nightly
42+
fi
43+
44+
# Create Conda Env
45+
conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy
46+
conda activate /work/ci_env
47+
48+
# Install PyTorch, Torchvision, and testing libraries
49+
set -ex
50+
conda install \
51+
--yes \
52+
-c "pytorch-${CHANNEL}" \
53+
-c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] \
54+
"${CUDATOOLKIT}"
55+
python3 setup.py develop
56+
python3 -m pip install pytest pytest-mock 'av<10'
57+
58+
# Run Tests
59+
python3 -m torch.utils.collect_env
60+
python3 -m pytest --junitxml=test-results/junit.xml -v --durations 20

0 commit comments

Comments
 (0)