From ad9ee3ae9128dfe513b555aa3f006135cbc3521a Mon Sep 17 00:00:00 2001 From: vfdev-5 Date: Mon, 7 Nov 2022 10:40:27 +0000 Subject: [PATCH 1/8] Try add GPU ci for prototype transforms --- .../prototype-transforms-tests-linux-gpu.yml | 65 +++++++++++++++++++ 1 file changed, 65 insertions(+) create mode 100644 .github/workflows/prototype-transforms-tests-linux-gpu.yml diff --git a/.github/workflows/prototype-transforms-tests-linux-gpu.yml b/.github/workflows/prototype-transforms-tests-linux-gpu.yml new file mode 100644 index 00000000000..1617861662a --- /dev/null +++ b/.github/workflows/prototype-transforms-tests-linux-gpu.yml @@ -0,0 +1,65 @@ +name: Prototype transforms unit-tests on Linux GPU + +on: + pull_request: + push: + branches: + - nightly + - main + - release/* + workflow_dispatch: + +env: + CHANNEL: "nightly" + +jobs: + tests: + strategy: + matrix: + python_version: ["3.8"] + cuda_arch_version: ["11.6"] + fail-fast: false + uses: pytorch/test-infra/.github/workflows/linux_job.yml@main + with: + runner: linux.g5.4xlarge.nvidia.gpu + repository: pytorch/vision + gpu-arch-type: cuda + gpu-arch-version: ${{ matrix.cuda_arch_version }} + timeout: 120 + script: | + # Mark Build Directory Safe + git config --global --add safe.directory /__w/vision/vision + + # Set up Environment Variables + export PYTHON_VERSION="${{ matrix.python_version }}" + export VERSION="${{ matrix.cuda_arch_version }}" + export CUDATOOLKIT="pytorch-cuda=${VERSION}" + + # Set CHANNEL + if [[ (${GITHUB_EVENT_NAME} = 'pull_request' && (${GITHUB_BASE_REF} = 'release'*)) || (${GITHUB_REF} = 'refs/heads/release'*) ]]; then + export CHANNEL=test + else + export CHANNEL=nightly + fi + + # Create Conda Env + conda create -yp ci_env python="${PYTHON_VERSION}" numpy libpng jpeg scipy + conda activate /work/ci_env + + # Install PyTorch, Torchvision, and testing libraries + set -ex + conda install \ + --yes \ + -c "pytorch-${CHANNEL}" \ + -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] torchdata \ + "${CUDATOOLKIT}" + python3 setup.py develop + python3 -m pip install pytest pytest-mock pytest-cov + + # Run Tests + python3 -m torch.utils.collect_env + python3 -m pytest \ + --durations=20 \ + --cov=torchvision/prototype/transforms \ + --cov-report=term-missing \ + test/test_prototype_transforms*.py From 8678fa9bebeed9e4cd2d18ef0f24894ba336e136 Mon Sep 17 00:00:00 2001 From: vfdev Date: Thu, 8 Dec 2022 01:08:42 +0100 Subject: [PATCH 2/8] Update prototype-transforms-tests-linux-gpu.yml --- .github/workflows/prototype-transforms-tests-linux-gpu.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/prototype-transforms-tests-linux-gpu.yml b/.github/workflows/prototype-transforms-tests-linux-gpu.yml index 1617861662a..f56b21d54d3 100644 --- a/.github/workflows/prototype-transforms-tests-linux-gpu.yml +++ b/.github/workflows/prototype-transforms-tests-linux-gpu.yml @@ -53,6 +53,9 @@ jobs: -c "pytorch-${CHANNEL}" \ -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] torchdata \ "${CUDATOOLKIT}" + + python3 -c "import torch; exit(not torch.cuda.is_available())" + python3 setup.py develop python3 -m pip install pytest pytest-mock pytest-cov From a477c9b6ff5028f66e5402c427fb4f68186e854f Mon Sep 17 00:00:00 2001 From: vfdev Date: Thu, 8 Dec 2022 01:23:54 +0100 Subject: [PATCH 3/8] Update prototype-transforms-tests-linux-gpu.yml --- .github/workflows/prototype-transforms-tests-linux-gpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prototype-transforms-tests-linux-gpu.yml b/.github/workflows/prototype-transforms-tests-linux-gpu.yml index f56b21d54d3..a8ffcd958a5 100644 --- a/.github/workflows/prototype-transforms-tests-linux-gpu.yml +++ b/.github/workflows/prototype-transforms-tests-linux-gpu.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false uses: pytorch/test-infra/.github/workflows/linux_job.yml@main with: - runner: linux.g5.4xlarge.nvidia.gpu + runner: linux.4xlarge.nvidia.gpu repository: pytorch/vision gpu-arch-type: cuda gpu-arch-version: ${{ matrix.cuda_arch_version }} From c7d83fb90e9c6799be3afe83926a152cda8b4d8a Mon Sep 17 00:00:00 2001 From: vfdev Date: Thu, 8 Dec 2022 01:30:44 +0100 Subject: [PATCH 4/8] Update prototype-transforms-tests-linux-gpu.yml --- .github/workflows/prototype-transforms-tests-linux-gpu.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/prototype-transforms-tests-linux-gpu.yml b/.github/workflows/prototype-transforms-tests-linux-gpu.yml index a8ffcd958a5..db0a269416d 100644 --- a/.github/workflows/prototype-transforms-tests-linux-gpu.yml +++ b/.github/workflows/prototype-transforms-tests-linux-gpu.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false uses: pytorch/test-infra/.github/workflows/linux_job.yml@main with: - runner: linux.4xlarge.nvidia.gpu + runner: linux.g5.4xlarge.nvidia.gpu # or linux.4xlarge.nvidia.gpu repository: pytorch/vision gpu-arch-type: cuda gpu-arch-version: ${{ matrix.cuda_arch_version }} From 62f4c9409931e09ee082c0c443354802b4f70cf0 Mon Sep 17 00:00:00 2001 From: vfdev Date: Thu, 8 Dec 2022 12:51:14 +0100 Subject: [PATCH 5/8] Update prototype-transforms-tests-linux-gpu.yml --- .github/workflows/prototype-transforms-tests-linux-gpu.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prototype-transforms-tests-linux-gpu.yml b/.github/workflows/prototype-transforms-tests-linux-gpu.yml index db0a269416d..249f23d5d31 100644 --- a/.github/workflows/prototype-transforms-tests-linux-gpu.yml +++ b/.github/workflows/prototype-transforms-tests-linux-gpu.yml @@ -21,7 +21,7 @@ jobs: fail-fast: false uses: pytorch/test-infra/.github/workflows/linux_job.yml@main with: - runner: linux.g5.4xlarge.nvidia.gpu # or linux.4xlarge.nvidia.gpu + runner: linux.4xlarge.nvidia.gpu repository: pytorch/vision gpu-arch-type: cuda gpu-arch-version: ${{ matrix.cuda_arch_version }} @@ -51,7 +51,7 @@ jobs: conda install \ --yes \ -c "pytorch-${CHANNEL}" \ - -c nvidia "pytorch-${CHANNEL}"::pytorch[build="*${VERSION}*"] torchdata \ + -c nvidia pytorch torchdata \ "${CUDATOOLKIT}" python3 -c "import torch; exit(not torch.cuda.is_available())" From 639c5982e5a9bae1de091ffc708a7da9ac1d498b Mon Sep 17 00:00:00 2001 From: vfdev Date: Thu, 8 Dec 2022 14:54:08 +0100 Subject: [PATCH 6/8] Update prototype-transforms-tests-linux-gpu.yml --- .github/workflows/prototype-transforms-tests-linux-gpu.yml | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/.github/workflows/prototype-transforms-tests-linux-gpu.yml b/.github/workflows/prototype-transforms-tests-linux-gpu.yml index 249f23d5d31..c0aa80284e2 100644 --- a/.github/workflows/prototype-transforms-tests-linux-gpu.yml +++ b/.github/workflows/prototype-transforms-tests-linux-gpu.yml @@ -50,10 +50,9 @@ jobs: set -ex conda install \ --yes \ - -c "pytorch-${CHANNEL}" \ - -c nvidia pytorch torchdata \ - "${CUDATOOLKIT}" - + -c "pytorch-${CHANNEL}" -c nvidia \ + pytorch torchdata "${CUDATOOLKIT}" + python3 -c "import torch; exit(not torch.cuda.is_available())" python3 setup.py develop From 0e05e11807752afb25c1bc24cda6a49bcbdd04c2 Mon Sep 17 00:00:00 2001 From: Philip Meier Date: Thu, 8 Dec 2022 15:55:58 +0100 Subject: [PATCH 7/8] add small tolerance for adjust_contrast on CUDA --- test/prototype_transforms_kernel_infos.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/test/prototype_transforms_kernel_infos.py b/test/prototype_transforms_kernel_infos.py index 9d97b6ca701..ded888a4a00 100644 --- a/test/prototype_transforms_kernel_infos.py +++ b/test/prototype_transforms_kernel_infos.py @@ -1940,11 +1940,13 @@ def sample_inputs_adjust_contrast_video(): closeness_kwargs={ **pil_reference_pixel_difference(), **float32_vs_uint8_pixel_difference(2), + **cuda_vs_cpu_pixel_difference(), }, ), KernelInfo( F.adjust_contrast_video, sample_inputs_fn=sample_inputs_adjust_contrast_video, + closeness_kwargs=cuda_vs_cpu_pixel_difference(), ), ] ) From 7183d03140e23d13a7031bd7e75809d084da3565 Mon Sep 17 00:00:00 2001 From: vfdev Date: Fri, 9 Dec 2022 09:23:09 +0100 Subject: [PATCH 8/8] [skip-ci] update --- .github/workflows/prototype-transforms-tests-linux-gpu.yml | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/.github/workflows/prototype-transforms-tests-linux-gpu.yml b/.github/workflows/prototype-transforms-tests-linux-gpu.yml index c0aa80284e2..e5740886b22 100644 --- a/.github/workflows/prototype-transforms-tests-linux-gpu.yml +++ b/.github/workflows/prototype-transforms-tests-linux-gpu.yml @@ -50,8 +50,11 @@ jobs: set -ex conda install \ --yes \ - -c "pytorch-${CHANNEL}" -c nvidia \ - pytorch torchdata "${CUDATOOLKIT}" + -c "pytorch-${CHANNEL}" \ + -c nvidia \ + pytorch \ + torchdata \ + "${CUDATOOLKIT}" python3 -c "import torch; exit(not torch.cuda.is_available())"