diff --git a/BUILDING.md b/BUILDING.md index b06d46eb..2b9dee2b 100644 --- a/BUILDING.md +++ b/BUILDING.md @@ -22,7 +22,6 @@ You can verify whether you have version `>=2.6.1` installed using the command: $ protoc --version libprotoc 3.4.0 - #### nGraph The other requirement is of course nGraph and nGraph's Python bindings. @@ -33,25 +32,36 @@ You can follow these instructions to build an nGraph Python wheel containing bot Prepare System: # apt update - # apt install python3 python3-pip python3-dev - # apt install build-essential cmake curl clang-3.9 git zlib1g zlib1g-dev libtinfo-dev + # apt install python3 python3-pip python3-dev python-virtualenv + # apt install build-essential cmake curl clang-3.9 git zlib1g zlib1g-dev libtinfo-dev unzip autoconf automake libtool -Clone nGraph's `v0.10.0` tag, build and install it into `$HOME/ngraph_dist`: +Clone nGraph's `v0.14.0` tag, build and install it into `$HOME/ngraph_dist`: - $ git clone -b 'v0.10.0' --single-branch --depth 1 https://github.com/NervanaSystems/ngraph.git + $ cd # Change directory to where you would like to clone nGraph sources + $ git clone -b 'v0.14.0' --single-branch --depth 1 https://github.com/NervanaSystems/ngraph.git $ mkdir ngraph/build $ cd ngraph/build - $ cmake ../ -DNGRAPH_USE_PREBUILT_LLVM=TRUE -DCMAKE_INSTALL_PREFIX=$HOME/ngraph_dist -DNGRAPH_ONNX_IMPORT_ENABLE=TRUE + $ cmake ../ -DCMAKE_INSTALL_PREFIX=$HOME/ngraph_dist -DNGRAPH_ONNX_IMPORT_ENABLE=TRUE -DNGRAPH_USE_PREBUILT_LLVM=TRUE $ make $ make install +Prepare a Python virtual environment for nGraph (recommended): + + $ mkdir -p ~/.virtualenvs && cd ~/.virtualenvs + $ virtualenv -p $(which python3) nGraph + $ source nGraph/bin/activate + (nGraph) $ + Build Python package (Binary wheel) for nGraph: - $ cd ngraph/python - $ git clone --recursive -b allow-nonconstructible-holders https://github.com/jagerman/pybind11.git - $ export PYBIND_HEADERS_PATH=$PWD/pybind11 - $ export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist - $ python3 setup.py bdist_wheel + (nGraph) $ cd # Change directory to where you have cloned nGraph sources + (nGraph) $ cd ngraph/python + (nGraph) $ git clone --recursive https://github.com/jagerman/pybind11.git + (nGraph) $ export PYBIND_HEADERS_PATH=$PWD/pybind11 + (nGraph) $ export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist + (nGraph) $ export NGRAPH_ONNX_IMPORT_ENABLE=TRUE + (nGraph) $ pip install numpy + (nGraph) $ python setup.py bdist_wheel For additional information how to build nGraph Python bindings see: @@ -61,7 +71,7 @@ Once the Python binary wheel file (`ngraph-*.whl`) is prepared you can install i For example: - (your_venv) $ pip install -U dist/ngraph-0.10.0-cp35-cp35m-linux_x86_64.whl + (nGraph) $ pip install -U dist/ngraph_core-0.0.0.dev0-cp35-cp35m-linux_x86_64.whl You can check that nGraph is properly installed in your Python shell: @@ -71,12 +81,27 @@ You can check that nGraph is properly installed in your Python shell: ``` -If you don't see any errors, nGraph should be installed correctly. +Additionally check that nGraph and nGraph's Python wheel were both build with the `NGRAPH_ONNX_IMPORT_ENABLE` option: +```python +from ngraph.impl import onnx_import +``` + +If you don't see any errors, nGraph should be installed correctly. ### Installing ngraph-onnx -You can install ngraph-onnx using pip: +You can install ngraph-onnx using the following commands. Clone `ngraph-onnx` sources to the same directory where you cloned `ngraph` sources. + + (nGraph) $ cd # Change directory to where you have cloned nGraph sources + (nGraph) $ git clone -b 'v0.14.0' --single-branch --depth 1 https://github.com/NervanaSystems/ngraph-onnx.git + (nGraph) $ cd ngraph-onnx + (nGraph) $ pip install -r requirements.txt + (nGraph) $ pip install -r requirements_test.txt + (nGraph) $ pip install -e . - (your_venv) $ pip install git+https://github.com/NervanaSystems/ngraph-onnx/@v0.10.0 +#### Running tests + (nGraph) $ pytest tests/ --backend=CPU -v + (nGraph) $ pytest tests_core/ --backend=CPU -v + (nGraph) $ NGRAPH_BACKEND=CPU TOX_INSTALL_NGRAPH_FROM=../ngraph/python tox diff --git a/setup.py b/setup.py index 5532a598..1cd5853f 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ SOURCES_ROOT = path.abspath(path.dirname(__file__)) setup(name='ngraph-onnx', - version='0.10.0', + version='0.14.0', description='nGraph Backend for ONNX', long_description=open(path.join(SOURCES_ROOT, 'README.md')).read(), long_description_content_type='text/markdown', diff --git a/tests_core/test_backend.py b/tests_core/test_backend.py index 594e998c..1fd2abc0 100644 --- a/tests_core/test_backend.py +++ b/tests_core/test_backend.py @@ -35,6 +35,17 @@ # import all test cases at global scope to make them visible to python.unittest backend_test = onnx.backend.test.BackendTest(NgraphBackend, __name__) +# Fixed in nGraph after 0.14.0 +backend_test.exclude('test_acosh') +backend_test.exclude('test_acosh_example') +backend_test.exclude('test_asinh') +backend_test.exclude('test_asinh_example') +backend_test.exclude('test_atanh') +backend_test.exclude('test_atanh_example') +backend_test.exclude('test_sign') +backend_test.exclude('test_where_example') +backend_test.exclude('test_sign_model') + # MaxPool Indices -> NGRAPH-3131 backend_test.exclude('test_maxpool_with_argmax')