framework-integration-guides.rst 4.5 KB
Newer Older
L.S. Cook's avatar
L.S. Cook committed
1
.. framework-integration-guides:
2

3 4 5
###############################
Integrate Supported Frameworks
###############################
6

7 8
* :ref:`mxnet_intg`
* :ref:`tensorflow_intg`
L.S. Cook's avatar
L.S. Cook committed
9
* :ref:`neon_intg`
10

11 12 13 14
A framework is "supported" when there is a framework :term:`bridge` that can be 
cloned from one of our GitHub repos and built to connect to a supported backend
with nGraph, all the while maintaining the framework's programmatic or user 
interface. Current bridge-enabled frameworks include TensorFlow* and MXNet*. 
15

16 17 18
Once connected via the bridge, the framework can then run and train a deep 
learning model with various workloads on various backends using nGraph Compiler 
as an optimizing compiler available through the framework.  
19 20


21
.. _mxnet_intg:
22

23 24
MXNet\* bridge
===============
25

26
#. See the README on `nGraph-MXNet`_ Integration for how to enable the bridge.
27

28 29 30 31
#. (Optional) For experimental or alternative approaches to distributed training
   methodologies, including data parallel training, see the MXNet-relevant sections
   of the docs on :doc:`distr/index` and :doc:`How to <howto/index>` topics like
   :doc:`howto/distribute-train`. 
32

33

L.S. Cook's avatar
L.S. Cook committed
34 35
.. _tensorflow_intg:

36 37
TensorFlow\* bridge
===================
38

39
See the `ngraph tensorflow bridge README`_ for how to install the `DSO`_ for the 
40
nGraph-TensorFlow bridge.
41

42

L.S. Cook's avatar
L.S. Cook committed
43 44 45 46 47 48 49 50 51 52 53 54 55 56
.. _neon_intg:

neon |trade|
============

Use ``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 ``ngraph_dist`` installed. 

57 58
.. important:: As of version |version|, these instructions presume that your 
   system already has the library installed to the default location, as outlined 
59
   in our :doc:`buildlb` documentation. 
L.S. Cook's avatar
L.S. Cook committed
60 61


62 63 64
#. Set the ``NGRAPH_CPP_BUILD_PATH`` and the ``LD_LIBRARY_PATH``. You can use 
   the ``env`` command to see if these paths have been set already and if they 
   have not, they can be set with something like: 
L.S. Cook's avatar
L.S. Cook committed
65 66 67 68

   .. code-block:: bash

      export NGRAPH_CPP_BUILD_PATH=$HOME/ngraph_dist/
69
      export LD_LIBRARY_PATH=$HOME/ngraph_dist/lib/
L.S. Cook's avatar
L.S. Cook committed
70 71 72 73 74 75 76
      
#. The neon framework uses the :command:`pip` package manager during installation; 
   install it with Python version 3.5 or higher:

   .. code-block:: console

      $ sudo apt-get install python3-pip python3-venv
77 78
      $ python3 -m venv neon_venv
      $ cd neon_venv 
L.S. Cook's avatar
L.S. Cook committed
79
      $ . bin/activate
80
      (neon_venv) ~/frameworks$ 
L.S. Cook's avatar
L.S. Cook committed
81 82

#. Go to the "python" subdirectory of the ``ngraph`` repo we cloned during the 
83
   previous :doc:`buildlb`, and complete these actions: 
L.S. Cook's avatar
L.S. Cook committed
84 85 86

   .. code-block:: console

87 88 89 90
      (neon_venv)$ cd /opt/libraries/ngraph/python
      (neon_venv)$ git clone --recursive -b allow-nonconstructible-holders https://github.com/jagerman/pybind11.git
      (neon_venv)$ export PYBIND_HEADERS_PATH=/opt/libraries/ngraph/python/pybind11
      (neon_venv)$ pip install -U . 
L.S. Cook's avatar
L.S. Cook committed
91 92 93 94 95

#. Finally we're ready to install the `neon` integration: 

   .. code-block:: console

96 97 98
      (neon_venv)$ git clone git@github.com:NervanaSystems/ngraph-neon
      (neon_venv)$ cd ngraph-neon
      (neon_venv)$ make install
L.S. Cook's avatar
L.S. Cook committed
99 100 101 102 103

#. To test a training example, you can run the following from ``ngraph-neon/examples/cifar10``
   
   .. code-block:: console

104
      (neon_venv)$ python cifar10_conv.py
L.S. Cook's avatar
L.S. Cook committed
105

106 107 108
#. (Optional) For experimental or alternative approaches to distributed training
   methodologies, including data parallel training, see the :doc:`distr/index` 
   and :doc:`How to <howto/index>` articles on :doc:`howto/distribute-train`. 
L.S. Cook's avatar
L.S. Cook committed
109 110


111
.. _nGraph-MXNet: https://github.com/NervanaSystems/ngraph-mxnet/blob/master/NGRAPH_README.md
L.S. Cook's avatar
L.S. Cook committed
112
.. _MXNet: http://mxnet.incubator.apache.org
113
.. _DSO: http://csweb.cs.wfu.edu/%7Etorgerse/Kokua/More_SGI/007-2360-010/sgi_html/ch03.html
114
.. _ngraph-neon python README: https://github.com/NervanaSystems/ngraph/blob/master/python/README.md
115
.. _ngraph neon repo's README: https://github.com/NervanaSystems/ngraph-neon/blob/master/README.md
L.S. Cook's avatar
L.S. Cook committed
116
.. _neon docs: https://github.com/NervanaSystems/neon/tree/master/doc
117 118
.. _being the fastest: https://github.com/soumith/convnet-benchmarks
.. _for training CNN-based models with GPUs: https://www.microway.com/hpc-tech-tips/deep-learning-frameworks-survey-tensorflow-torch-theano-caffe-neon-ibm-machine-learning-stack
119
.. _ngraph tensorflow bridge README: https://github.com/NervanaSystems/ngraph-tf