config.yml 8.29 KB
Newer Older
1
2
3
4
version: 2.1

# How to test the Linux jobs:
#   - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/
Philip Meier's avatar
Philip Meier committed
5
6
#   - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_win_wheel_py3.8
#     - Replace binary_win_wheel_py3.8 with the name of the job you want to test.
Edward Z. Yang's avatar
Edward Z. Yang committed
7
#       Job names are 'name:' key.
8

9
executors:
10
  windows-cpu:
11
    machine:
12
13
14
15
16
17
18
19
      resource_class: windows.xlarge
      image: windows-server-2019-vs2019:stable
      shell: bash.exe

  windows-gpu:
    machine:
      resource_class: windows.gpu.nvidia.medium
      image: windows-server-2019-nvidia:stable
20
21
      shell: bash.exe

22
23
24
25
26
commands:
  checkout_merge:
    description: "checkout merge branch"
    steps:
      - checkout
27
28
29
30
31
#     - run:
#         name: Checkout merge branch
#         command: |
#           set -ex
#           BRANCH=$(git rev-parse --abbrev-ref HEAD)
32
#           if [[ "$BRANCH" != "main" ]]; then
33
34
35
#             git fetch --force origin ${CIRCLE_BRANCH}/merge:merged/${CIRCLE_BRANCH}
#             git checkout "merged/$CIRCLE_BRANCH"
#           fi
36
37
38
39
40
41
42
43
44
45
46
47
  designate_upload_channel:
    description: "inserts the correct upload channel into ${BASH_ENV}"
    steps:
      - run:
          name: adding UPLOAD_CHANNEL to BASH_ENV
          command: |
            our_upload_channel=nightly
            # On tags upload to test instead
            if [[ -n "${CIRCLE_TAG}" ]]; then
              our_upload_channel=test
            fi
            echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
48

Philip Meier's avatar
Philip Meier committed
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
  pip_install:
    parameters:
      args:
        type: string
      descr:
        type: string
        default: ""
      user:
        type: boolean
        default: true
    steps:
      - run:
          name: >
            <<^ parameters.descr >> pip install << parameters.args >> <</ parameters.descr >>
            <<# parameters.descr >> << parameters.descr >>            <</ parameters.descr >>
          command: >
            pip install
            <<# parameters.user >> --user <</ parameters.user >>
            --progress-bar=off
            << parameters.args >>

70
71
binary_common: &binary_common
  parameters:
72
    # Edit these defaults to do a release
73
74
75
76
77
    build_version:
      description: "version number of release binary; by default, build a nightly"
      type: string
      default: ""
    pytorch_version:
78
      description: "PyTorch version to build against; by default, use a nightly"
79
      type: string
80
      default: ""
81
82
    # Don't edit these
    python_version:
83
      description: "Python version to build against (e.g., 3.8)"
84
      type: string
Edward Z. Yang's avatar
Edward Z. Yang committed
85
86
    cu_version:
      description: "CUDA version to build against, in CU format (e.g., cpu or cu100)"
87
      type: string
guyang3532's avatar
guyang3532 committed
88
      default: "cpu"
89
90
91
92
    unicode_abi:
      description: "Python 2.7 wheel only: whether or not we are cp27mu (default: no)"
      type: string
      default: ""
Edward Z. Yang's avatar
Edward Z. Yang committed
93
94
95
    wheel_docker_image:
      description: "Wheel only: what docker image to use"
      type: string
96
      default: ""
97
98
99
100
    conda_docker_image:
      description: "Conda only: what docker image to use"
      type: string
      default: "pytorch/conda-builder:cpu"
101
102
103
104
  environment:
    PYTHON_VERSION: << parameters.python_version >>
    PYTORCH_VERSION: << parameters.pytorch_version >>
    UNICODE_ABI: << parameters.unicode_abi >>
Edward Z. Yang's avatar
Edward Z. Yang committed
105
    CU_VERSION: << parameters.cu_version >>
106
    MACOSX_DEPLOYMENT_TARGET: 10.9
107

guyang3532's avatar
guyang3532 committed
108
109
110
111
112
smoke_test_common: &smoke_test_common
  <<: *binary_common
  docker:
    - image: torchvision/smoke_test:latest

113
jobs:
114
115
  circleci_consistency:
    docker:
116
      - image: cimg/python:3.8
117
118
    steps:
      - checkout
Philip Meier's avatar
Philip Meier committed
119
120
      - pip_install:
          args: jinja2 pyyaml
121
      - run:
Philip Meier's avatar
Philip Meier committed
122
          name: Check CircleCI config consistency
123
124
125
126
          command: |
            python .circleci/regenerate.py
            git diff --exit-code || (echo ".circleci/config.yml not in sync with config.yml.in! Run .circleci/regenerate.py to update config"; exit 1)

guyang3532's avatar
guyang3532 committed
127
128
  smoke_test_docker_image_build:
    machine:
129
      image: ubuntu-2004:202104-01
guyang3532's avatar
guyang3532 committed
130
131
132
133
134
    resource_class: large
    environment:
      image_name: torchvision/smoke_test
    steps:
      - checkout
135
      - designate_upload_channel
