Skip to content

Commit 9e476ca

Browse files
authored
Merge pull request #141 from Project-MONAI/master
merge master
2 parents 468a6bf + 12b3fbf commit 9e476ca

27 files changed

+810
-235
lines changed

.github/workflows/cron.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
echo $CUDA_VISIBLE_DEVICES
3636
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
3737
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
38-
./runtests.sh --coverage
38+
BUILD_MONAI=1 ./runtests.sh --coverage
3939
coverage xml
4040
- name: Upload coverage
4141
uses: codecov/codecov-action@v1
@@ -58,7 +58,7 @@ jobs:
5858
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
5959
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
6060
ngc --version
61-
./runtests.sh --coverage --pytype
61+
BUILD_MONAI=1 ./runtests.sh --coverage --pytype
6262
coverage xml
6363
- name: Upload coverage
6464
uses: codecov/codecov-action@v1

.github/workflows/pythonapp.yml

Lines changed: 59 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -76,17 +76,17 @@ jobs:
7676
python -m pip install torch==1.4 -f https://download.pytorch.org/whl/cpu/torch_stable.html
7777
python -m pip install torchvision==0.5.0
7878
# min. requirements for windows instances
79-
python -c "f=open('requirements-dev.txt', 'r'); txt=f.readlines(); f.close(); print(txt); f=open('requirements-dev.txt', 'w'); f.writelines(txt[1:12]); f.close()"
79+
python -c "f=open('requirements-dev.txt', 'r'); txt=f.readlines(); f.close(); print(txt); f=open('requirements-dev.txt', 'w'); f.writelines(txt[1:13]); f.close()"
8080
- name: Install the dependencies
8181
run: |
8282
python -m pip install torch==1.4
8383
python -m pip install torchvision==0.5.0
8484
cat "requirements-dev.txt"
8585
python -m pip install -r requirements-dev.txt
8686
python -m pip list
87-
SKIP_MONAI_BUILD=1 python setup.py develop
87+
python setup.py develop
8888
python setup.py develop --uninstall
89-
python setup.py develop # compile the cpp extensions
89+
BUILD_MONAI=1 python setup.py develop # compile the cpp extensions
9090
shell: bash
9191
- name: Run quick tests (CPU ${{ runner.os }})
9292
run: |
@@ -95,6 +95,56 @@ jobs:
9595
env:
9696
QUICKTEST: True
9797

98+
min-dep-py3: # min dependencies installed
99+
runs-on: ${{ matrix.os }}
100+
strategy:
101+
fail-fast: false
102+
matrix:
103+
os: [windows-latest, macOS-latest, ubuntu-latest]
104+
timeout-minutes: 20
105+
steps:
106+
- uses: actions/checkout@v2
107+
- name: Set up Python 3.x
108+
uses: actions/setup-python@v1
109+
with:
110+
python-version: '3.x'
111+
- name: Prepare pip wheel
112+
run: |
113+
which python
114+
python -m pip install --upgrade pip wheel
115+
- name: cache weekly timestamp
116+
id: pip-cache
117+
run: |
118+
echo "::set-output name=datew::$(date '+%Y-%V')"
119+
echo "::set-output name=dir::$(pip cache dir)"
120+
shell: bash
121+
- name: cache for pip
122+
uses: actions/cache@v2
123+
id: cache
124+
with:
125+
path: ${{ steps.pip-cache.outputs.dir }}
126+
key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }}
127+
- if: runner.os == 'windows'
128+
name: Install torch cpu from pytorch.org (Windows only)
129+
run: |
130+
python -m pip install torch==1.4 -f https://download.pytorch.org/whl/cpu/torch_stable.html
131+
- name: Install the dependencies
132+
run: |
133+
# min. requirements for windows instances
134+
python -m pip install torch==1.4
135+
python -c "f=open('requirements-dev.txt', 'r'); txt=f.readlines(); f.close(); print(txt); f=open('requirements-dev.txt', 'w'); f.writelines(txt[1:6]); f.close()"
136+
cat "requirements-dev.txt"
137+
python -m pip install -r requirements-dev.txt
138+
python -m pip list
139+
BUILD_MONAI=0 python setup.py develop # no compile of extensions
140+
shell: bash
141+
- name: Run quick tests (CPU ${{ runner.os }})
142+
run: |
143+
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
144+
python -m tests.min_tests
145+
env:
146+
QUICKTEST: True
147+
98148
GPU-quick-py3: # GPU with full dependencies
99149
strategy:
100150
matrix:
@@ -170,11 +220,11 @@ jobs:
170220
run: |
171221
python -m pip list
172222
nvidia-smi
173-
export CUDA_VISIBLE_DEVICES=$(python -m tests.utils)
223+
export CUDA_VISIBLE_DEVICES=$(coverage run -m tests.utils)
174224
echo $CUDA_VISIBLE_DEVICES
175225
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
176226
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
177-
./runtests.sh --quick
227+
BUILD_MONAI=1 ./runtests.sh --quick
178228
if [ ${{ matrix.environment }} == "PT16+CUDA110" ]; then
179229
# test the clang-format tool downloading once
180230
coverage run -m tests.clang_format_utils
@@ -274,4 +324,7 @@ jobs:
274324
- name: Make html
275325
run: |
276326
cd docs/
277-
make html
327+
make clean
328+
make html 2>&1 | tee tmp_log
329+
if [[ $(grep -c "^WARNING:" tmp_log) != 0 ]]; then echo "found warnings"; exit 1; fi
330+
shell: bash

