Skip to content

Commit a6ea630

Browse files
committed
[Fix]Fix circile ci env (open-mmlab#2467)
## Motivation 1. circle ci failed without zlib1g-dev installation 3. add approve button ## Modification 1. .circleci/
1 parent b312e79 commit a6ea630

File tree

4 files changed

+250
-151
lines changed

4 files changed

+250
-151
lines changed

.circleci/config.yml

Lines changed: 28 additions & 151 deletions
Original file line numberDiff line numberDiff line change
@@ -1,157 +1,34 @@
11
version: 2.1
22

3-
jobs:
4-
lint:
5-
docker:
6-
- image: cimg/python:3.7.4
7-
steps:
8-
- checkout
9-
- run:
10-
name: Install dependencies
11-
command: |
12-
sudo apt-add-repository ppa:brightbox/ruby-ng -y
13-
sudo apt-get update
14-
sudo apt-get install -y ruby2.7
15-
- run:
16-
name: Install pre-commit hook
17-
command: |
18-
pip install pre-commit
19-
pre-commit install
20-
- run:
21-
name: Linting
22-
command: pre-commit run --all-files
23-
- run:
24-
name: Check docstring coverage
25-
command: |
26-
pip install interrogate
27-
interrogate -v --ignore-init-method --ignore-module --ignore-nested-functions --ignore-regex "__repr__" --fail-under 50 mmseg
3+
# this allows you to use CircleCI's dynamic configuration feature
4+
setup: true
285

29-
build_cpu:
30-
parameters:
31-
# The python version must match available image tags in
32-
# https://circleci.com/developer/images/image/cimg/python
33-
python:
34-
type: string
35-
default: "3.7.4"
36-
torch:
37-
type: string
38-
torchvision:
39-
type: string
40-
docker:
41-
- image: cimg/python:<< parameters.python >>
42-
resource_class: large
43-
steps:
44-
- checkout
45-
- run:
46-
name: Install Libraries
47-
command: |
48-
sudo apt-get update
49-
sudo apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx libjpeg-dev zlib1g-dev libtinfo-dev libncurses5
50-
- run:
51-
name: Configure Python & pip
52-
command: |
53-
python -m pip install --upgrade pip
54-
python -m pip install wheel
55-
- run:
56-
name: Install PyTorch
57-
command: |
58-
python -V
59-
python -m pip install torch==<< parameters.torch >>+cpu torchvision==<< parameters.torchvision >>+cpu -f https://download.pytorch.org/whl/torch_stable.html
60-
- run:
61-
name: Install mmseg dependencies
62-
command: |
63-
python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cpu/torch<< parameters.torch >>/index.html
64-
python -m pip install -r requirements.txt
65-
- run:
66-
name: Build and install
67-
command: |
68-
python -m pip install -e .
69-
- run:
70-
name: Run unittests but skip timm unittests
71-
command: |
72-
python -m coverage run --branch --source mmseg -m pytest tests/ --ignore tests/test_models/test_backbones/test_timm_backbone.py
73-
python -m coverage xml
74-
python -m coverage report -m
75-
76-
build_cu101:
77-
machine:
78-
image: ubuntu-1604-cuda-10.1:201909-23
79-
resource_class: gpu.nvidia.small
80-
steps:
81-
- checkout
82-
- run:
83-
name: Install Libraries
84-
command: |
85-
sudo apt-get update
86-
sudo apt-get install -y git ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx
87-
- run:
88-
name: Configure Python & pip
89-
command: |
90-
pyenv global 3.7.0
91-
python -m pip install --upgrade pip
92-
python -m pip install wheel
93-
- run:
94-
name: Install PyTorch
95-
command: |
96-
python -V
97-
python -m pip install torch==1.6.0+cu101 torchvision==0.7.0+cu101 -f https://download.pytorch.org/whl/torch_stable.html
98-
- run:
99-
name: Install mmseg dependencies
100-
# python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch${{matrix.torch_version}}/index.html
101-
command: |
102-
python -m pip install mmcv-full -f https://download.openmmlab.com/mmcv/dist/cu101/torch1.6.0/index.html
103-
python -m pip install -r requirements.txt
104-
- run:
105-
name: Build and install
106-
command: |
107-
python setup.py check -m -s
108-
TORCH_CUDA_ARCH_LIST=7.0 python -m pip install -e .
109-
- run:
110-
name: Run unittests but skip timm unittests
111-
command: |
112-
python -m pytest tests/ --ignore tests/test_models/test_backbones/test_timm_backbone.py
6+
# the path-filtering orb is required to continue a pipeline based on
7+
# the path of an updated fileset
8+
orbs:
9+
path-filtering: circleci/[email protected]
11310

11411
workflows:
115-
unit_tests:
12+
# the always-run workflow is always triggered, regardless of the pipeline parameters.
13+
always-run:
11614
jobs:
117-
- lint
118-
- build_cpu:
119-
name: build_cpu_th1.6
120-
torch: 1.6.0
121-
torchvision: 0.7.0
122-
requires:
123-
- lint
124-
- build_cpu:
125-
name: build_cpu_th1.7
126-
torch: 1.7.0
127-
torchvision: 0.8.1
128-
requires:
129-
- lint
130-
- build_cpu:
131-
name: build_cpu_th1.8_py3.9
132-
torch: 1.8.0
133-
torchvision: 0.9.0
134-
python: "3.9.0"
135-
requires:
136-
- lint
137-
- build_cpu:
138-
name: build_cpu_th1.9_py3.8
139-
torch: 1.9.0
140-
torchvision: 0.10.0
141-
python: "3.8.0"
142-
requires:
143-
- lint
144-
- build_cpu:
145-
name: build_cpu_th1.9_py3.9
146-
torch: 1.9.0
147-
torchvision: 0.10.0
148-
python: "3.9.0"
149-
requires:
150-
- lint
151-
- build_cu101:
152-
requires:
153-
- build_cpu_th1.6
154-
- build_cpu_th1.7
155-
- build_cpu_th1.8_py3.9
156-
- build_cpu_th1.9_py3.8
157-
- build_cpu_th1.9_py3.9
15+
# the path-filtering/filter job determines which pipeline
16+
# parameters to update.
17+
- path-filtering/filter:
18+
name: check-updated-files
19+
# 3-column, whitespace-delimited mapping. One mapping per
20+
# line:
21+
# <regex path-to-test> <parameter-to-set> <value-of-pipeline-parameter>
22+
mapping: |
23+
mmseg/.* lint_only false
24+
requirements/.* lint_only false
25+
tests/.* lint_only false
26+
tools/.* lint_only false
27+
configs/.* lint_only false
28+
.circleci/.* lint_only false
29+
base-revision: master
30+
# this is the path of the configuration we should trigger once
31+
# path filtering and pipeline parameter value updates are
32+
# complete. In this case, we are using the parent dynamic
33+
# configuration itself.
34+
config-path: .circleci/test.yml

.circleci/docker/Dockerfile

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ARG PYTORCH="1.8.1"
2+
ARG CUDA="10.2"
3+
ARG CUDNN="7"
4+
5+
FROM pytorch/pytorch:${PYTORCH}-cuda${CUDA}-cudnn${CUDNN}-devel
6+
7+
# To fix GPG key error when running apt-get update
8+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/cuda/repos/ubuntu1804/x86_64/3bf863cc.pub
9+
RUN apt-key adv --fetch-keys https://developer.download.nvidia.com/compute/machine-learning/repos/ubuntu1804/x86_64/7fa2af80.pub
10+
11+
RUN apt-get update && apt-get install -y ninja-build libglib2.0-0 libsm6 libxrender-dev libxext6 libgl1-mesa-glx

.circleci/scripts/get_mmcv_var.sh

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
TORCH=$1
4+
CUDA=$2
5+
6+
# 10.2 -> cu102
7+
MMCV_CUDA="cu`echo ${CUDA} | tr -d '.'`"
8+
9+
# MMCV only provides pre-compiled packages for torch 1.x.0
10+
# which works for any subversions of torch 1.x.
11+
# We force the torch version to be 1.x.0 to ease package searching
12+
# and avoid unnecessary rebuild during MMCV's installation.
13+
TORCH_VER_ARR=(${TORCH//./ })
14+
TORCH_VER_ARR[2]=0
15+
printf -v MMCV_TORCH "%s." "${TORCH_VER_ARR[@]}"
16+
MMCV_TORCH=${MMCV_TORCH%?} # Remove the last dot
17+
18+
echo "export MMCV_CUDA=${MMCV_CUDA}" >> $BASH_ENV
19+
echo "export MMCV_TORCH=${MMCV_TORCH}" >> $BASH_ENV

0 commit comments

Comments
 (0)