guyang3532's avatar
guyang3532 committed
136
137
138
139
140
141
142
143
144
145
146
147
      - run:
          name: Build and push Docker image
          no_output_timeout: "1h"
          command: |
            set +x
            echo "${DOCKER_HUB_TOKEN}" | docker login --username "${DOCKER_HUB_USERNAME}" --password-stdin
            set -x
            cd .circleci/smoke_test/docker && docker build . -t ${image_name}:${CIRCLE_WORKFLOW_ID}
            docker tag ${image_name}:${CIRCLE_WORKFLOW_ID} ${image_name}:latest
            docker push ${image_name}:${CIRCLE_WORKFLOW_ID}
            docker push ${image_name}:latest

148
149
150
  cmake_linux_cpu:
    <<: *binary_common
    docker:
151
      - image: "pytorch/manylinux-cpu"
152
153
154
    resource_class: 2xlarge+
    steps:
      - checkout_merge
155
      - designate_upload_channel
156
157
158
159
160
161
162
163
      - run:
          name: Setup conda
          command: .circleci/unittest/linux/scripts/setup_env.sh
      - run: packaging/build_cmake.sh

  cmake_linux_gpu:
    <<: *binary_common
    machine:
164
      image: ubuntu-2004-cuda-11.4:202110-01
165
    resource_class: gpu.nvidia.small
166
167
    steps:
      - checkout_merge
168
      - designate_upload_channel
169
170
171
172
173
      - run:
          name: Setup conda
          command: docker run -e CU_VERSION -e PYTHON_VERSION -e UNICODE_ABI -e PYTORCH_VERSION -t --gpus all -v $PWD:$PWD -w $PWD << parameters.wheel_docker_image >> .circleci/unittest/linux/scripts/setup_env.sh
      - run:
          name: Build torchvision C++ distribution and test
Andrey Talman's avatar
Andrey Talman committed
174
          no_output_timeout: 30m
175
          command: docker run -e CU_VERSION -e PYTHON_VERSION -e UNICODE_ABI -e PYTORCH_VERSION -e UPLOAD_CHANNEL -t --gpus all -v $PWD:$PWD -w $PWD << parameters.wheel_docker_image >> packaging/build_cmake.sh
176
177
178
179

  cmake_macos_cpu:
    <<: *binary_common
    macos:
180
      xcode: "14.0"
181
182
    steps:
      - checkout_merge
183
      - designate_upload_channel
184
185
186
187
188
      - run:
          command: |
            curl -o conda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-x86_64.sh
            sh conda.sh -b
            source $HOME/miniconda3/bin/activate
189
            conda install -yq conda-build cmake python=<< parameters.python_version >>
190
191
192
193
194
195
196
197
            packaging/build_cmake.sh

  cmake_windows_cpu:
    <<: *binary_common
    executor:
      name: windows-cpu
    steps:
      - checkout_merge
198
      - designate_upload_channel
199
200
201
202
      - run:
          command: |
            set -ex
            source packaging/windows/internal/vc_install_helper.sh
203
204
205
206
            eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
            conda activate base
            conda create -yn python39 python=3.9
            conda activate python39
207
208
209
210
211
212
213
214
            packaging/build_cmake.sh

  cmake_windows_gpu:
    <<: *binary_common
    executor:
      name: windows-gpu
    steps:
      - checkout_merge
215
      - designate_upload_channel
Andrey Talman's avatar
Andrey Talman committed
216
217
218
      - run:
          name: Update CUDA driver
          command: packaging/windows/internal/driver_update.bat
219
220
221
222
223
      - run:
          command: |
            set -ex
            source packaging/windows/internal/vc_install_helper.sh
            packaging/windows/internal/cuda_install.bat
224
225
226
227
228
            eval "$('/C/tools/miniconda3/Scripts/conda.exe' 'shell.bash' 'hook')"
            conda activate
            conda update -y conda
            conda create -yn python39 python=3.9
            conda activate python39
229
230
            packaging/build_cmake.sh

231

232
workflows:
Philip Meier's avatar
Philip Meier committed
233
  lint:
234
235
    jobs:
      - circleci_consistency
Philip Meier's avatar
Philip Meier committed
236

237
238
239
240
241
242
243
  cmake:
    jobs:
      - cmake_linux_cpu:
          cu_version: cpu
          name: cmake_linux_cpu
          python_version: '3.8'
      - cmake_linux_gpu:
244
          cu_version: cu117
245
246
          name: cmake_linux_gpu
          python_version: '3.8'
247
          wheel_docker_image: pytorch/manylinux-cuda117
248
249
250
251
      - cmake_windows_cpu:
          cu_version: cpu
          name: cmake_windows_cpu
          python_version: '3.8'
252
      - cmake_windows_gpu:
253
          cu_version: cu117
254
255
          name: cmake_windows_gpu
          python_version: '3.8'
256
257
258
259
260
      - cmake_macos_cpu:
          cu_version: cpu
          name: cmake_macos_cpu
          python_version: '3.8'

guyang3532's avatar
guyang3532 committed
261
262
263
264
265
266
267
  docker_build:
    triggers:
      - schedule:
          cron: "0 10 * * 0"
          filters:
            branches:
              only:
268
                - main
guyang3532's avatar
guyang3532 committed
269
270
    jobs:
      - smoke_test_docker_image_build:
271
          context: org-member