From f5ae915210c6b2d4c6ba0ddc09507991ca0ff5b8 Mon Sep 17 00:00:00 2001 From: Jirka Borovec Date: Mon, 1 Mar 2021 22:10:06 +0100 Subject: [PATCH] CI: add multi-GPU @Azure (#22) * add PL config * badge * prune * PT * cov * . --- README.md | 2 ++ azure-pipelines.yml | 66 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 68 insertions(+) create mode 100644 azure-pipelines.yml diff --git a/README.md b/README.md index af58ac4..3da1efb 100644 --- a/README.md +++ b/README.md @@ -6,6 +6,8 @@ [![CI testing](https://github.com/PyTorchLightning/metrics/workflows/CI%20testing/badge.svg?branch=master&event=push)](https://github.com/PyTorchLightning/torchmetrics/actions?query=workflow%3A%22CI+testing%22) ![Check Code formatting](https://github.com/PyTorchLightning/metrics/workflows/Check%20Code%20formatting/badge.svg?branch=master&event=push) +[![Build Status](https://dev.azure.com/PytorchLightning/Metrics/_apis/build/status/PyTorchLightning.metrics?branchName=master)](https://dev.azure.com/PytorchLightning/Metrics/_build/latest?definitionId=3&branchName=master) +[![codecov](https://codecov.io/gh/PyTorchLightning/metrics/branch/main/graph/badge.svg?token=NER6LPI3HS)](https://codecov.io/gh/PyTorchLightning/metrics) [![Documentation Status](https://readthedocs.org/projects/metrics/badge/?version=latest)](https://metrics.readthedocs.io/en/latest/?badge=latest) ## Installation diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000..7ed9ba6 --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,66 @@ +# 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/* +pr: + - master + - release/* + +jobs: + - job: pytest + # how long to run the job before automatically cancelling + timeoutInMinutes: 25 + # how much time to give 'run always even if cancelled tasks' before stopping them + cancelTimeoutInMinutes: 2 + + pool: gridai-spot-pool + + container: + image: "pytorch/pytorch:1.7.1-cuda11.0-cudnn8-runtime" + options: "--runtime=nvidia -e NVIDIA_VISIBLE_DEVICES=all" + + workspace: + clean: all + + steps: + + - bash: | + lspci | egrep 'VGA|3D' + whereis nvidia + nvidia-smi + python --version + pip --version + pip list + displayName: 'Image info & NVIDIA' + + - bash: | + #sudo apt-get install -y cmake + # python -m pip install "pip==20.1" + pip install --requirement requirements.txt + pip install --requirement ./tests/requirements.txt --upgrade-strategy only-if-needed + pip list + displayName: 'Install dependencies' + + - bash: | + python -c "import torch ; mgpu = torch.cuda.device_count() ; assert mgpu >= 2, f'GPU: {mgpu}'" + displayName: 'Sanity check' + + - bash: | + python -m coverage run --source torchmetrics -m pytest torchmetrics tests -v --durations=50 + displayName: 'Testing' + + - bash: | + python -m coverage report + python -m coverage xml + python -m codecov --token=$(CODECOV_TOKEN) --flags=gpu,pytest --name="GPU-coverage" --env=linux,azure + displayName: 'Statistics'