Skip to content

Commit 677fc93

Browse files
vfdev-5pmeier
andauthored
[proto][ci] Try add GPU ci for prototype transforms (#6919)
* Try add GPU ci for prototype transforms * Update prototype-transforms-tests-linux-gpu.yml * Update prototype-transforms-tests-linux-gpu.yml * Update prototype-transforms-tests-linux-gpu.yml * Update prototype-transforms-tests-linux-gpu.yml * Update prototype-transforms-tests-linux-gpu.yml * add small tolerance for adjust_contrast on CUDA * [skip-ci] update Co-authored-by: Philip Meier <[email protected]>
1 parent 029cb3f commit 677fc93

File tree

2 files changed

+72
-0
lines changed

2 files changed

+72
-0
lines changed
Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
name: Prototype transforms 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.8"]
20+
cuda_arch_version: ["11.6"]
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+
timeout: 120
29+
script: |
30+
# Mark Build Directory Safe
31+
git config --global --add safe.directory /__w/vision/vision
32+
33+
# Set up Environment Variables
34+
export PYTHON_VERSION="${{ matrix.python_version }}"
35+
export VERSION="${{ matrix.cuda_arch_version }}"
36+
export CUDATOOLKIT="pytorch-cuda=${VERSION}"
37+
38+
# Set CHANNEL
39+
if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then
40+
export CHANNEL=test
41+
else
42+
export CHANNEL=nightly
43+
fi
44+
45+
# Create Conda Env
46+
conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy
47+
conda activate /work/ci_env
48+
49+
# Install PyTorch, Torchvision, and testing libraries
50+
set -ex
51+
conda install \
52+
--yes \
53+
-c "pytorch-${CHANNEL}" \
54+
-c nvidia \
55+
pytorch \
56+
torchdata \
57+
"${CUDATOOLKIT}"
58+
59+
python3 -c "import torch; exit(not torch.cuda.is_available())"
60+
61+
python3 setup.py develop
62+
python3 -m pip install pytest pytest-mock pytest-cov
63+
64+
# Run Tests
65+
python3 -m torch.utils.collect_env
66+
python3 -m pytest \
67+
--durations=20 \
68+
--cov=torchvision/prototype/transforms \
69+
--cov-report=term-missing \
70+
test/test_prototype_transforms*.py

test/prototype_transforms_kernel_infos.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1940,11 +1940,13 @@ def sample_inputs_adjust_contrast_video():
19401940
closeness_kwargs={
19411941
**pil_reference_pixel_difference(),
19421942
**float32_vs_uint8_pixel_difference(2),
1943+
**cuda_vs_cpu_pixel_difference(),
19431944
},
19441945
),
19451946
KernelInfo(
19461947
F.adjust_contrast_video,
19471948
sample_inputs_fn=sample_inputs_adjust_contrast_video,
1949+
closeness_kwargs=cuda_vs_cpu_pixel_difference(),
19481950
),
19491951
]
19501952
)

0 commit comments

Comments
 (0)