pytorch-lightning
111 строк · 3.4 Кб
1# Python package
2# Create and test a Python package on multiple Python versions.
3# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
4# https://docs.microsoft.com/azure/devops/pipelines/languages/python
5
6trigger:
7tags:
8include: ["*"]
9branches:
10include:
11- "master"
12- "release/*"
13- "refs/tags/*"
14
15pr:
16branches:
17include:
18- "master"
19- "release/*"
20paths:
21include:
22- ".azure/gpu-benchmarks.yml"
23- "requirements/fabric/**"
24- "requirements/pytorch/**"
25- "src/lightning/fabric/**"
26- "src/lightning/pytorch/**"
27- "tests/parity_fabric/**"
28- "tests/parity_pytorch/**"
29exclude:
30- "requirements/*/docs.txt"
31- "*.md"
32- "**/*.md"
33
34schedules:
35- cron: "0 0 * * *" # At the end of every day
36displayName: Daily midnight benchmark
37branches:
38include:
39- "master"
40
41jobs:
42- job: benchmarks
43timeoutInMinutes: "90"
44cancelTimeoutInMinutes: "2"
45pool: lit-rtx-3090
46variables:
47DEVICES: $( python -c 'print("$(Agent.Name)".split("_")[-1])' )
48container:
49# TODO: Upgrade to Python 3.11
50image: "pytorchlightning/pytorch_lightning:base-cuda-py3.10-torch2.2-cuda12.1.0"
51options: "--gpus=all --shm-size=32g"
52strategy:
53matrix:
54"pkg: Fabric":
55PACKAGE_NAME: "fabric"
56"pkg: Pytorch":
57PACKAGE_NAME: "pytorch"
58workspace:
59clean: all
60
61steps:
62- bash: |
63echo "##vso[task.setvariable variable=CUDA_VISIBLE_DEVICES]$(DEVICES)"
64cuda_ver=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
65echo "##vso[task.setvariable variable=TORCH_URL]https://download.pytorch.org/whl/cu${cuda_ver}/torch_stable.html"
66displayName: "set env. vars"
67
68- bash: |
69echo $CUDA_VISIBLE_DEVICES
70echo $TORCH_URL
71whereis nvidia
72nvidia-smi
73which python && which pip
74python --version
75pip --version
76pip list
77displayName: "Image info & NVIDIA"
78
79- bash: pip install -e .[dev] --find-links ${TORCH_URL}
80env:
81FREEZE_REQUIREMENTS: "1"
82displayName: "Install package"
83
84- bash: |
85set -e
86python requirements/collect_env_details.py
87python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu == 2, f'GPU: {mgpu}'"
88displayName: "Env details"
89
90- bash: |
91pip install -q -r .actions/requirements.txt
92python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
93--source_import="lightning.fabric,lightning.pytorch" \
94--target_import="lightning_fabric,pytorch_lightning"
95displayName: "Adjust tests"
96
97- bash: python -m pytest parity_$(PACKAGE_NAME) -v --durations=0
98env:
99PL_RUNNING_BENCHMARKS: "1"
100PL_RUN_CUDA_TESTS: "1"
101workingDirectory: tests/
102displayName: "Testing: benchmarks"
103
104- bash: bash run_standalone_tasks.sh
105workingDirectory: tests/parity_fabric
106# without succeeded this could run even if the job has already failed
107condition: and(succeeded(), eq(variables['PACKAGE_NAME'], 'fabric'))
108env:
109PL_RUN_CUDA_TESTS: "1"
110displayName: "Testing: fabric standalone tasks"
111timeoutInMinutes: "10"
112