config.yml 15 KB
Newer Older
1
2
version: 2.1

3
# How to test the Linux jobs:
4
#   - Install CircleCI local CLI: https://circleci.com/docs/2.0/local-cli/
5
6
#   - circleci config process .circleci/config.yml > gen.yml && circleci local execute -c gen.yml --job binary_linux_wheel_py3.8
#     - Replace binary_linux_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
10
11
12
13
14
executors:
  windows-cpu:
    machine:
      resource_class: windows.xlarge
      image: windows-server-2019-vs2019:stable
      shell: bash.exe
peterjc123's avatar
peterjc123 committed
15

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

22
commands:
23
24
25
26
27
28
  generate_cache_key:
    description: "Generates a cache key file that changes daily"
    steps:
      - run:
          name: Generate cache key
          command: echo "$(date +"%Y-%m-%d")" > .cachekey
29
30
31
32
33
34
35
36
  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
37
            if [[ -n "${CIRCLE_TAG}" ]] || [[ ${CIRCLE_BRANCH} =~ release/* ]]; then
38
39
40
              our_upload_channel=test
            fi
            echo "export UPLOAD_CHANNEL=${our_upload_channel}" >> ${BASH_ENV}
Eli Uriegas's avatar
Eli Uriegas committed
41
42
43
44
45
46
47
  load_conda_channel_flags:
    description: "Determines whether we need extra conda channels"
    steps:
      - run:
          name: Adding CONDA_CHANNEL_FLAGS to BASH_ENV
          command: |
              CONDA_CHANNEL_FLAGS=""
48
              # formerly used to add conda-forge flags for Python 3.9, reserving the mechanism for future python upgrades
49
50
51
52
53
54
55
  windows_install_cuda:
    description: "Install desired CUDA version on Windows runners"
    steps:
      - run:
          name: Install CUDA
          command: |
              packaging/windows/internal/cuda_install.bat
56

57
58
binary_common: &binary_common
  parameters:
Edward Z. Yang's avatar
Edward Z. Yang committed
59
    # Edit these defaults to do a release
60
61
62
63
64
65
66
67
68
69
    build_version:
      description: "version number of release binary; by default, build a nightly"
      type: string
      default: ""
    pytorch_version:
      description: "PyTorch version to build against; by default, use a nightly"
      type: string
      default: ""
    # Don't edit these
    python_version:
70
      description: "Python version to build against (e.g., 3.8)"
71
      type: string
Nikita Shulga's avatar
Nikita Shulga committed
72
73
74
75
76
77
78
    cuda_version:
      description: "CUDA version to build against (e.g., cpu, cu101)"
      type: string
      default: "cpu"
    wheel_docker_image:
      description: "Wheel only: what docker image to use"
      type: string
atalman's avatar
atalman committed
79
      default: "pytorch/manylinux-cuda116"
Nikita Shulga's avatar
Nikita Shulga committed
80
81
82
    conda_docker_image:
      description: "Conda only: what docker image to use"
      type: string
atalman's avatar
atalman committed
83
      default: "pytorch/conda-builder:cuda116"
84
  environment: &environment
85
86
87
    PYTHON_VERSION: << parameters.python_version >>
    BUILD_VERSION: << parameters.build_version >>
    PYTORCH_VERSION: << parameters.pytorch_version >>
Nikita Shulga's avatar
Nikita Shulga committed
88
    CU_VERSION: << parameters.cuda_version >>
89
    MACOSX_DEPLOYMENT_TARGET: 10.9
90

Mingbo Wan's avatar
Mingbo Wan committed
91
92
93
smoke_test_common: &smoke_test_common
  <<: *binary_common
  docker:
94
    - image: pytorch/torchaudio_unittest_base:smoke_test-20220425
Caroline Chen's avatar
Caroline Chen committed
95
  resource_class: large
Mingbo Wan's avatar
Mingbo Wan committed
96

97
jobs:
98
99
  circleci_consistency:
    docker:
moto's avatar
moto committed
100
      - image: cimg/python:3.8
101
102
103
104
    steps:
      - checkout
      - run:
          command: |
105
            pip install --user --progress-bar off jinja2 pyyaml
106
107
108
            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)

109
110
  lint_python_and_config:
    docker:
Wei Wang's avatar
Wei Wang committed
111
      - image: circleci/python:3.8
112
113
114
115
116
117
118
119
120
121
    steps:
      - checkout
      - run:
          name: Install pre-commit
          command: pip install --user --progress-bar off pre-commit
      - run:
          name: Install pre-commit hooks
          command: pre-commit install-hooks
      - run:
          name: Lint Python code and config files
moto's avatar
moto committed
122
          command: pre-commit run --all-files
123
124
      - run:
          name: Required lint modifications
125
          when: always
moto's avatar
moto committed
126
          command: git --no-pager diff --color=always
127

128
  download_third_parties:
129
    docker:
moto's avatar
moto committed
130
      - image: "pytorch/torchaudio_unittest_base:manylinux"
131
132
133
    resource_class: small
    steps:
      - checkout
134
      - generate_cache_key
135
136
137
      - restore_cache:

          keys:
moto's avatar
moto committed
138
            - tp-nix-v2-{{ checksum ".cachekey" }}
139
140

      - run:
moto's avatar
moto committed
141
          command: |
142
143
              mkdir -p third_party/archives/
              wget --no-clobber --directory-prefix=third_party/archives/ $(awk '/URL /{print $2}' third_party/*/CMakeLists.txt)
144
145
      - save_cache:

moto's avatar
moto committed
146
          key: tp-nix-v2-{{ checksum ".cachekey" }}
147
148

          paths:
149
            - third_party/archives
150
151
152
      - persist_to_workspace:
          root: third_party
          paths:
153
            - archives
154

155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
  build_ffmpeg_linux:
    <<: *binary_common
    docker:
      - image: << parameters.wheel_docker_image >>
    resource_class: 2xlarge+
    steps:
      - checkout
      - generate_cache_key
      - restore_cache:

          keys:
            - ffmpeg-linux-v0-{{ checksum ".cachekey" }}

      - run:
          command: |
            export FFMPEG_ROOT=${PWD}/third_party/ffmpeg
            if [[ ! -d ${FFMPEG_ROOT} ]]; then
                packaging/ffmpeg/build.sh
            fi
      - save_cache:

          key: ffmpeg-linux-v0-{{ checksum ".cachekey" }}

          paths:
            - third_party/ffmpeg
      - persist_to_workspace:
          root: third_party
          paths:
            - ffmpeg

  build_ffmpeg_macos:
    <<: *binary_common
    macos:
188
      xcode: "14.0"
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
    steps:
      - checkout
      - generate_cache_key
      - restore_cache:

          keys:
            - ffmpeg-macos-v0-{{ checksum ".cachekey" }}

      - run:
          command: |
            export FFMPEG_ROOT=${PWD}/third_party/ffmpeg
            if [[ ! -d ${FFMPEG_ROOT} ]]; then
                packaging/ffmpeg/build.sh
            fi
      - save_cache:

          key: ffmpeg-macos-v0-{{ checksum ".cachekey" }}

          paths:
            - third_party/ffmpeg
      - persist_to_workspace:
          root: third_party
          paths:
            - ffmpeg

  build_ffmpeg_windows:
    <<: *binary_common
    machine:
      resource_class: windows.xlarge
      image: windows-server-2019-vs2019:stable
      # Note:
      # Unlike other Windows job, this job uses cmd.exe as shell because
      # we need to invoke bash.exe from msys2 in ffmpeg build process, and doing so
      # from different installation of bash.exe (the one from the VM) cause issue
      shell: cmd.exe
    steps:
      - checkout
      - run: date /t > .cachekey
      - restore_cache:

          keys:
            - ffmpeg-windows-{{ checksum ".cachekey" }}

      - run: packaging\ffmpeg\build.bat
      - save_cache:

          key: ffmpeg-windows-{{ checksum ".cachekey" }}

          paths:
            - third_party/ffmpeg
      - persist_to_workspace:
          root: third_party
          paths:
            - ffmpeg

moto's avatar
moto committed
244
  unittest_linux_cpu:
moto's avatar
moto committed
245
246
    <<: *binary_common
    docker:
247
      - image: pytorch/torchaudio_unittest_base:manylinux-20210121
moto's avatar
moto committed
248
249
250
    resource_class: 2xlarge+
    steps:
      - checkout
251
252
      - attach_workspace:
          at: third_party
253
      - designate_upload_channel
Eli Uriegas's avatar
Eli Uriegas committed
254
      - load_conda_channel_flags
255
256
257
258
259
260
      - run:
          name: Setup
          command: .circleci/unittest/linux/scripts/setup_env.sh
      - run:
          name: Install torchaudio
          command: .circleci/unittest/linux/scripts/install.sh
261
          environment:
262
              USE_FFMPEG: true
263
264
265
      - run:
          name: Run tests
          command: .circleci/unittest/linux/scripts/run_test.sh
moto's avatar
moto committed
266
267
          environment:
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA: true
268
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL: true
269
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310: true
270
271
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS: true
272
273
      - store_test_results:
          path: test-results
274
275
      - store_artifacts:
          path: test/htmlcov
Zhaoheng Ni's avatar
Zhaoheng Ni committed
276

moto's avatar
moto committed
277
  unittest_windows_cpu:
278
279
280
281
282
    <<: *binary_common
    executor:
      name: windows-cpu
    steps:
      - checkout
283
      - designate_upload_channel
Eli Uriegas's avatar
Eli Uriegas committed
284
      - load_conda_channel_flags
moto's avatar
moto committed
285
286
      - run:
          name: Setup
287
          command: .circleci/unittest/windows/scripts/setup_env.sh
moto's avatar
moto committed
288
      - run:
289
          name: Install torchaudio
290
          command: .circleci/unittest/windows/scripts/install.sh
291
          environment:
292
              USE_FFMPEG: true
moto's avatar
moto committed
293
      - run:
294
          name: Run tests
295
          command: .circleci/unittest/windows/scripts/run_test.sh
moto's avatar
moto committed
296
297
298
299
300
301
302
303
          environment:
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_SOX: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA: true
304
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL: true
moto's avatar
moto committed
305
306
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX: true
307
308
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_sentencepiece: true
309
310
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS: true
moto's avatar
moto committed
311
312
      - store_test_results:
          path: test-results
313
314
      - store_artifacts:
          path: test/htmlcov
moto's avatar
moto committed
315

316
317
318
319
320
  unittest_windows_gpu:
    <<: *binary_common
    executor:
      name: windows-gpu
    environment:
321
      <<: *environment
322
      CUDA_VERSION: "11.7"
323
324
    steps:
      - checkout
325
      - designate_upload_channel
Eli Uriegas's avatar
Eli Uriegas committed
326
      - load_conda_channel_flags
327
328
329
      - run:
          name: Setup
          command: .circleci/unittest/windows/scripts/setup_env.sh
330
331
332
333
334
335
      - run:
          name: Install CUDA
          command: packaging/windows/internal/cuda_install.bat
      - run:
          name: Update CUDA driver
          command: packaging/windows/internal/driver_update.bat
336
337
338
      - run:
          name: Install torchaudio
          command: .circleci/unittest/windows/scripts/install.sh
339
          environment:
340
              USE_FFMPEG: true
341
342
343
      - run:
          name: Run tests
          command: .circleci/unittest/windows/scripts/run_test.sh
moto's avatar
moto committed
344
345
346
347
348
349
350
351
352
          environment:
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_SOX: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_KALDI: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_SOX: true
353
354
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_sentencepiece: true
355
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_CUDA_SMALL_MEMORY: true
356
357
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MACOS: true
358
359
      - store_test_results:
          path: test-results
360
361
      - store_artifacts:
          path: test/htmlcov
362

moto's avatar
moto committed
363
364
365
  unittest_macos_cpu:
    <<: *binary_common
    macos:
366
      xcode: "14.0"
moto's avatar
moto committed
367
368
369
    resource_class: large
    steps:
      - checkout
Eli Uriegas's avatar
Eli Uriegas committed
370
      - load_conda_channel_flags
moto's avatar
moto committed
371
372
      - attach_workspace:
          at: third_party
373
      - designate_upload_channel
moto's avatar
moto committed
374
375
376
377
378
379
      - run:
          name: Setup
          command: .circleci/unittest/linux/scripts/setup_env.sh
      - run:
          name: Install torchaudio
          command: .circleci/unittest/linux/scripts/install.sh
380
          environment:
381
              USE_FFMPEG: true
moto's avatar
moto committed
382
              USE_OPENMP: false
moto's avatar
moto committed
383
384
385
      - run:
          name: Run tests
          command: .circleci/unittest/linux/scripts/run_test.sh
moto's avatar
moto committed
386
387
388
389
390
391
392
          environment:
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_APPLY_CMVN_SLIDING: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_FBANK_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_KALDI_PITCH_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_MFCC_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CMD_COMPUTE_SPECTROGRAM_FEATS: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_CUDA: true
393
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_HW_ACCEL: true
moto's avatar
moto committed
394
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_QUANTIZATION: true
395
396
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_ON_PYTHON_310: true
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_MOD_sentencepiece: true
397
              TORCHAUDIO_TEST_ALLOW_SKIP_IF_NO_AUDIO_OUT_DEVICE: true
moto's avatar
moto committed
398
399
      - store_test_results:
          path: test-results
400
401
      - store_artifacts:
          path: test/htmlcov
moto's avatar
moto committed
402

403
404
405
406
407
408
409
  stylecheck:
    <<: *binary_common
    docker:
      - image: "pytorch/torchaudio_unittest_base:manylinux"
    resource_class: medium
    steps:
      - checkout
410
      - designate_upload_channel
Eli Uriegas's avatar
Eli Uriegas committed
411
      - load_conda_channel_flags
412
413
414
415
416
417
418
      - run:
          name: Setup
          command: .circleci/unittest/linux/scripts/setup_env.sh
      - run:
          name: Run style check
          command: .circleci/unittest/linux/scripts/run_style_checks.sh

419
workflows:
420
421
422
  lint:
    jobs:
      - lint_python_and_config
moto's avatar
moto committed
423
424
  unittest:
    jobs:
425
      - circleci_consistency
426
427
      - download_third_parties:
          name: download_third_parties
moto's avatar
moto committed
428
      - unittest_linux_cpu:
Nikita Shulga's avatar
Nikita Shulga committed
429
          cuda_version: cpu
Wei Wang's avatar
Wei Wang committed
430
431
          name: unittest_linux_cpu_py3.8
          python_version: '3.8'
432
          requires:
433
          - download_third_parties
434
      - stylecheck:
Nikita Shulga's avatar
Nikita Shulga committed
435
          cuda_version: cpu
Wei Wang's avatar
Wei Wang committed
436
          name: stylecheck_py3.8
moto's avatar
moto committed
437
          python_version: '3.8'
Eli Uriegas's avatar
Eli Uriegas committed
438
      - unittest_linux_cpu:
Nikita Shulga's avatar
Nikita Shulga committed
439
          cuda_version: cpu
Eli Uriegas's avatar
Eli Uriegas committed
440
441
442
          name: unittest_linux_cpu_py3.9
          python_version: '3.9'
          requires:
443
          - download_third_parties
444
445
446
447
448
      - unittest_linux_cpu:
          cuda_version: cpu
          name: unittest_linux_cpu_py3.10
          python_version: '3.10'
          requires:
449
          - download_third_parties
450
451
452
453
454
455
      - unittest_linux_cpu:
          cuda_version: cpu
          name: unittest_linux_cpu_py3.11
          python_version: '3.11'
          requires:
          - download_third_parties
moto's avatar
moto committed
456
      - unittest_windows_cpu:
Nikita Shulga's avatar
Nikita Shulga committed
457
          cuda_version: cpu
Wei Wang's avatar
Wei Wang committed
458
459
          name: unittest_windows_cpu_py3.8
          python_version: '3.8'
460
461
          requires:
          - download_third_parties
462
      - unittest_windows_gpu:
463
          cuda_version: cu118
Wei Wang's avatar
Wei Wang committed
464
465
          name: unittest_windows_gpu_py3.8
          python_version: '3.8'
466
467
          requires:
          - download_third_parties
moto's avatar
moto committed
468
      - unittest_macos_cpu:
Nikita Shulga's avatar
Nikita Shulga committed
469
          cuda_version: cpu
Wei Wang's avatar
Wei Wang committed
470
471
          name: unittest_macos_cpu_py3.8
          python_version: '3.8'
moto's avatar
moto committed
472
          requires:
473
          - download_third_parties