2022-09-01 22:13:12 +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:
|
|
|
|
include:
|
|
|
|
- '*'
|
|
|
|
branches:
|
|
|
|
include:
|
|
|
|
- "master"
|
|
|
|
- "release/*"
|
|
|
|
- "refs/tags/*"
|
|
|
|
paths:
|
|
|
|
include:
|
|
|
|
- ".azure/gpu-tests-lite.yml"
|
|
|
|
- "requirements/lite/**"
|
|
|
|
- "src/lightning_lite/**"
|
|
|
|
- "tests/tests_lite/**"
|
2022-09-04 18:57:28 +00:00
|
|
|
- "tests/tests_pytorch/run_standalone_tests.sh"
|
|
|
|
- "tests/tests_lite/run_standalone_tests.sh" # a symlink to the one above
|
2022-09-01 22:13:12 +00:00
|
|
|
|
|
|
|
pr:
|
|
|
|
- "master"
|
|
|
|
- "release/*"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
- job: testing
|
|
|
|
# how long to run the job before automatically cancelling
|
|
|
|
timeoutInMinutes: "20"
|
|
|
|
# how much time to give 'run always even if cancelled tasks' before stopping them
|
|
|
|
cancelTimeoutInMinutes: "2"
|
|
|
|
pool: azure-jirka-spot
|
|
|
|
container:
|
|
|
|
image: "pytorchlightning/pytorch_lightning:base-cuda-py3.9-torch1.12-cuda11.6.1"
|
|
|
|
# default shm size is 64m. Increase it to avoid:
|
|
|
|
# 'Error while creating shared memory: unhandled system error, NCCL version 2.7.8'
|
|
|
|
options: "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all --shm-size=512m"
|
|
|
|
workspace:
|
|
|
|
clean: all
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- bash: |
|
|
|
|
lspci | egrep 'VGA|3D'
|
|
|
|
whereis nvidia
|
|
|
|
nvidia-smi
|
|
|
|
which python && which pip
|
|
|
|
python --version
|
|
|
|
pip --version
|
|
|
|
pip list
|
|
|
|
displayName: 'Image info & NVIDIA'
|
|
|
|
|
|
|
|
- bash: |
|
|
|
|
set -e
|
|
|
|
TORCH_VERSION=$(python -c "import torch; print(torch.__version__.split('+')[0])")
|
|
|
|
CUDA_VERSION_MM=$(python -c "import torch ; print(''.join(map(str, torch.version.cuda.split('.')[:2])))")
|
|
|
|
python ./requirements/pytorch/adjust-versions.py requirements/lite/base.txt ${PYTORCH_VERSION}
|
|
|
|
pip install -e .[strategies] --find-links https://download.pytorch.org/whl/cu${CUDA_VERSION_MM}/torch_stable.html
|
|
|
|
pip install --requirement requirements/pytorch/devel.txt --find-links https://download.pytorch.org/whl/cu${CUDA_VERSION_MM}/torch_stable.html
|
|
|
|
pip list
|
|
|
|
env:
|
|
|
|
PACKAGE_NAME: pytorch
|
|
|
|
FREEZE_REQUIREMENTS: 1
|
|
|
|
displayName: 'Install dependencies'
|
|
|
|
|
|
|
|
- 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'
|
|
|
|
|
|
|
|
- bash: python -m coverage run --source lightning_lite -m pytest --ignore benchmarks -v --junitxml=$(Build.StagingDirectory)/test-results.xml --durations=50
|
|
|
|
env:
|
|
|
|
PL_RUN_CUDA_TESTS: "1"
|
|
|
|
workingDirectory: tests/tests_lite
|
|
|
|
displayName: 'Testing: Lite standard'
|
|
|
|
timeoutInMinutes: "10"
|
|
|
|
|
|
|
|
- bash: bash run_standalone_tests.sh
|
|
|
|
workingDirectory: tests/tests_lite
|
|
|
|
env:
|
|
|
|
PL_RUN_CUDA_TESTS: "1"
|
|
|
|
PL_STANDALONE_TESTS_SOURCE: "lightning_lite"
|
|
|
|
displayName: 'Testing: Lite standalone tests'
|
|
|
|
timeoutInMinutes: "10"
|
|
|
|
|
|
|
|
- bash: |
|
|
|
|
python -m coverage report
|
|
|
|
python -m coverage xml
|
|
|
|
python -m coverage html
|
|
|
|
python -m codecov --token=$(CODECOV_TOKEN) --commit=$(Build.SourceVersion) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure
|
|
|
|
ls -l
|
|
|
|
workingDirectory: tests/tests_lite
|
|
|
|
displayName: 'Statistics'
|
|
|
|
|
|
|
|
- task: PublishTestResults@2
|
|
|
|
displayName: 'Publish test results'
|
|
|
|
inputs:
|
|
|
|
testResultsFiles: '$(Build.StagingDirectory)/test-results.xml'
|
|
|
|
testRunTitle: '$(Agent.OS) - $(Build.DefinitionName) - Python $(python.version)'
|
|
|
|
condition: succeededOrFailed()
|