index.rst 2 KB
Newer Older
1
.. backend-support/index.rst
L.S. Cook's avatar
L.S. Cook committed
2

3 4
About backends
##############
5

6
* :ref:`what_is_backend`
Leona C's avatar
Leona C committed
7
* :ref:`how_to_use`
8 9


10 11 12 13
.. _what_is_backend:

What's a backend?
-----------------
L.S. Cook's avatar
L.S. Cook committed
14

15 16 17 18 19 20
In the nGraph Compiler stack, what we call a *backend* is responsible for 
function execution and value allocation. A  backend can be used to 
:doc:`carry out a programmed computation<../core/constructing-graphs/execute>` 
from a framework on a CPU or GPU; or it can be used with an *Interpreter* mode, 
which is primarily intended for testing, to analyze a program, or to help a 
framework developer customize targeted solutions. Experimental APIs to support 
21
current and future nGraph Backends are also available; see, for example, the 
Leona C's avatar
Leona C committed
22
section on :doc:`plaidml-ng-api/index`.
23

Leona C's avatar
Leona C committed
24 25 26 27 28 29 30 31 32
.. csv-table::
   :header: "Backend", "Current nGraph support", "Future nGraph support"
   :widths: 35, 10, 10

   Intel® Architecture Processors (CPUs), Yes, Yes
   Intel® Nervana™ Neural Network Processor™ (NNPs), Yes, Yes
   NVIDIA\* CUDA (GPUs), Yes, Some 
   AMD\* GPUs, Yes, Some

L.S. Cook's avatar
L.S. Cook committed
33

Leona C's avatar
Leona C committed
34
.. _how_to_use:
L.S. Cook's avatar
L.S. Cook committed
35

Leona C's avatar
Leona C committed
36 37
How to use?
-----------
L.S. Cook's avatar
L.S. Cook committed
38

Leona C's avatar
Leona C committed
39 40 41 42
#. Create a ``Backend``; think of it as a compiler. 
#. A ``Backend`` can then produce an ``Executable`` by calling ``compile``. 
#. A single iteration of the executable is executed by calling the ``call``
   method on the ``Executable`` object.
43

Leona C's avatar
Leona C committed
44 45
.. figure:: ../graphics/execution-interface.png
   :width: 650px
46

Leona C's avatar
Leona C committed
47
   The execution interface for nGraph 
48 49


Leona C's avatar
Leona C committed
50 51
The nGraph execution API for ``Executable`` objects is a simple, five-method 
interface; each backend implements the following five functions:
52 53


Leona C's avatar
Leona C committed
54 55 56 57 58 59 60 61
* The ``create_tensor()`` method allows the bridge to create tensor objects 
  in host memory or an accelerator's memory.
* The ``write()`` and ``read()`` methods are used to transfer raw data into 
  and out of tensors that reside in off-host memory.
* The ``compile()`` method instructs the backend to prepare an nGraph function 
  for later execution.
* And, finally, the ``call()`` method is used to invoke an nGraph function 
  against a particular set of tensors.