Integrate Supported Frameworks¶
Compile MXNet with nGraph¶
These instructions pick up from where the Install
installation instructions left off, so they presume that your system already
has the library installed at
$HOME/ngraph_dist as the default location.
If the nGraph library code has not yet been installed to your system, please go back
and return here to finish compiling MXNet with
LD_LIBRARY_PATHpath to the location where we built the nGraph libraries:
Add the MXNet prerequisites to your system, if the system doesn’t have them already. These requirements are Ubuntu*-specific.
$ sudo apt-get install -y libopencv-dev curl libatlas-base-dev python python-pip python-dev python-opencv graphviz python-scipy python-sklearn libopenblas-dev
$ git clone --recursive email@example.com:NervanaSystems/ngraph-mxnet.git
make/config.mkfile from the repo we just checked out to set the
100) to true with 1 and set the
101) to point to the installation location target where the nGraph library was installed:
USE_NGRAPH = 1 NGRAPH_DIR = $(HOME)/ngraph_dist
Ensure that settings on the config file are disabled for
# whether use MKL2017 library USE_MKL2017 = 0 # whether use MKL2017 experimental feature for high performance # Prerequisite USE_MKL2017=1 USE_MKL2017_EXPERIMENTAL = 0 # whether use NNPACK library USE_NNPACK = 0
Finally, compile MXNet with Intel® nGraph:
$ make -j $(nproc)
After successfully running
make, install the Python integration packages that your MXNet build needs to run a training example.
$ cd python && pip install -e . && cd ../
Confirm a successful integration by running the MNIST training example:
$ python example/image-classification/train_mnist.py
See the ngraph tensorflow bridge README for how to install the nGraph-TensorFlow bridge.
neon as a frontend for nGraph backends¶
neon is an open source Deep Learning framework that has a history
of being the fastest framework for training CNN-based models with GPUs.
Detailed info about neon’s features and functionality can be found in the
neon docs. This section covers installing neon on an existing
system that already has an
The numbered instructions below pick up from where
the Install instructions left off, and they presume that your system
already has the ngraph library installed installed at
as the default location. If the nGraph library code has not yet been installed to
your system, you can follow the instructions on the ngraph-neon python README
to install everything at once.
LD_LIBRARY_PATHpath to the location where you built the nGraph libraries. (This example shows the default location):
export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist/ export LD_LIBRARY_PATH=$HOME/ngraph_dist/lib/
The neon framework uses the pip package manager during installation; install it with Python version 3.5 or higher:
$ sudo apt-get install python3-pip python3-venv $ python3 -m venv frameworks $ cd frameworks $ . bin/activate (frameworks) ~/frameworks$
Go to the “python” subdirectory of the
ngraphrepo we cloned during the previous Install, and complete these actions:
(frameworks)$ cd /opt/libraries/ngraph/python (frameworks)$ git clone --recursive -b allow-nonconstructible-holders https://github.com/jagerman/pybind11.git (frameworks)$ export PYBIND_HEADERS_PATH=/opt/libraries/ngraph/python/pybind11 (frameworks)$ pip install -U .
Finally we’re ready to install the neon integration:
(frameworks)$ git clone firstname.lastname@example.org:NervanaSystems/ngraph-neon (frameworks)$ cd ngraph-neon (frameworks)$ make install
To test a training example, you can run the following from
(frameworks)$ python cifar10_conv.py