.github/workflows/setupapp.yml

Lines changed: 13 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ jobs:
4343
echo $CUDA_VISIBLE_DEVICES
4444
python -c "import torch; print(torch.__version__); print('{} of GPUs available'.format(torch.cuda.device_count()))"
4545
python -c 'import torch; print(torch.rand(5,3, device=torch.device("cuda:0")))'
46-
./runtests.sh --coverage
46+
BUILD_MONAI=1 ./runtests.sh --coverage
4747
coverage xml
4848
- name: Upload coverage
4949
uses: codecov/codecov-action@v1
@@ -83,65 +83,15 @@ jobs:
8383
run: |
8484
python -m pip list
8585
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
86-
./runtests.sh --quick
86+
BUILD_MONAI=1 ./runtests.sh --quick
8787
coverage xml
8888
- name: Upload coverage
8989
uses: codecov/codecov-action@v1
9090
with:
9191
fail_ci_if_error: false
9292
file: ./coverage.xml
9393

94-
min-dep-py3: # min dependencies installed
95-
runs-on: ${{ matrix.os }}
96-
strategy:
97-
fail-fast: false
98-
matrix:
99-
os: [windows-latest, macOS-latest, ubuntu-latest]
100-
timeout-minutes: 20
101-
steps:
102-
- uses: actions/checkout@v2
103-
- name: Set up Python 3.x
104-
uses: actions/setup-python@v1
105-
with:
106-
python-version: '3.x'
107-
- name: Prepare pip wheel
108-
run: |
109-
which python
110-
python -m pip install --upgrade pip wheel
111-
- name: cache weekly timestamp
112-
id: pip-cache
113-
run: |
114-
echo "::set-output name=datew::$(date '+%Y-%V')"
115-
echo "::set-output name=dir::$(pip cache dir)"
116-
shell: bash
117-
- name: cache for pip
118-
uses: actions/cache@v2
119-
id: cache
120-
with:
121-
path: ${{ steps.pip-cache.outputs.dir }}
122-
key: ${{ matrix.os }}-latest-pip-${{ steps.pip-cache.outputs.datew }}
123-
- if: runner.os == 'windows'
124-
name: Install torch cpu from pytorch.org (Windows only)
125-
run: |
126-
python -m pip install torch==1.4 -f https://download.pytorch.org/whl/cpu/torch_stable.html
127-
- name: Install the dependencies
128-
run: |
129-
# min. requirements for windows instances
130-
python -m pip install torch==1.4
131-
python -c "f=open('requirements-dev.txt', 'r'); txt=f.readlines(); f.close(); print(txt); f=open('requirements-dev.txt', 'w'); f.writelines(txt[1:5]); f.close()"
132-
cat "requirements-dev.txt"
133-
python -m pip install -r requirements-dev.txt
134-
python -m pip list
135-
SKIP_MONAI_BUILD=1 python setup.py develop # no compile of extensions
136-
shell: bash
137-
- name: Run quick tests (CPU ${{ runner.os }})
138-
run: |
139-
python -c 'import torch; print(torch.__version__); print(torch.rand(5,3))'
140-
python -m tests.min_tests
141-
env:
142-
QUICKTEST: True
143-
144-
install:
94+
install: # pip install from github url
14595
runs-on: ubuntu-latest
14696
steps:
14797
- name: Set up Python 3.7
@@ -158,14 +108,19 @@ jobs:
158108
with:
159109
path: ~/.cache/pip
160110
key: ${{ runner.os }}-pip-${{ steps.pip-cache.outputs.datew }}
161-
- name: Install the default branch
162-
run: |
163-
pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
164-
- name: Import
111+
- name: Install the default branch no build
165112
run: |
113+
BUILD_MONAI=0 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
166114
python -c 'import monai; monai.config.print_config()'
167-
- name: Uninstall
115+
cd $(python -c 'import monai; import os; print(os.path.dirname(monai.__file__))')
116+
ls .
117+
pip uninstall -y monai
118+
- name: Install the default branch with build
168119
run: |
120+
BUILD_MONAI=1 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
121+
python -c 'import monai; monai.config.print_config()'
122+
cd $(python -c 'import monai; import os; print(os.path.dirname(monai.__file__))')
123+
ls .
169124
pip uninstall -y monai
170125
171126
docker:

