2021-09-10 11:30:44 +00:00
|
|
|
# Python package
|
|
|
|
# Create and test a Python package on multiple Python versions.
|
|
|
|
# Add steps that analyze code, save the dist with the build record, publish to a PyPI-compatible index, and more:
|
|
|
|
# https://docs.microsoft.com/azure/devops/pipelines/languages/python
|
|
|
|
|
|
|
|
trigger:
|
|
|
|
tags:
|
2023-09-25 12:34:41 +00:00
|
|
|
include: ["*"]
|
2021-09-10 11:30:44 +00:00
|
|
|
branches:
|
|
|
|
include:
|
|
|
|
- "master"
|
|
|
|
- "release/*"
|
|
|
|
- "refs/tags/*"
|
|
|
|
|
2022-10-31 19:50:51 +00:00
|
|
|
pr:
|
|
|
|
branches:
|
|
|
|
include:
|
|
|
|
- "master"
|
|
|
|
- "release/*"
|
|
|
|
paths:
|
|
|
|
include:
|
2023-05-25 16:20:43 +00:00
|
|
|
- ".azure/gpu-benchmarks.yml"
|
2023-05-24 23:16:41 +00:00
|
|
|
- "requirements/fabric/**"
|
2022-11-11 16:38:09 +00:00
|
|
|
- "requirements/pytorch/**"
|
2023-05-24 23:16:41 +00:00
|
|
|
- "src/lightning/fabric/**"
|
|
|
|
- "src/lightning/pytorch/**"
|
|
|
|
- "tests/parity_fabric/**"
|
|
|
|
- "tests/parity_pytorch/**"
|
2022-11-22 01:25:01 +00:00
|
|
|
exclude:
|
2022-11-26 01:16:48 +00:00
|
|
|
- "requirements/*/docs.txt"
|
2022-11-22 01:25:01 +00:00
|
|
|
- "*.md"
|
|
|
|
- "**/*.md"
|
2021-09-10 11:30:44 +00:00
|
|
|
|
2021-07-28 16:09:15 +00:00
|
|
|
schedules:
|
|
|
|
- cron: "0 0 * * *" # At the end of every day
|
|
|
|
displayName: Daily midnight benchmark
|
|
|
|
branches:
|
|
|
|
include:
|
|
|
|
- "master"
|
2021-07-20 21:23:53 +00:00
|
|
|
|
|
|
|
jobs:
|
2021-07-28 16:09:15 +00:00
|
|
|
- job: benchmarks
|
|
|
|
timeoutInMinutes: "90"
|
|
|
|
cancelTimeoutInMinutes: "2"
|
2022-10-31 19:50:51 +00:00
|
|
|
pool: lit-rtx-3090
|
|
|
|
variables:
|
|
|
|
DEVICES: $( python -c 'print("$(Agent.Name)".split("_")[-1])' )
|
2021-07-20 21:23:53 +00:00
|
|
|
container:
|
2024-04-29 11:16:13 +00:00
|
|
|
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.11-torch2.3-cuda12.1.0"
|
2022-10-31 19:50:51 +00:00
|
|
|
options: "--gpus=all --shm-size=32g"
|
2023-05-24 23:16:41 +00:00
|
|
|
strategy:
|
|
|
|
matrix:
|
2023-09-25 12:34:41 +00:00
|
|
|
"pkg: Fabric":
|
2023-05-24 23:16:41 +00:00
|
|
|
PACKAGE_NAME: "fabric"
|
2023-09-25 12:34:41 +00:00
|
|
|
"pkg: Pytorch":
|
2023-05-24 23:16:41 +00:00
|
|
|
PACKAGE_NAME: "pytorch"
|
2021-07-20 21:23:53 +00:00
|
|
|
workspace:
|
|
|
|
clean: all
|
|
|
|
|
|
|
|
steps:
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: |
|
|
|
|
echo "##vso[task.setvariable variable=CUDA_VISIBLE_DEVICES]$(DEVICES)"
|
|
|
|
cuda_ver=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
|
|
|
|
echo "##vso[task.setvariable variable=TORCH_URL]https://download.pytorch.org/whl/cu${cuda_ver}/torch_stable.html"
|
|
|
|
displayName: "set env. vars"
|
2022-06-15 00:54:55 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: |
|
|
|
|
echo $CUDA_VISIBLE_DEVICES
|
|
|
|
echo $TORCH_URL
|
|
|
|
whereis nvidia
|
|
|
|
nvidia-smi
|
|
|
|
which python && which pip
|
|
|
|
python --version
|
|
|
|
pip --version
|
|
|
|
pip list
|
|
|
|
displayName: "Image info & NVIDIA"
|
2022-10-31 19:50:51 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: pip install -e .[dev] --find-links ${TORCH_URL}
|
|
|
|
env:
|
|
|
|
FREEZE_REQUIREMENTS: "1"
|
|
|
|
displayName: "Install package"
|
2022-11-12 14:58:37 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: |
|
|
|
|
set -e
|
|
|
|
python requirements/collect_env_details.py
|
|
|
|
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu == 2, f'GPU: {mgpu}'"
|
|
|
|
displayName: "Env details"
|
2022-06-15 00:54:55 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: |
|
|
|
|
pip install -q -r .actions/requirements.txt
|
|
|
|
python .actions/assistant.py copy_replace_imports --source_dir="./tests" \
|
|
|
|
--source_import="lightning.fabric,lightning.pytorch" \
|
|
|
|
--target_import="lightning_fabric,pytorch_lightning"
|
|
|
|
displayName: "Adjust tests"
|
2022-11-12 14:58:37 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: python -m pytest parity_$(PACKAGE_NAME) -v --durations=0
|
|
|
|
env:
|
|
|
|
PL_RUNNING_BENCHMARKS: "1"
|
|
|
|
PL_RUN_CUDA_TESTS: "1"
|
|
|
|
workingDirectory: tests/
|
|
|
|
displayName: "Testing: benchmarks"
|
2023-02-01 20:34:38 +00:00
|
|
|
|
2023-09-25 12:34:41 +00:00
|
|
|
- bash: bash run_standalone_tasks.sh
|
|
|
|
workingDirectory: tests/parity_fabric
|
|
|
|
# without succeeded this could run even if the job has already failed
|
|
|
|
condition: and(succeeded(), eq(variables['PACKAGE_NAME'], 'fabric'))
|
|
|
|
env:
|
|
|
|
PL_RUN_CUDA_TESTS: "1"
|
|
|
|
displayName: "Testing: fabric standalone tasks"
|
|
|
|
timeoutInMinutes: "10"
|