config.yml 19.7 KB
Newer Older
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
1
2
3
4
5
# Python CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-python/ for more details
#
# Adopted from
6
# https://github.com/facebookresearch/detectron2/blob/main/.circleci/config.yml
7
8
#
# Pro tip: download circle ci cli to validate the config locally during development.
9
10
#
# To reset/clean the cache update the CACHE_VERSION variable in project settings
Min Xu's avatar
Min Xu committed
11
# in the fairscale project in CircleCI's web UI. The CACHE_VERSION follows the convention
12
13
14
15
16
# v$(FAIRSCALE_VERSION)-${CACHE_NUMBER}. E.g. v0.4.2-1. CACHE_NUMBER must start
# at 1 and increase in whole numbers. When changing the CACHE_VERSION manually
# always set the FAIRSCALE_VERSION value to the fairscale version being tested.
# To reset the cache when not updating the fairscale version, only update the
# CACHE_NUMBER value.
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
17

Min Xu's avatar
Min Xu committed
18
version: 2.1
19
20
orbs:
  codecov: codecov/codecov@1.0.2
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
21
22
23
# -------------------------------------------------------------------------------------
# Environments to run the jobs in
# -------------------------------------------------------------------------------------
24
25
26
cpu_py38: &cpu_py38
  docker:
    - image: circleci/python:3.8
27
  resource_class: large
28
29
30
31

cpu_py39: &cpu_py39
  docker:
    - image: circleci/python:3.9
32
  resource_class: large
33

Min Xu's avatar
Min Xu committed
34
35
36
37
38
cpu_py310: &cpu_py310
  docker:
    - image: circleci/python:3.10
  resource_class: large

39
# Here is the list of GPU images:
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
40
# https://circleci.com/docs/2.0/configuration-reference/#available-linux-gpu-images
41
42
# We need to use multiple gpus for several jobs. The resource_class
# values are available here T101565170
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
43
44
45
46
# gpu.nvidia.small.multi = 2 gpus with 16 GB ram each
# gpu.nvidia.medium.multi = 4 gpus with 16 GB ram each

gpu_cu_11_2_small_multi: &gpu_cu_11_2_small_multi
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
47
  environment:
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
48
49
    CUDA_VERSION: "11.2"
    CUDA_HOME: /usr/local/cuda-11.2
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
50
  machine:
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
51
52
    image: ubuntu-2004-cuda-11.2:202103-01
  resource_class: gpu.nvidia.small.multi
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
53

Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
54
gpu_cu_11_2_medium_multi: &gpu_cu_11_2_medium_multi
55
  environment:
56
57
    CUDA_VERSION: "11.2"
    CUDA_HOME: /usr/local/cuda-11.2
58
  machine:
59
    image: ubuntu-2004-cuda-11.2:202103-01
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
60
  resource_class: gpu.nvidia.medium.multi
61

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
62
63
64
65
66
67
68
# -------------------------------------------------------------------------------------
# Re-usable commands
# -------------------------------------------------------------------------------------
setup_venv: &setup_venv
  - run:
      name: Setup Virtual Env
      working_directory: ~/
69
70
      # use bash -x for debug early commands executed in .bashrc.
      shell: /bin/bash
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
71
      command: |
72
73
        set -e
        set -o pipefail
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
74
75
76
77
78
79
80
81
        python -m venv ~/venv
        echo ". ~/venv/bin/activate" >> $BASH_ENV
        . ~/venv/bin/activate
        python --version
        which python
        which pip
        pip install --upgrade pip

Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
82
# most recent LTS version
83
install_dep_pytorch_lts: &install_dep_pytorch_lts
84
  - run:
85
      name: Install Dependencies with torch 1.8.2 (LTS)
86
      command: |
87
        # check if we have restored venv cache (/home/circleci/venv) correctly, if so, just skip
Min Xu's avatar
Min Xu committed
88
        if [ -f /home/circleci/venv/check_version.py ]; then python /home/circleci/venv/check_version.py torch eq 1.8 && exit 0; fi