MANIFEST.in

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,3 @@ include monai/_version.py
33

44
include README.md
55
include LICENSE
6-
7-
recursive-exclude * __pycache__
8-
recursive-exclude * *.py[co]

docs/source/conf.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@
4646
"visualize",
4747
"utils",
4848
"inferers",
49+
"optimizers",
4950
]
5051

5152

docs/source/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,7 @@ Technical documentation is available at `docs.monai.io <https://docs.monai.io>`_
5757
losses
5858
networks
5959
metrics
60+
optimizers
6061
data
6162
engines
6263
inferers

docs/source/installation.md

Lines changed: 20 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ for the latest features:
4040
```bash
4141
pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
4242
```
43+
or, to build with MONAI Cpp/CUDA extensions:
44+
```bash
45+
BUILD_MONAI=1 pip install git+https://github.com/Project-MONAI/MONAI#egg=MONAI
46+
```
4347
this command will download and install the current master branch of [MONAI from
4448
GitHub](https://github.com/Project-MONAI/MONAI).
4549

@@ -55,17 +59,25 @@ You can install it by running:
5559
```bash
5660
cd MONAI/
5761
python setup.py develop
62+
```
63+
or, to build with MONAI Cpp/CUDA extensions and install:
64+
```bash
65+
cd MONAI/
66+
BUILD_MONAI=1 python setup.py develop
67+
# for MacOS
68+
BUILD_MONAI=1 CC=clang CXX=clang++ python setup.py develop
69+
```
5870

59-
# For MacOS:
60-
# CC=clang CXX=clang++ python setup.py develop
61-
62-
# To install without build
63-
# SKIP_MONAI_BUILD=1 python setup.py develop
64-
65-
# To uninstall the package please run:
71+
To uninstall the package please run:
72+
```bash
73+
cd MONAI/
6674
python setup.py develop --uninstall
75+
76+
# to further clean up the MONAI/ folder (Bash script)
77+
./runtests.sh --clean
6778
```
68-
or simply adding the root directory of the cloned source code (e.g., ``/workspace/Documents/MONAI``) to your ``$PYTHONPATH``
79+
80+
Alternatively, simply adding the root directory of the cloned source code (e.g., ``/workspace/Documents/MONAI``) to your ``$PYTHONPATH``
6981
and the codebase is ready to use (without the additional features of MONAI C++/CUDA extensions).
7082

7183

docs/source/optimizers.rst

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
:github_url: https://github.com/Project-MONAI/MONAI
2+
3+
.. _optimizers:
4+
5+
Optimizers
6+
==========
7+
.. currentmodule:: monai.optimizers
8+
9+
`Novograd`
10+
----------
11+
.. autoclass:: Novograd
12+
:members:

monai/README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020

2121
* **networks**: contains network definitions, component definitions, and Pytorch specific utilities.
2222

23+
* **optimizers**: classes defining optimizers.
24+
2325
* **transforms**: defines data transforms for preprocessing and postprocessing.
2426

2527
* **utils**: generic utilities intended to be implemented in pure Python or using Numpy,

monai/__init__.py

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
import sys
1414

1515
from ._version import get_versions
16-
from .utils.module import load_submodules
16+
17+
PY_REQUIRED_MAJOR = 3
18+
PY_REQUIRED_MINOR = 6
1719

1820
__version__ = get_versions()["version"]
1921
del get_versions
@@ -22,6 +24,15 @@
2224

2325
__basedir__ = os.path.dirname(__file__)
2426

27+
if not (sys.version_info.major == PY_REQUIRED_MAJOR and sys.version_info.minor >= PY_REQUIRED_MINOR):
28+
raise RuntimeError(
29+
"MONAI requires Python {}.{} or higher. But the current Python is: {}".format(
30+
PY_REQUIRED_MAJOR, PY_REQUIRED_MINOR, sys.version
31+
),
32+
)
33+
34+
from .utils.module import load_submodules # noqa: E402
35+
2536
# handlers_* have some external decorators the users may not have installed
2637
# *.so files and folder "_C" may not exist when the cpp extensions are not compiled
2738
excludes = "(^(monai.handlers))|((\\.so)$)|(^(monai._C))"

0 commit comments

Comments
 (0)