Skip to content

Commit 1065dad

Browse files
authored
temp. resume github premerge tests (#2853)
* resume github premerge tests Signed-off-by: Wenqi Li <[email protected]> * fixes #2821 Signed-off-by: Wenqi Li <[email protected]> * update group names Signed-off-by: Wenqi Li <[email protected]>
1 parent 415f994 commit 1065dad

File tree

2 files changed

+132
-1
lines changed

2 files changed

+132
-1
lines changed

.github/workflows/pythonapp-gpu.yml

+130
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: build-gpu
2+
3+
on:
4+
# quick tests for pull requests and the releasing branches
5+
push:
6+
branches:
7+
- dev
8+
- main
9+
- releasing/*
10+
pull_request:
11+
12+
concurrency:
13+
# automatically cancel the previously triggered workflows when there's a newer version
14+
group: build-gpu-${{ github.event.pull_request.number || github.ref }}
15+
cancel-in-progress: true
16+
17+
jobs:
18+
GPU-quick-py3: # GPU with full dependencies
19+
if: github.repository == 'Project-MONAI/MONAI'
20+
strategy:
21+
matrix:
22+
environment:
23+
- "PT16+CUDA110"
24+
- "PT17+CUDA102"
25+
- "PT17+CUDA110"
26+
- "PT18+CUDA102"
27+
- "PT19+CUDA113"
28+
- "PT19+CUDA102"
29+
include:
30+
- environment: PT16+CUDA110
31+
# we explicitly set pytorch to -h to avoid pip install error
32+
pytorch: "-h"
33+
base: "nvcr.io/nvidia/pytorch:20.07-py3"
34+
- environment: PT17+CUDA102
35+
pytorch: "torch==1.7.1 torchvision==0.8.2"
36+
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
37+
- environment: PT17+CUDA110
38+
# we explicitly set pytorch to -h to avoid pip install error
39+
pytorch: "-h"
40+
base: "nvcr.io/nvidia/pytorch:20.09-py3"
41+
- environment: PT18+CUDA102
42+
pytorch: "torch==1.8.1 torchvision==0.9.1"
43+
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
44+
- environment: PT19+CUDA113
45+
# we explicitly set pytorch to -h to avoid pip install error
46+
pytorch: "-h"
47+
base: "nvcr.io/nvidia/pytorch:21.06-py3"
48+
- environment: PT19+CUDA102
49+
pytorch: "torch==1.9.0 torchvision==0.10.0"
50+
base: "nvcr.io/nvidia/cuda:10.2-devel-ubuntu18.04"
51+
container:
52+
image: ${{ matrix.base }}
53+
options: --gpus all
54+
runs-on: [self-hosted, linux, x64, common]
55+
steps:
56+
- uses: actions/checkout@v2
57+
- name: apt install
58+
run: |
59+
if [ ${{ matrix.environment }} = "PT17+CUDA102" ] || \
60+
[ ${{ matrix.environment }} = "PT18+CUDA102" ] || \
61+
[ ${{ matrix.environment }} = "PT19+CUDA102" ]
62+
then
63+
PYVER=3.6 PYSFX=3 DISTUTILS=python3-distutils && \
64+
apt-get update && apt-get install -y --no-install-recommends \
65+
curl \
66+
pkg-config \
67+
python$PYVER \
68+
python$PYVER-dev \
69+
python$PYSFX-pip \
70+
$DISTUTILS \
71+
rsync \
72+
swig \
73+
unzip \
74+
zip \
75+
zlib1g-dev \
76+
libboost-locale-dev \
77+
libboost-program-options-dev \
78+
libboost-system-dev \
79+
libboost-thread-dev \
80+
libboost-test-dev \
81+
libgoogle-glog-dev \
82+
libjsoncpp-dev \
83+
cmake \
84+
git && \
85+
rm -rf /var/lib/apt/lists/* && \
86+
export PYTHONIOENCODING=utf-8 LC_ALL=C.UTF-8 && \
87+
rm -f /usr/bin/python && \
88+
rm -f /usr/bin/python`echo $PYVER | cut -c1-1` && \
89+
ln -s /usr/bin/python$PYVER /usr/bin/python && \
90+
ln -s /usr/bin/python$PYVER /usr/bin/python`echo $PYVER | cut -c1-1` &&
91+
curl -O https://bootstrap.pypa.io/get-pip.py && \
92+
python get-pip.py && \
93+
rm get-pip.py;
94+
fi
95+
- name: Install dependencies
96+
run: |
97+
which python
98+
python -m pip install --upgrade pip wheel
99+
python -m pip install ${{ matrix.pytorch }}
100+
python -m pip install -r requirements-dev.txt
101+
python -m pip list
102+
- name: Run quick tests (GPU)
103+
run: |
104+
git clone --depth 1 \
105+
https://github.com/Project-MONAI/MONAI-extra-test-data.git /MONAI-extra-test-data
106+
export MONAI_EXTRA_TEST_DATA="/MONAI-extra-test-data"
107+
nvidia-smi
108+
export LAUNCH_DELAY=$(python -c "import numpy; print(numpy.random.randint(30) * 10)")
109+
echo "Sleep $LAUNCH_DELAY"
110+
sleep $LAUNCH_DELAY
111+
export CUDA_VISIBLE_DEVICES=$(coverage run -m tests.utils)
112+
echo $CUDA_VISIBLE_DEVICES
113+
trap 'if pgrep python; then pkill python; fi;' ERR
114+
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
115+
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
116+
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
117+
python -c "import monai; monai.config.print_config()"
118+
# build for the current self-hosted CI Tesla V100
119+
BUILD_MONAI=1 TORCH_CUDA_ARCH_LIST="7.0" ./runtests.sh --quick --unittests
120+
if [ ${{ matrix.environment }} = "PT19+CUDA102" ]; then
121+
# test the clang-format tool downloading once
122+
coverage run -m tests.clang_format_utils
123+
fi
124+
coverage xml
125+
if pgrep python; then pkill python; fi
126+
shell: bash
127+
- name: Upload coverage
128+
uses: codecov/codecov-action@v1
129+
with:
130+
file: ./coverage.xml

tests/test_gaussian_filter.py

+2-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
from parameterized import parameterized
1717

1818
from monai.networks.layers import GaussianFilter
19-
from tests.utils import skip_if_quick
19+
from tests.utils import SkipIfBeforePyTorchVersion, skip_if_quick
2020

2121
TEST_CASES = [[{"type": "erf", "gt": 2.0}], [{"type": "scalespace", "gt": 3.0}], [{"type": "sampled", "gt": 5.0}]]
2222
TEST_CASES_GPU = [
@@ -85,6 +85,7 @@ def code_to_run(self, input_args):
8585
)
8686

8787
@parameterized.expand(TEST_CASES + TEST_CASES_GPU + TEST_CASES_3d)
88+
@SkipIfBeforePyTorchVersion((1, 7))
8889
def test_train_quick(self, input_args):
8990
self.code_to_run(input_args)
9091

0 commit comments

Comments
 (0)