89
        # start installing
90
        pip install --progress-bar off torch==1.8.2+cu111 torchvision==0.9.2+cu111 --extra-index-url https://download.pytorch.org/whl/lts/1.8/cu111
91
        pip install --progress-bar off -r requirements-dev.txt
92
        pip install --progress-bar off -r requirements-benchmarks.txt
93
        python -c 'import torch; print("Torch version:", torch.__version__)'
94
        python -c 'import torch; assert torch.__version__.split(".")[:2] == ["1", "8"], f"wrong torch version {torch.__version__}"'
95
        python -m torch.utils.collect_env
Min Xu's avatar
Min Xu committed
96
        wget -O /home/circleci/venv/check_version.py https://raw.githubusercontent.com/min-xu-ai/check_verion/main/check_version.py
97

Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
98
# most recent stable version
99
install_dep_pytorch_stable: &install_dep_pytorch_stable
100
  - run:
101
      name: Install Dependencies with torch 1.12.0
102
103
      command: |
        # check if we have restored venv cache (/home/circleci/venv) correctly, if so, just skip
Min Xu's avatar
Min Xu committed
104
        if [ -f /home/circleci/venv/check_version.py ]; then python /home/circleci/venv/check_version.py torch eq 1.11 && exit 0; fi
105
        # start installing
106
        pip install --progress-bar off torch==1.12.0+cu113 torchvision==0.13.0+cu113 --extra-index-url https://download.pytorch.org/whl/cu113
107
        pip install --progress-bar off -r requirements-dev.txt
108
109
        pip install --progress-bar off -r requirements-benchmarks.txt
        python -c 'import torch; print("Torch version:", torch.__version__)'
110
        python -c 'import torch; assert torch.__version__.split(".")[:2] == ["1", "12"], f"wrong torch version {torch.__version__}"'
111
112
113
        python -m torch.utils.collect_env
        wget -O /home/circleci/venv/check_version.py https://raw.githubusercontent.com/min-xu-ai/check_verion/main/check_version.py

114
115
116
117
118
install_dep_pytorch_nightly: &install_dep_pytorch_nightly
  - run:
      name: Install Dependencies with a torch nightly preview build
      command: |
        # check if we have restored venv cache (/home/circleci/venv) correctly, if so, just skip
119
        if [ -f /home/circleci/venv/check_version.py ]; then python /home/circleci/venv/check_version.py torch eq 1.12 && exit 0; fi
120
        # start installing
121
        pip install --pre torch==1.13.0.dev20220625+cu113 torchvision==0.14.0.dev20220625+cu113 --extra-index-url https://download.pytorch.org/whl/nightly/cu113
122
        pip install --progress-bar off -r requirements-dev.txt
123
124
        pip install --progress-bar off -r requirements-benchmarks.txt
        python -c 'import torch; print("Torch version:", torch.__version__)'
125
        python -c 'import torch; assert torch.__version__.split(".")[:2] == ["1", "13"], f"wrong torch version {torch.__version__}"'
126
127
128
        python -m torch.utils.collect_env
        wget -O /home/circleci/venv/check_version.py https://raw.githubusercontent.com/min-xu-ai/check_verion/main/check_version.py

129
install_repo: &install_repo
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
130
131
132
  - run:
      name: Install Repository
      command: |
133
134
135
        pip install .
        # Test import.
        python -c 'import sys; sys.path = sys.path[1:]; import fairscale'
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
136

137
138
139
140
141
142
check_test_list: &check_test_list
  - run:
      name: Verify that unit test list files are correct
      command: |
        bash ./tests/ci_test_list_check.sh

143
144
145
146
upload_coverage: &upload_coverage
  - codecov/upload:
      file: 'coverage.xml'
      token: $CODECOV_TOKEN
msbaines's avatar
msbaines committed
147

148
149
150
151
run_offload_benchmark: &run_offload_benchmark
  - run:
      name: Run Offload Benchmark
      command: |
Crutcher Dunnavant's avatar
Crutcher Dunnavant committed
152
        PYTHONPATH=. python benchmarks/experimental/offload.py --checkpoint_activation
