Skip to content

Commit

Permalink
added an installation section
Browse files Browse the repository at this point in the history
  • Loading branch information
madsbk committed Apr 6, 2016
1 parent 81ee469 commit f97c687
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
10 changes: 5 additions & 5 deletions docs/source/index.rst
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
.. npbackend documentation master file, created by
sphinx-quickstart on Sat Nov 15 15:00:55 2014.
You can adapt this file completely to your liking, but it should at least
contain the root `toctree` directive.
Welcome to npbackend's documentation!
=====================================

The **npbackend** is a backend interface to Python/NumPy that translates NumPy array operations into a sequence of Python function calls. By implementing these Python functions, external libraries can accelerate NumPy array operations without any modifications to the user Python/NumPy code.

For now, **npbackend** is integrated with the `Bohrium <http://www.bh107.org>`_ project and cannot be installed separately (the source code can be found `here <https://github.com/bh107/bohrium/tree/master/bridge/npbackend>`_) but it is our intension to decouple **npbackend** out of `Bohrium <http://www.bh107.org>`_ to become a standalone project.

Contents:

.. toctree::
:maxdepth: 2

installation.rst
usage.rst
snippets.rst
apidocs.rst
Expand Down
4 changes: 4 additions & 0 deletions docs/source/installation.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Installation
============

Since **npbackend** is integrated with the `Bohrium <http://www.bh107.org>`_, in order to install **npbackend** you simple has to install `Bohrium <http://www.bh107.org>`_. The installation guide can be found at http://www.bh107.org/installation/index.html.
22 changes: 12 additions & 10 deletions docs/source/usage.rst
Original file line number Diff line number Diff line change
@@ -1,25 +1,27 @@
Usage
=====

Using ``npbackend`` requires enabling the module and choosing a ``target``.
Using **npbackend** requires enabling the module and choosing a ``target``.

Enabling ``npbackend``
.. note:: Since **npbackend** is integrated with `Bohrium <http://www.bh107.org>`_, the module name is ``bohrium`` and not ``npbackend``.

Enabling **npbackend**
----------------------

The least intrusive method of enabling ``npbackend`` is invoking your Python
The least intrusive method of enabling ``bohrium`` is invoking your Python
program with the module loaded. Which means instead of invoking your
Python/NumPy program like this::

python my_program.py

You will invoke it like this instead::

python -m npbackend my_program.py
python -m bohrium my_program.py

Which will effectively overrule the ``numpy`` module and instead use
``npbackend``. That is all it takes.
``bohrium``. That is all it takes.

Another approach is replacing your ``import numpy`` statements with ``import npbackend``. For example, replacing:
Another approach is replacing your ``import numpy`` statements with ``import bohrium``. For example, replacing:

.. code-block:: python
Expand All @@ -29,12 +31,12 @@ With:

.. code-block:: python
import npbackend as np
import bohrium as np
Choosing a ``npbackend`` target
Choosing a **npbackend** target
-------------------------------

``npbackend`` will default to using Bohrium as the backend target. Changing
**npbackend** will default to using Bohrium as the backend target. Changing
backend target is done via the ``NPBE_TARGET`` environment variable. Valid
values for ``NPBE_TARGET`` are:

Expand All @@ -48,7 +50,7 @@ values for ``NPBE_TARGET`` are:
If you which to use something else than the default target, then you can invoke
your Python/NumPy application with::

NPBE_TARGET="numexpr" python -m npbackend my_program.py
NPBE_TARGET="numexpr" python -m bohrium my_program.py

Or if your changed import statements::

Expand Down

0 comments on commit f97c687

Please sign in to comment.