Skip to content

Commit

Permalink
Merge pull request #180 from Project-MONAI/dev
Browse files Browse the repository at this point in the history
merge master
  • Loading branch information
Nic-Ma authored Jul 22, 2021
2 parents cd16a13 + 027947b commit 6f87afd
Show file tree
Hide file tree
Showing 542 changed files with 42,189 additions and 6,483 deletions.
4 changes: 3 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,10 @@ __pycache__/
docs/

.coverage
.coverage.*
.coverage/
coverage.xml
.readthedocs.yml
*.md
*.toml

!README.md
Expand Down
4 changes: 2 additions & 2 deletions .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ A few sentences describing the changes proposed in this pull request.
- [x] Non-breaking change (fix or new feature that would not break existing functionality).
- [ ] Breaking change (fix or new feature that would cause existing functionality to change).
- [ ] New tests added to cover the changes.
- [ ] Integration tests passed locally by running `./runtests.sh --codeformat --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick`.
- [ ] Integration tests passed locally by running `./runtests.sh -f -u --net --coverage`.
- [ ] Quick tests passed locally by running `./runtests.sh --quick --unittests`.
- [ ] In-line docstrings updated.
- [ ] Documentation updated, tested `make html` command in the `docs/` folder.
103 changes: 103 additions & 0 deletions .github/workflows/blossom-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
# A workflow to trigger ci on hybrid infra (github + self hosted runner)
name: Blossom-CI
on:
issue_comment:
types: [created]
workflow_dispatch:
inputs:
platform:
description: 'runs-on argument'
required: false
args:
description: 'argument'
required: false

permissions:
actions: write
checks: write
contents: write
issues: write
pull-requests: write
repository-projects: write
statuses: write

jobs:
Authorization:
name: Authorization
runs-on: blossom
outputs:
args: ${{ env.args }}

# This job only runs for pull request comments
if: |
contains( 'madil90,Nic-Ma,wyli,', format('{0},', github.actor)) &&
github.event.comment.body == '/build'
steps:
- name: Check if comment is issued by authorized person
run: blossom-ci
env:
OPERATION: 'AUTH'
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_KEY_DATA: ${{ secrets.BLOSSOM_KEY }}

Vulnerability-scan:
name: Vulnerability scan
needs: [Authorization]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
repository: ${{ fromJson(needs.Authorization.outputs.args).repo }}
ref: ${{ fromJson(needs.Authorization.outputs.args).ref }}
lfs: 'true'

# repo specific steps
#- name: Setup java
# uses: actions/setup-java@v1
# with:
# java-version: 1.8

# add blackduck properties https://synopsys.atlassian.net/wiki/spaces/INTDOCS/pages/631308372/Methods+for+Configuring+Analysis#Using-a-configuration-file
#- name: Setup blackduck properties
# run: |
# PROJECTS=$(mvn -am dependency:tree | grep maven-dependency-plugin | awk '{ out="com.nvidia:"$(NF-1);print out }' | grep rapids | xargs | sed -e 's/ /,/g')
# echo detect.maven.build.command="-pl=$PROJECTS -am" >> application.properties
# echo detect.maven.included.scopes=compile >> application.properties
- name: Setup blackduck properties
run: |
echo detect.excluded.detector.types=PIP >> application.properties
- name: Run blossom action
uses: NVIDIA/blossom-action@main
env:
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
REPO_KEY_DATA: ${{ secrets.BLOSSOM_KEY }}
with:
args1: ${{ fromJson(needs.Authorization.outputs.args).args1 }}
args2: ${{ fromJson(needs.Authorization.outputs.args).args2 }}
args3: ${{ fromJson(needs.Authorization.outputs.args).args3 }}

Job-trigger:
name: Start ci job
needs: [Vulnerability-scan]
runs-on: blossom
steps:
- name: Start ci job
run: blossom-ci
env:
OPERATION: 'START-CI-JOB'
CI_SERVER: ${{ secrets.CI_SERVER }}
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}