153

154
155
156
157
run_fsdp_benchmark: &run_fsdp_benchmark
  - run:
      name: Run FSDP Benchmark
      command: |
Crutcher Dunnavant's avatar
Crutcher Dunnavant committed
158
        PYTHONPATH=. python benchmarks/fsdp.py --use_synthetic_data
159

Jun Ru Anderson's avatar
Jun Ru Anderson committed
160
run_pipe_benchmark: &run_pipe_benchmark
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
161
  - run:
Jun Ru Anderson's avatar
Jun Ru Anderson committed
162
      name: Run Pipe Benchmark
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
163
      command: |
Crutcher Dunnavant's avatar
Crutcher Dunnavant committed
164
        PYTHONPATH=. python benchmarks/pipe.py
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
165

166
167
168
169
run_oss_benchmark: &run_oss_benchmark
  - run:
      name: Run OSS Benchmark
      command: |
Crutcher Dunnavant's avatar
Crutcher Dunnavant committed
170
171
        PYTHONPATH=. python benchmarks/oss.py --world_size 4 --epochs 2
        PYTHONPATH=. python benchmarks/oss.py --check_regression --world_size 4 --optim_type oss_sharded_ddp --epochs 12
172
173

run_oss_gloo: &run_oss_gloo
174
175
176
  - run:
      name: Run OSS with Gloo
      command: |
Crutcher Dunnavant's avatar
Crutcher Dunnavant committed
177
178
        PYTHONPATH=. python benchmarks/oss.py --gloo --optim_type oss_ddp --epochs 2
        PYTHONPATH=. python benchmarks/oss.py --gloo --optim_type oss_sharded_ddp --epochs 2
179

180
run_oss_amp: &run_oss_amp
181
182
183
   - run:
       name: Run OSS with Torch AMP
       command: |
Crutcher Dunnavant's avatar
Crutcher Dunnavant committed
184
         PYTHONPATH=. python benchmarks/oss.py --amp --epochs 3 --optim_type oss_sharded_ddp
185

186
187
188
189
run_oss_for_each: &run_oss_for_each
   - run:
       name: Run OSS with Torch AMP and ForEach optmizer
       command: |
Crutcher Dunnavant's avatar
Crutcher Dunnavant committed
190
         PYTHONPATH=. python benchmarks/oss.py --amp --epochs 3 --optim_type oss_sharded_ddp --multi_tensor_optim
191

192
193
194
195
196
197
198
199
200
run_doc_build: &run_doc_build
   - run:
       name: Testing doc build
       command: |
         cd docs
         pip install --progress-bar off -r requirements.txt
         make help
         make singlehtml | tee make.out
         ! tail make.out | grep -q warning
201

202
203
204
205
206
207
# This is an alias to run all unit tests possible on a platform.
run_unittests: &run_unittests
   - run:
       name: Run all unit tests.
       # We run all and not stopping on failure on CPU since docker time is cheaper.
       command: |
208
         ulimit -n 10000
209
         pytest --junitxml=test-results/junit.xml --verbose --timeout 60 --cov-report=xml --cov=./
210

Min Xu's avatar
Min Xu committed
211
commands:
212
213
214
215

   # This is a command (like a function) that run tests from a given test_list_file.
   # If test_list_file is not given, this results in an error.
   run_unittests_from_list:
Min Xu's avatar
Min Xu committed
216
     parameters:
217
       test_list_file:
Min Xu's avatar
Min Xu committed
218
         type: string
219
         default: "/dev/non_exist"  # Default to error out
Min Xu's avatar
Min Xu committed
220
221
222
223
     steps:
       - run:
           name: Run Unit Tests
           command: |
224
             ulimit -n 10000
225
             if [ ! -f <<parameters.test_list_file>> ]; then exit 1; fi
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
226
             pytest --junitxml=test-results/junit.xml --verbose --timeout 70 --cov-report=xml --cov=./ `cat <<parameters.test_list_file>>`
