2021-02-10 09:43:26 +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 :
2021-02-18 21:41:16 +00:00
tags :
include :
- '*'
2021-02-10 09:43:26 +00:00
branches :
include :
2021-07-28 16:09:15 +00:00
- "master"
- "release/*"
- "refs/tags/*"
2021-02-10 09:43:26 +00:00
pr :
2021-07-28 16:09:15 +00:00
- "master"
- "release/*"
2021-02-10 09:43:26 +00:00
2021-02-10 20:21:20 +00:00
jobs :
2022-06-15 22:10:49 +00:00
- job : testing
2022-05-14 01:59:03 +00:00
strategy :
matrix :
'PyTorch - stable' :
image : "pytorchlightning/pytorch_lightning:base-cuda-py3.9-torch1.11"
2021-02-10 20:21:20 +00:00
# how long to run the job before automatically cancelling
2022-05-20 01:43:45 +00:00
timeoutInMinutes : "100"
2021-02-10 20:21:20 +00:00
# how much time to give 'run always even if cancelled tasks' before stopping them
2021-07-28 16:09:15 +00:00
cancelTimeoutInMinutes : "2"
2022-06-14 17:11:54 +00:00
pool : azure-jirka-spot
2021-02-10 20:21:20 +00:00
container :
2022-05-14 01:59:03 +00:00
image : $(image)
2021-06-24 16:56:43 +00:00
# default shm size is 64m. Increase it to avoid:
# 'Error while creating shared memory: unhandled system error, NCCL version 2.7.8'
2021-07-19 07:41:18 +00:00
options : "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --shm-size=512m"
2021-02-10 20:21:20 +00:00
workspace :
clean : all
2021-02-10 09:43:26 +00:00
2021-02-10 20:21:20 +00:00
steps :
2021-02-10 09:43:26 +00:00
2021-02-10 20:21:20 +00:00
- bash : |
lspci | egrep 'VGA|3D'
whereis nvidia
nvidia-smi
2022-02-16 20:15:44 +00:00
which python && which pip
2021-02-10 20:21:20 +00:00
python --version
pip --version
pip list
displayName : 'Image info & NVIDIA'
2021-02-10 09:43:26 +00:00
2021-02-10 20:21:20 +00:00
- bash : |
2022-06-21 15:11:33 +00:00
python -c "fname = 'requirements/pytorch/strategies.txt' ; lines = [line for line in open(fname).readlines() if 'horovod' not in line] ; open(fname, 'w').writelines(lines)"
2022-04-11 15:29:54 +00:00
CUDA_VERSION_MM=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
2022-05-09 13:25:53 +00:00
pip install "bagua-cuda$CUDA_VERSION_MM>=0.9.0"
2022-06-15 00:54:55 +00:00
pip install -e .[strategies]
2022-06-21 15:11:33 +00:00
pip install --requirement requirements/pytorch/devel.txt
2021-02-10 20:21:20 +00:00
pip list
2022-06-27 13:34:18 +00:00
env :
PACKAGE_NAME : pytorch
2022-06-29 13:35:57 +00:00
FREEZE_REQUIREMENTS : 1
2021-02-10 20:21:20 +00:00
displayName : 'Install dependencies'
2021-02-10 09:43:26 +00:00
2021-02-19 21:45:53 +00:00
- bash : |
2022-03-11 09:20:47 +00:00
set -e
2021-07-19 11:26:09 +00:00
python requirements/collect_env_details.py
2021-02-19 21:45:53 +00:00
python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'"
2022-06-21 15:11:33 +00:00
python requirements/pytorch/check-avail-strategies.py
python requirements/pytorch/check-avail-extras.py
2021-02-10 20:21:20 +00:00
displayName : 'Env details'
2021-02-10 09:43:26 +00:00
2022-06-02 13:39:14 +00:00
- bash : bash .actions/pull_legacy_checkpoints.sh
2021-02-10 20:21:20 +00:00
displayName : 'Get legacy checkpoints'
2021-02-10 09:43:26 +00:00
2022-06-15 22:10:49 +00:00
- bash : python -m coverage run --source pytorch_lightning -m pytest
workingDirectory : src/pytorch_lightning
displayName: 'Testing : PyTorch doctests'
2021-02-10 20:21:20 +00:00
2022-06-15 22:10:49 +00:00
- bash : python -m coverage run --source pytorch_lightning -m pytest --ignore benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
displayName: 'Testing : PyTorch standard'
workingDirectory : tests/tests_pytorch
2022-06-15 00:54:55 +00:00
2022-06-15 22:10:49 +00:00
- bash : bash run_standalone_tests.sh
workingDirectory : tests/tests_pytorch
2021-07-19 07:41:18 +00:00
env :
PL_USE_MOCKED_MNIST : "1"
2022-06-15 22:10:49 +00:00
displayName: 'Testing : PyTorch standalone tests'
2021-02-10 20:21:20 +00:00
- bash : |
python -m coverage report
python -m coverage xml
2021-03-15 14:38:40 +00:00
python -m coverage html
python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
ls -l
2022-06-15 22:10:49 +00:00
workingDirectory : tests/tests_pytorch
2021-02-10 20:21:20 +00:00
displayName : 'Statistics'
2021-03-15 14:38:40 +00:00
- task : PublishTestResults@2
displayName : 'Publish test results'
inputs :
testResultsFiles : '$(Build.StagingDirectory)/test-results.xml'
testRunTitle : '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
condition : succeededOrFailed()
2021-03-20 18:58:59 +00:00
- script : |
set -e
2022-06-15 12:53:51 +00:00
bash run_ddp_examples.sh
bash run_pl_examples.sh --trainer.accelerator=gpu --trainer.devices=1
bash run_pl_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp
bash run_pl_examples.sh --trainer.accelerator=gpu --trainer.devices=2 --trainer.strategy=ddp --trainer.precision=16
workingDirectory : examples
2021-03-22 16:49:01 +00:00
env :
PL_USE_MOCKED_MNIST : "1"
2022-06-15 22:10:49 +00:00
displayName: 'Testing : PyTorch examples'
2021-07-19 07:41:18 +00:00
2022-06-15 22:10:49 +00:00
- bash : python -m pytest benchmarks -v --maxfail=2 --durations=0
workingDirectory : tests/tests_pytorch
displayName: 'Testing : PyTorch benchmarks'