Post-processing:
name: Post processing
runs-on: blossom
if : github.event_name == 'workflow_dispatch'
steps:
- name: Start post processing
run: blossom-ci
env:
OPERATION: 'POST-PROCESSING'
CI_SERVER: ${{ secrets.CI_SERVER }}
REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
20 changes: 0 additions & 20 deletions .github/workflows/cleanup.yml

This file was deleted.

156 changes: 141 additions & 15 deletions .github/workflows/cron.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ name: crons
on:
schedule:
- cron: "0 2 * * *" # at 02:00 UTC
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

jobs:
cron-gpu:
Expand All @@ -13,7 +15,7 @@ jobs:
runs-on: [self-hosted, linux, x64, common]
strategy:
matrix:
pytorch-version: [1.5.0, 1.5.1, 1.6.0, latest]
pytorch-version: [1.5.1, 1.6.0, 1.7.1, 1.8.1, latest]
steps:
- uses: actions/checkout@v2
- name: Install the dependencies
Expand All @@ -23,15 +25,14 @@ jobs:
python -m pip uninstall -y torch torchvision
if [ ${{ matrix.pytorch-version }} == "latest" ]; then
python -m pip install torch torchvision
elif [ ${{ matrix.pytorch-version }} == "1.5.0" ]; then
python -m pip install torch==1.5.0
python -m pip install torchvision==0.6.0
elif [ ${{ matrix.pytorch-version }} == "1.5.1" ]; then
python -m pip install torch==1.5.1
python -m pip install torchvision==0.6.1
python -m pip install torch==1.5.1 torchvision==0.6.1
elif [ ${{ matrix.pytorch-version }} == "1.6.0" ]; then
python -m pip install torch==1.6.0
python -m pip install torchvision==0.7.0
python -m pip install torch==1.6.0 torchvision==0.7.0
elif [ ${{ matrix.pytorch-version }} == "1.7.1" ]; then
python -m pip install torch==1.7.1 torchvision==0.8.2
elif [ ${{ matrix.pytorch-version }} == "1.8.1" ]; then
python -m pip install torch==1.8.1 torchvision==0.9.1
fi
python -m pip install -r requirements-dev.txt
python -m pip list
Expand All @@ -43,10 +44,14 @@ jobs:
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage --unittests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --coverage --net # integration tests with coverage report
coverage xml
if pgrep python; then pkill python; fi
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
Expand All @@ -55,13 +60,20 @@ jobs:

cron-pt-image:
if: github.repository == 'Project-MONAI/MONAI'
strategy:
matrix:
container: ["pytorch:21.02", "pytorch:21.06"] # 21.02 for backward comp.
container:
image: nvcr.io/nvidia/pytorch:20.12-py3 # testing with the latest pytorch base image
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
options: "--gpus all"
runs-on: [self-hosted, linux, x64, common]
steps:
- uses: actions/checkout@v2
- name: Install the dependencies
- name: Install APT dependencies
run: |
apt-get update
DEBIAN_FRONTEND="noninteractive" apt-get install -y libopenslide0
- name: Install Python dependencies
run: |
which python
python -m pip install --upgrade pip wheel
Expand All @@ -75,16 +87,89 @@ jobs:
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage
python -c 'import torch; print(torch.rand(5, 3, device=torch.device("cuda:0")))'
BUILD_MONAI=1 ./runtests.sh --coverage --unittests # unit tests with coverage report
BUILD_MONAI=1 ./runtests.sh --coverage --net # integration tests with coverage report
coverage xml
if pgrep python; then pkill python; fi
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
file: ./coverage.xml