Min Xu's avatar
Min Xu committed
227

228
229
230
231
232
   setup_pyenv:
     parameters:
       version:
         type: string
     steps:
233
234
235
236
237
       # Cache the pyenv download directory to avoid re-downloading over and over.
       - restore_cache:
          keys:
             - cache-key-pyenv-3-9-7-v1

238
239
       - run:
           name: Setup pyenv
240
241
242
243
244
           # We used to use the following commands to update pyenv.
           #   git clone https://github.com/pyenv/pyenv-update.git $(pyenv root)/plugins/pyenv-update
           #   pyenv update
           # However, it is not deterministic since pyenv is being updated.
           # It is now fixed to a version. (v2.3.0 is broken since it cause bash to fail when it try to do "eval $(pyenv init -)")
245
246
247
248
           #
           # We use "-sf" to skip already installed version after cache restoring the pyenv dir. This should avoid redoing
           # downloading and installing. The key name has a "v1" in the end so that we can debug and try different cache objects
           # while doing development.
249
           command: |
250
251
252
             cd /opt/circleci/.pyenv/
             git remote update
             git checkout v2.2.0
253
             pyenv install -sf <<parameters.version>>
254
255
             pyenv global <<parameters.version>>

256
257
258
259
260
       - save_cache:
          paths:
             - /opt/circleci/.pyenv
          key: cache-key-pyenv-3-9-7-v1

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
261
262
263
264
265
# -------------------------------------------------------------------------------------
# Jobs to run
# -------------------------------------------------------------------------------------

jobs:
Min Xu's avatar
Min Xu committed
266
267
  cpu_tests_py38:
    <<: *cpu_py38
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
268
269
270
271
272

    working_directory: ~/fairscale

    steps:
      - checkout
273
      - <<: *check_test_list
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
274
275
      - <<: *setup_venv

276
277
278
279
      # Do this first to test repo dependencies. Basic import should work after this
      # installation. See issue #1042 for an example.
      - <<: *install_repo

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
280
281
282
      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
283
            - cache-key-cpu-py38-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
284
      - <<: *install_dep_pytorch_stable
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
285
286
287
288

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
289
          key: cache-key-cpu-py38-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
290

291
      - <<: *run_unittests
292
293
294
295
      - <<: *run_doc_build

      - store_test_results:
          path: test-results
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
296

Min Xu's avatar
Min Xu committed
297
298
  cpu_tests_py39:
    <<: *cpu_py39
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
299

300
    working_directory: ~/fairscale
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
301

302
303
    steps:
      - checkout
304
      - <<: *check_test_list
305
      - <<: *setup_venv
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
306

307
308
309
310
      # Do this first to test repo dependencies. Basic import should work after this
      # installation. See issue #1042 for an example.
      - <<: *install_repo

311
312
313
      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
314
315
            - cache-key-cpu-py39-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}

316
      - <<: *install_dep_pytorch_stable
317
318
319
320

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
321
          key: cache-key-cpu-py39-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
322

323
      - <<: *run_unittests
324
      - <<: *run_doc_build
325

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
326
327
328
      - store_test_results:
          path: test-results

Min Xu's avatar
Min Xu committed
329
330
  cpu_tests_py310:
    <<: *cpu_py310
331
332
333
334
335

    working_directory: ~/fairscale

    steps:
      - checkout
336
      - <<: *check_test_list
337
338
      - <<: *setup_venv

339
340
341
342
      # Do this first to test repo dependencies. Basic import should work after this
      # installation. See issue #1042 for an example.
      - <<: *install_repo

343
344
345
      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
346
            - cache-key-cpu-py310-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
347

348
      - <<: *install_dep_pytorch_stable
349
350
351
352

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
353
          key: cache-key-cpu-py310-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
354

355
      - <<: *run_unittests
356
357
358
359
360
      - <<: *run_doc_build

      - store_test_results:
          path: test-results

Min Xu's avatar
Min Xu committed
361
  gpu_tests_lts:
Min Xu's avatar
Min Xu committed
362
    parameters:
363
      test_list_file:
Min Xu's avatar
Min Xu committed
364
        type: string
365
        default: "/dev/non_exist"
Min Xu's avatar
Min Xu committed
366

Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
367
    <<: *gpu_cu_11_2_small_multi
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
368
369
370
371
372
373
374
375

    working_directory: ~/fairscale

    steps:
      - checkout

      - run: nvidia-smi

376
      # Run this to make sure we use python3 from the system.
377
      - setup_pyenv:
378
          version: 3.9.7
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
379
380
381
382
383
384

      - <<: *setup_venv

      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
385
            - cache-key-py-3-9-7-gpu-torch-1-8-2-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
386

387
      - <<: *install_dep_pytorch_lts
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
388
389
390
391

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
392
          key: cache-key-py-3-9-7-gpu-torch-1-8-2-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
393

394
      - <<: *install_repo
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
395

396
397
      - run_unittests_from_list:
          test_list_file: <<parameters.test_list_file>>
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
398
399
400

      - store_test_results:
          path: test-results
401

402
      - <<: *upload_coverage
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
403

Min Xu's avatar
Min Xu committed
404
  gpu_tests_stable:
Min Xu's avatar
Min Xu committed
405
    parameters:
406
      test_list_file:
Min Xu's avatar
Min Xu committed
407
        type: string
408
        default: "/dev/non_exist"
Min Xu's avatar
Min Xu committed
409

Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
410
    <<: *gpu_cu_11_2_small_multi
411
412
413
414
415
416
417
418

    working_directory: ~/fairscale

    steps:
      - checkout

      - run: nvidia-smi

419
      # Run this to make sure we use python3 from the system.
420
      - setup_pyenv:
421
          version: 3.9.7
422
423
424
425
426
427

      - <<: *setup_venv

      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
428
            - cache-key-py-3-9-7-gpu-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
429

430
      - <<: *install_dep_pytorch_stable
431
432
433
434

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
435
          key: cache-key-py-3-9-7-gpu-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
436

437
      - <<: *install_repo
438

439
440
      - run_unittests_from_list:
          test_list_file: <<parameters.test_list_file>>
441
442
443

      - store_test_results:
          path: test-results
444

445
  gpu_tests_pytorch_nightly:
446
447
448
449
450
    parameters:
      test_list_file:
        type: string
        default: "/dev/non_exist"

Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
451
    <<: *gpu_cu_11_2_medium_multi
452
453
454
455
456
457
458
459
460

    working_directory: ~/fairscale

    steps:
      - checkout

      - run: nvidia-smi

      # Run this to make sure we use python3 from the system.
461
      - setup_pyenv:
462
          version: 3.9.7
463
464
465
466
467
468

      - <<: *setup_venv

      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
469
            - cache-key-py-3-9-7-gpu-torch-1-12-0424-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
470

471
      - <<: *install_dep_pytorch_nightly
472
473
474
475

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
476
          key: cache-key-py-3-9-7-gpu-torch-1-12-0424-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
477
478
479
480
481
482
483
484
485

      - <<: *install_repo

      - run_unittests_from_list:
          test_list_file: <<parameters.test_list_file>>

      - store_test_results:
          path: test-results

486
  benchmarks_1:
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
487
    <<: *gpu_cu_11_2_small_multi
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
488
489
490
491
492
493
494
495

    working_directory: ~/fairscale

    steps:
      - checkout

      - run: nvidia-smi

496
      - setup_pyenv:
497
          version: 3.9.7
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
498
499
500
501
502
503

      - <<: *setup_venv

      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
504
            - cache-key-py-3-9-7-benchmarks-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
505

506
507
508
      # Cache the MNIST directory that contains benchmark data
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
509
            - cache-key-benchmark-MNIST-{{.Environment.CACHE_VERSION}}-{{checksum "benchmarks/datasets/mnist.py"}}
510

511
      - <<: *install_dep_pytorch_stable
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
512
513
514
515

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
516
          key: cache-key-py-3-9-7-benchmarks-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