cron-pip:
# pip install monai[all] and use it to run unit tests
if: github.repository == 'Project-MONAI/MONAI'
strategy:
matrix:
container: ["pytorch:21.02", "pytorch:21.06"] # 21.02 for backward comp.
container:
image: nvcr.io/nvidia/${{ matrix.container }}-py3 # testing with the latest pytorch base image
options: "--gpus all"
runs-on: [self-hosted, linux, x64, common]
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Install the dependencies
run: |
which python
python -m pip install --upgrade pip wheel twine
python -m pip list
- name: Run tests report coverage
run: |
pip uninstall monai
pip list | grep -iv monai
git fetch --depth=1 origin +refs/tags/*:refs/tags/*
root_dir=$PWD
echo "$root_dir"
set -e
# build tar.gz and wheel
bash runtests.sh --clean # clear any existing dev temp files
python -m pip uninstall -y torch torchvision
python setup.py check -m -s
python setup.py sdist bdist_wheel
python -m twine check dist/*
# move packages to a temp dir
tmp_dir=$(mktemp -d)
cp dist/monai* "$tmp_dir"
rm -r build dist monai.egg-info
cd "$tmp_dir"
ls -al
# install from tar.gz
name=$(ls *.tar.gz | head -n1)
echo $name
python -m pip install $name[all]
python -c 'import monai; monai.config.print_config()' 2>&1 | grep -iv "unknown"
python -c 'import monai; print(monai.__file__)'
# run tests
cp $root_dir/requirements*.txt "$tmp_dir"
cp -r $root_dir/tests "$tmp_dir"
pwd
ls -al
export LAUNCH_DELAY=$[ $RANDOM % 16 * 60 ]
echo "Sleep $LAUNCH_DELAY"
sleep $LAUNCH_DELAY
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -m pip install -r requirements-dev.txt
PYTHONPATH="$tmp_dir":$PYTHONPATH BUILD_MONAI=1 python ./tests/runner.py -p 'test_((?!integration).)' # unit tests
if pgrep python; then pkill python; fi
cron-docker:
if: github.repository == 'Project-MONAI/MONAI'
container:
Expand All @@ -100,13 +185,54 @@ jobs:
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
ngc --version
BUILD_MONAI=1 ./runtests.sh --coverage --pytype
BUILD_MONAI=1 ./runtests.sh --coverage --pytype --unittests # unit tests with pytype checks, coverage report
BUILD_MONAI=1 ./runtests.sh --coverage --net # integration tests with coverage report
coverage xml
if pgrep python; then pkill python; fi
- name: Upload coverage
uses: codecov/codecov-action@v1
with:
fail_ci_if_error: false
file: ./coverage.xml

cron-tutorial-notebooks:
if: github.repository == 'Project-MONAI/MONAI'
needs: cron-gpu # so that monai itself is verified first
container:
image: nvcr.io/nvidia/pytorch:21.06-py3 # testing with the latest pytorch base image
options: "--gpus all --ipc=host"
runs-on: [self-hosted, linux, x64, common]
steps:
- uses: actions/checkout@v2
- name: Install MONAI
id: monai-install
run: |
which python
python -m pip install --upgrade pip wheel
python -m pip install -r requirements-dev.txt
BUILD_MONAI=0 python setup.py develop # install monai
nvidia-smi
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
echo $CUDA_VISIBLE_DEVICES
echo "::set-output name=devices::$CUDA_VISIBLE_DEVICES"
- name: Checkout tutorials and install their requirements
run: |
cd /opt
git clone --depth 1 --branch master --single-branch https://github.com/Project-MONAI/tutorials.git # latest commit of master branch
cd tutorials
python -m pip install -r requirements.txt
- name: Run tutorial notebooks
timeout-minutes: 150
run: |
export CUDA_VISIBLE_DEVICES=${{ steps.monai-install.outputs.devices }}
echo $CUDA_VISIBLE_DEVICES
trap 'if pgrep python; then pkill python; fi;' ERR
python -c $'import torch\na,b=torch.zeros(1,device="cuda:0"),torch.zeros(1,device="cuda:1");\nwhile True:print(a,b)' > /dev/null &
cd /opt/tutorials
$(pwd)/runner.sh
if pgrep python; then pkill python; fi
Loading

0 comments on commit 6f87afd

Please sign in to comment.