517

518
      - <<: *install_repo
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
519

Jun Ru Anderson's avatar
Jun Ru Anderson committed
520
      - <<: *run_pipe_benchmark
Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
521

522
523
      - <<: *run_offload_benchmark

524
525
526
      - <<: *run_oss_amp

      - <<: *run_oss_for_each
527

528
529
      - <<: *run_oss_gloo

530
531
      - <<: *run_fsdp_benchmark

532
533
534
      - save_cache:
          paths:
            - /tmp/MNIST
Min Xu's avatar
Min Xu committed
535
          key: cache-key-benchmark-MNIST-{{.Environment.CACHE_VERSION}}-{{checksum "benchmarks/datasets/mnist.py"}}
536

537
  benchmarks_2:
Anupam Bhatnagar's avatar
Anupam Bhatnagar committed
538
    <<: *gpu_cu_11_2_medium_multi
539
540
541
542
543
544
545
546

    working_directory: ~/fairscale

    steps:
      - checkout

      - run: nvidia-smi

547
      - setup_pyenv:
548
          version: 3.9.7
549
550
551

      - <<: *setup_venv

552
553
554
555
556
      # Do this first to test an issue like #1042. We keep benchmark_1 doing it
      # after requirements-dev.txt, but change benchmark_2 to do this earlier to
      # ensure both cases are tested.
      - <<: *install_repo

557
558
559
      # Cache the venv directory that contains dependencies
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
560
            - cache-key-py-3-9-7-benchmarks-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
561

562
563
564
565

      # Cache the MNIST directory that contains benchmark data
      - restore_cache:
          keys:
Min Xu's avatar
Min Xu committed
566
            - cache-key-benchmark-MNIST-{{.Environment.CACHE_VERSION}}-{{checksum "benchmarks/datasets/mnist.py"}}
567

568
      - <<: *install_dep_pytorch_stable
569
570
571
572

      - save_cache:
          paths:
            - ~/venv
Min Xu's avatar
Min Xu committed
573
          key: cache-key-py-3-9-7-benchmarks-torch-1-11-0-{{.Environment.CACHE_VERSION}}-{{checksum "setup.py"}}-{{checksum "requirements-dev.txt"}}
574
575

      - <<: *run_oss_benchmark
576

577
578
579
      - save_cache:
          paths:
            - /tmp/MNIST
580
          key: cache-key-benchmark-MNIST-{{.Environment.CACHE_VERSION}}-{{checksum "benchmarks/datasets/mnist.py"}}
581

Mandeep Singh Baines's avatar
Mandeep Singh Baines committed
582
583
584
585
586

workflows:
  version: 2
  build:
    jobs:
587
588
      - cpu_tests_py38
      - cpu_tests_py39
Min Xu's avatar
Min Xu committed
589
590
      - cpu_tests_py310
      - gpu_tests_lts:
591
          test_list_file: tests/ci_test_list_1.txt
Min Xu's avatar
Min Xu committed
592
      - gpu_tests_stable:
593
          test_list_file: tests/ci_test_list_1.txt
594
595
      - gpu_tests_pytorch_nightly:
          test_list_file: tests/ci_test_list_1.txt
Min Xu's avatar
Min Xu committed
596
      - gpu_tests_lts:
597
          test_list_file: tests/ci_test_list_2.txt
Min Xu's avatar
Min Xu committed
598
      - gpu_tests_stable:
599
          test_list_file: tests/ci_test_list_2.txt
600
601
      - gpu_tests_pytorch_nightly:
          test_list_file: tests/ci_test_list_2.txt
Min Xu's avatar
Min Xu committed
602
      - gpu_tests_lts:
603
          test_list_file: tests/ci_test_list_3.txt
Min Xu's avatar
Min Xu committed
604
      - gpu_tests_stable:
605
          test_list_file: tests/ci_test_list_3.txt
606
607
      - gpu_tests_pytorch_nightly:
          test_list_file: tests/ci_test_list_3.txt
608
609
      - benchmarks_1
      - benchmarks_2